@aderis-erp/cli 1.0.17 → 1.1.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/dist/commands/access-groups.js +49 -17
- package/dist/commands/account-transaction-allocations.js +46 -14
- package/dist/commands/account-transactions.js +75 -35
- package/dist/commands/accounts.js +54 -22
- package/dist/commands/agent-platform.js +53 -21
- package/dist/commands/{nango-integrations.d.ts → agent-runs.d.ts} +1 -1
- package/dist/commands/agent-runs.js +1155 -0
- package/dist/commands/analytics.js +47 -15
- package/dist/commands/api-keys.js +49 -16
- package/dist/commands/{text-templates.d.ts → async-jobs.d.ts} +1 -1
- package/dist/commands/async-jobs.js +1158 -0
- package/dist/commands/audit-log.js +46 -14
- package/dist/commands/bank-accounts.js +63 -30
- package/dist/commands/bank-integrations.d.ts +1 -0
- package/dist/commands/bank-integrations.js +66 -31
- package/dist/commands/business-partners.js +77 -44
- package/dist/commands/chat.js +52 -19
- package/dist/commands/credit-card-accounts.d.ts +1 -0
- package/dist/commands/credit-card-accounts.js +67 -29
- package/dist/commands/delivery-notes.js +78 -44
- package/dist/commands/dunning-configs.js +49 -17
- package/dist/commands/dunning-reminders.js +52 -20
- package/dist/commands/dunning-runs.js +45 -13
- package/dist/commands/email-transactions.js +47 -15
- package/dist/commands/employees.js +76 -44
- package/dist/commands/entity-configurations.js +47 -15
- package/dist/commands/event-processor-mappings.js +49 -17
- package/dist/commands/files.js +56 -24
- package/dist/commands/health.js +49 -17
- package/dist/commands/{tag-configurations.d.ts → imports.d.ts} +1 -1
- package/dist/commands/{tag-configurations.js → imports.js} +59 -31
- package/dist/commands/inbox.js +52 -19
- package/dist/commands/integration-identities.d.ts +40 -0
- package/dist/commands/integration-identities.js +1151 -0
- package/dist/commands/integrations.js +47 -15
- package/dist/commands/item-categories.js +49 -17
- package/dist/commands/items.js +49 -17
- package/dist/commands/journal-lines.js +45 -13
- package/dist/commands/journals.js +68 -36
- package/dist/commands/ledgers.d.ts +3 -1
- package/dist/commands/ledgers.js +96 -34
- package/dist/commands/my-account.d.ts +39 -0
- package/dist/commands/my-account.js +1160 -0
- package/dist/commands/office-locations.js +49 -17
- package/dist/commands/payment-methods.js +54 -22
- package/dist/commands/payment-runs.js +61 -29
- package/dist/commands/payment-terms.js +50 -18
- package/dist/commands/payments.js +51 -19
- package/dist/commands/payroll-runs.d.ts +43 -0
- package/dist/commands/payroll-runs.js +1188 -0
- package/dist/commands/permissions.d.ts +39 -0
- package/dist/commands/{text-templates.js → permissions.js} +54 -30
- package/dist/commands/price-lists.js +54 -22
- package/dist/commands/processor-mappings.js +48 -16
- package/dist/commands/processors.js +55 -24
- package/dist/commands/purchase-order-types.js +49 -17
- package/dist/commands/purchase-orders.js +69 -36
- package/dist/commands/reports.js +49 -17
- package/dist/commands/roles.d.ts +39 -0
- package/dist/commands/{nango-integrations.js → roles.js} +63 -26
- package/dist/commands/salary-types.js +49 -17
- package/dist/commands/sales-invoices.js +84 -51
- package/dist/commands/sales-orders.js +78 -44
- package/dist/commands/saved-views.js +47 -15
- package/dist/commands/scheduled-processor-mappings.js +49 -17
- package/dist/commands/schedules.js +53 -21
- package/dist/commands/support/end.d.ts +9 -0
- package/dist/commands/support/end.js +29 -0
- package/dist/commands/support/start.d.ts +14 -0
- package/dist/commands/support/start.js +50 -0
- package/dist/commands/support/status.d.ts +10 -0
- package/dist/commands/support/status.js +45 -0
- package/dist/commands/support/tenants.d.ts +10 -0
- package/dist/commands/support/tenants.js +39 -0
- package/dist/commands/tags.js +51 -18
- package/dist/commands/tax-codes.js +52 -20
- package/dist/commands/tax-matrix.js +49 -17
- package/dist/commands/templates.d.ts +39 -0
- package/dist/commands/templates.js +1157 -0
- package/dist/commands/tenants.js +52 -20
- package/dist/commands/tools.js +46 -14
- package/dist/commands/users.d.ts +42 -0
- package/dist/commands/users.js +1174 -0
- package/dist/commands/vat-declarations.d.ts +2 -0
- package/dist/commands/vat-declarations.js +72 -36
- package/dist/commands/vendor-invoices.js +81 -49
- package/dist/commands/webhooks.js +51 -19
- package/dist/commands/workflows.js +47 -15
- package/dist/lib/api-client.d.ts +6 -0
- package/dist/lib/api-client.js +13 -0
- package/dist/lib/auth/constants.d.ts +12 -0
- package/dist/lib/auth/constants.js +12 -0
- package/dist/lib/auth/index.d.ts +11 -1
- package/dist/lib/auth/index.js +105 -6
- package/dist/lib/auth/jwks.d.ts +19 -0
- package/dist/lib/auth/jwks.js +112 -0
- package/dist/lib/auth/keycloak-provider.d.ts +45 -7
- package/dist/lib/auth/keycloak-provider.js +161 -27
- package/dist/lib/auth/tokens.d.ts +8 -3
- package/dist/lib/auth/tokens.js +8 -7
- package/dist/lib/auth/types.d.ts +5 -1
- package/dist/lib/config.d.ts +18 -0
- package/dist/lib/config.js +10 -0
- package/oclif.manifest.json +2182 -744
- package/package.json +7 -4
package/dist/commands/ledgers.js
CHANGED
|
@@ -1,32 +1,60 @@
|
|
|
1
1
|
import { Command, Args, Flags } from '@oclif/core';
|
|
2
|
-
import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
|
|
2
|
+
import { apiRequest, ApiError, isTextualMediaType, normalizeSortBy } from '../lib/api-client.js';
|
|
3
3
|
import { getCurrentContext, getContext, getBaseUrls, hasCredentials, missingCredentialsMessage } from '../lib/config.js';
|
|
4
4
|
// Add 'import' action if both create and update exist
|
|
5
5
|
const HAS_IMPORT = true;
|
|
6
6
|
const HAS_EXPORT = true;
|
|
7
7
|
const HAS_CAMT053 = false;
|
|
8
|
-
const NESTED_IMPORTS = ["notes", "closings"];
|
|
9
|
-
const SUBCOMMANDS = [...["list", "create", "get", "update", "delete", "list-notes", "create-notes", "get-notes", "update-notes", "delete-notes", "list-closings", "create-closings", "get-closings", "update-closings", "closings-close", "closings-reopen", "list-posting-runs", "create-posting-runs", "posting-runs"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
8
|
+
const NESTED_IMPORTS = ["month-end-closings", "month-end-closings-accruals", "month-end-closings-notes", "notes", "closings"];
|
|
9
|
+
const SUBCOMMANDS = [...["list", "create", "get", "update", "delete", "list-month-end-closings", "create-month-end-closings", "get-month-end-closings", "update-month-end-closings", "delete-month-end-closings", "month-end-closings-complete", "create-month-end-closings-provisional-booking", "delete-month-end-closings-provisional-booking", "month-end-closings-reopen", "list-month-end-closings-accruals", "create-month-end-closings-accruals", "update-month-end-closings-accruals", "delete-month-end-closings-accruals", "month-end-closings-accruals-accept", "month-end-closings-accruals-dismiss", "list-month-end-closings-accrual-accounts", "list-month-end-closings-findings", "update-month-end-closings-findings", "list-month-end-closings-notes", "create-month-end-closings-notes", "get-month-end-closings-notes", "update-month-end-closings-notes", "delete-month-end-closings-notes", "update-month-end-closings-agent-results", "month-end-closings-agent-run", "get-fx-rate", "replace-fx-rate-providers", "replace-closing-fx-rate-providers", "list-notes", "create-notes", "get-notes", "update-notes", "delete-notes", "list-closings", "create-closings", "get-closings", "update-closings", "closings-close", "closings-reopen", "list-posting-runs", "create-posting-runs", "posting-runs"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
10
10
|
const ENDPOINTS = {
|
|
11
|
-
'list': { method: 'GET', path: '/v1/ledgers', summary: 'List all ledgers', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
12
|
-
'create': { method: 'POST', path: '/v1/ledgers', summary: 'Create a new ledger', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['notes'] },
|
|
13
|
-
'get': { method: 'GET', path: '/v1/ledgers/{id}', summary: 'Get a ledger by ID', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
14
|
-
'update': { method: 'PATCH', path: '/v1/ledgers/{id}', summary: 'Update a ledger', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
15
|
-
'delete': { method: 'DELETE', path: '/v1/ledgers/{id}', summary: 'Delete a ledger', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
16
|
-
'list-
|
|
17
|
-
'create-
|
|
18
|
-
'get-
|
|
19
|
-
'update-
|
|
20
|
-
'delete-
|
|
21
|
-
'
|
|
22
|
-
'create-closings': { method: 'POST', path: '/v1/ledgers/{ledgerId}/closings', summary: '
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'closings-
|
|
26
|
-
'closings-
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
11
|
+
'list': { method: 'GET', path: '/v1/ledgers', summary: 'List all ledgers', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
12
|
+
'create': { method: 'POST', path: '/v1/ledgers', summary: 'Create a new ledger', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: ['notes', 'fxRateProviders', 'closingFxRateProviders'] },
|
|
13
|
+
'get': { method: 'GET', path: '/v1/ledgers/{id}', summary: 'Get a ledger by ID', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
14
|
+
'update': { method: 'PATCH', path: '/v1/ledgers/{id}', summary: 'Update a ledger', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: ['fxRateProviders', 'closingFxRateProviders'] },
|
|
15
|
+
'delete': { method: 'DELETE', path: '/v1/ledgers/{id}', summary: 'Delete a ledger', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
16
|
+
'list-month-end-closings': { method: 'GET', path: '/v1/ledgers/{ledgerId}/month-end-closings', summary: 'List the month-end closings of a ledger, newest month first', pathParams: ['ledgerId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
17
|
+
'create-month-end-closings': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings', summary: 'Create a DRAFT month-end closing for one calendar month', pathParams: ['ledgerId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
18
|
+
'get-month-end-closings': { method: 'GET', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}', summary: 'Get one month-end closing', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
19
|
+
'update-month-end-closings': { method: 'PATCH', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}', summary: 'Change the description, postApprovedJournals, accrueOpenTransactions or the open-transaction accounts of a closing', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
20
|
+
'delete-month-end-closings': { method: 'DELETE', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}', summary: 'Delete a DRAFT closing with its accrual rows, findings, notes and its provisional journal; no other journal is touched', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
21
|
+
'month-end-closings-complete': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/complete', summary: 'Complete a DRAFT or REOPENED closing: delete its provisional journal, then book the accrual journal (posted) — with the open transactions\' line pairs when accrueOpenTransactions is on — one reversal journal per reversal date (APPROVED) and the FX revaluation journal (posted) in this ledger, and store the bank and FX rows as they are now; the ledger\'s lockedDate is not changed', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
22
|
+
'create-month-end-closings-provisional-booking': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/provisional-booking', summary: 'Book (or book again) the provisional journal of a DRAFT or REOPENED closing: deletes the existing one, then books one APPROVED journal dated the month end with the lines Complete would book there now (accepted accruals, open-transaction pairs, FX revaluation); no reversal, nothing posted, no row marked BOOKED, and none when there is no line. The closing\'s figures ignore it; Complete deletes it first', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
23
|
+
'delete-month-end-closings-provisional-booking': { method: 'DELETE', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/provisional-booking', summary: 'Delete the provisional journal of a DRAFT or REOPENED closing, if it has one', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
24
|
+
'month-end-closings-reopen': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/reopen', summary: 'Reopen a COMPLETED closing: its rows are computed live again and journals keeps naming the last completion\'s journals; no journal and not the ledger\'s lockedDate is changed', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
25
|
+
'list-month-end-closings-accruals': { method: 'GET', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/accruals', summary: 'List the accrual rows of a closing by account code, then title', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
26
|
+
'create-month-end-closings-accruals': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/accruals', summary: 'Add a manual accrual row; it starts ACCEPTED', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
27
|
+
'update-month-end-closings-accruals': { method: 'PATCH', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/accruals/{accrualId}', summary: 'Change a PROPOSED or ACCEPTED accrual row', pathParams: ['ledgerId', 'id', 'accrualId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
28
|
+
'delete-month-end-closings-accruals': { method: 'DELETE', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/accruals/{accrualId}', summary: 'Delete a PROPOSED, ACCEPTED or DISMISSED accrual row', pathParams: ['ledgerId', 'id', 'accrualId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
29
|
+
'month-end-closings-accruals-accept': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/accruals/{accrualId}/accept', summary: 'Accept a PROPOSED accrual row', pathParams: ['ledgerId', 'id', 'accrualId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
30
|
+
'month-end-closings-accruals-dismiss': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/accruals/{accrualId}/dismiss', summary: 'Dismiss a PROPOSED accrual row; the agent does not propose it again', pathParams: ['ledgerId', 'id', 'accrualId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
31
|
+
'list-month-end-closings-accrual-accounts': { method: 'GET', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/accrual-accounts', summary: 'One entry per accrual account of the ledger: the period\'s movement against the average of the three months before, what is accrued, the difference and the month-end instructions; with include=partners also the movement per business partner', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
32
|
+
'list-month-end-closings-findings': { method: 'GET', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/findings', summary: 'List the agent\'s findings on a closing: HIGH, MEDIUM, LOW, then by creation time', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
33
|
+
'update-month-end-closings-findings': { method: 'PATCH', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/findings/{findingId}', summary: 'Set a finding to OPEN, NOTED or NOT_RELEVANT', pathParams: ['ledgerId', 'id', 'findingId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
34
|
+
'list-month-end-closings-notes': { method: 'GET', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/notes', summary: 'List the notes of a month-end closing', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
35
|
+
'create-month-end-closings-notes': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/notes', summary: 'Create a note on a month-end closing', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
36
|
+
'get-month-end-closings-notes': { method: 'GET', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/notes/{noteId}', summary: 'Get one note of a month-end closing', pathParams: ['ledgerId', 'id', 'noteId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
37
|
+
'update-month-end-closings-notes': { method: 'PATCH', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/notes/{noteId}', summary: 'Update a note of a month-end closing', pathParams: ['ledgerId', 'id', 'noteId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
38
|
+
'delete-month-end-closings-notes': { method: 'DELETE', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/notes/{noteId}', summary: 'Delete a note of a month-end closing', pathParams: ['ledgerId', 'id', 'noteId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
39
|
+
'update-month-end-closings-agent-results': { method: 'PUT', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/agent-results', summary: 'Write back a month-end agent run\'s explanations and accrual proposals', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: ['accounts', 'accruals'] },
|
|
40
|
+
'month-end-closings-agent-run': { method: 'POST', path: '/v1/ledgers/{ledgerId}/month-end-closings/{id}/agent-run', summary: 'Compute the month\'s findings and start a month-end agent run', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
41
|
+
'get-fx-rate': { method: 'GET', path: '/v1/ledgers/{id}/fx-rate', summary: 'Resolve the FX rate this ledger would book for a currency on a day, or with purpose=CLOSING the rate its month-end close values a balance at', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
42
|
+
'replace-fx-rate-providers': { method: 'PUT', path: '/v1/ledgers/{id}/fx-rate-providers', summary: 'Replace the list of FX rate providers this ledger asks, leaving the rest of the ledger untouched', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: ['fxRateProviders'] },
|
|
43
|
+
'replace-closing-fx-rate-providers': { method: 'PUT', path: '/v1/ledgers/{id}/closing-fx-rate-providers', summary: 'Replace the list of FX rate providers the month-end close asks, leaving the rest of the ledger untouched', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: ['closingFxRateProviders'] },
|
|
44
|
+
'list-notes': { method: 'GET', path: '/v1/ledgers/{ledgerId}/notes', summary: 'Get all notes for a ledger', pathParams: ['ledgerId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
45
|
+
'create-notes': { method: 'POST', path: '/v1/ledgers/{ledgerId}/notes', summary: 'Create a note for a ledger', pathParams: ['ledgerId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
46
|
+
'get-notes': { method: 'GET', path: '/v1/ledgers/{ledgerId}/notes/{noteId}', summary: 'Get a specific note for a ledger', pathParams: ['ledgerId', 'noteId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
47
|
+
'update-notes': { method: 'PATCH', path: '/v1/ledgers/{ledgerId}/notes/{noteId}', summary: 'Update a note for a ledger', pathParams: ['ledgerId', 'noteId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
48
|
+
'delete-notes': { method: 'DELETE', path: '/v1/ledgers/{ledgerId}/notes/{noteId}', summary: 'Delete a note from a ledger', pathParams: ['ledgerId', 'noteId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
49
|
+
'list-closings': { method: 'GET', path: '/v1/ledgers/{ledgerId}/closings', summary: 'List all closings for a ledger, sorted by period end ascending', pathParams: ['ledgerId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
50
|
+
'create-closings': { method: 'POST', path: '/v1/ledgers/{ledgerId}/closings', summary: 'Create a new closing in DRAFT status', pathParams: ['ledgerId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
51
|
+
'get-closings': { method: 'GET', path: '/v1/ledgers/{ledgerId}/closings/{id}', summary: 'Get a single closing by ID', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
52
|
+
'update-closings': { method: 'PATCH', path: '/v1/ledgers/{ledgerId}/closings/{id}', summary: 'Update closing description', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
53
|
+
'closings-close': { method: 'POST', path: '/v1/ledgers/{ledgerId}/closings/{id}/close', summary: 'Transition closing to CLOSED. Computes netPnl from POSTED journals. Valid from DRAFT or REOPENED.', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
54
|
+
'closings-reopen': { method: 'POST', path: '/v1/ledgers/{ledgerId}/closings/{id}/reopen', summary: 'Transition closing to REOPENED. netPnl snapshot is preserved. Valid from CLOSED only, and only for the latest CLOSED closing of the ledger.', pathParams: ['ledgerId', 'id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
55
|
+
'list-posting-runs': { method: 'GET', path: '/v1/ledgers/{ledgerId}/posting-runs', summary: 'List posting runs for a ledger', pathParams: ['ledgerId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
56
|
+
'create-posting-runs': { method: 'POST', path: '/v1/ledgers/{ledgerId}/posting-runs', summary: 'Post every APPROVED journal in a date range', pathParams: ['ledgerId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
57
|
+
'posting-runs': { method: 'GET', path: '/v1/ledgers/{ledgerId}/posting-runs/{id}', summary: 'Get a posting run by ID', pathParams: ['ledgerId', 'id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
30
58
|
};
|
|
31
59
|
export default class Ledgers extends Command {
|
|
32
60
|
static description = 'Manage ledgers';
|
|
@@ -50,8 +78,10 @@ export default class Ledgers extends Command {
|
|
|
50
78
|
data: Flags.string({ char: 'd', description: 'JSON data for request body' }),
|
|
51
79
|
file: Flags.string({ char: 'f', description: 'Read request body from file' }),
|
|
52
80
|
set: Flags.string({ char: 's', description: 'Set individual field (e.g. --set firstName=John)', multiple: true }),
|
|
53
|
-
'note-id': Flags.string({ description: 'Path param: noteId' }),
|
|
54
81
|
'id': Flags.string({ description: 'Path param: id' }),
|
|
82
|
+
'accrual-id': Flags.string({ description: 'Path param: accrualId' }),
|
|
83
|
+
'finding-id': Flags.string({ description: 'Path param: findingId' }),
|
|
84
|
+
'note-id': Flags.string({ description: 'Path param: noteId' }),
|
|
55
85
|
page: Flags.string({ description: 'Page number' }),
|
|
56
86
|
limit: Flags.string({ description: 'Items per page' }),
|
|
57
87
|
include: Flags.string({ description: 'Relations to include' }),
|
|
@@ -280,10 +310,11 @@ export default class Ledgers extends Command {
|
|
|
280
310
|
process.stderr.write('\n');
|
|
281
311
|
}
|
|
282
312
|
try {
|
|
283
|
-
// Binary response:
|
|
313
|
+
// Binary response: to -f / --file, or to stdout when it is redirected.
|
|
284
314
|
if (endpoint.isBinaryResponse) {
|
|
285
|
-
|
|
286
|
-
|
|
315
|
+
const toStdout = !flags.file;
|
|
316
|
+
if (toStdout && process.stdout.isTTY) {
|
|
317
|
+
this.error(`Endpoint returns a binary file. Specify the output path with -f / --file (e.g. -f report.xlsx), or redirect stdout to a file.`);
|
|
287
318
|
}
|
|
288
319
|
const binResponse = await apiRequest(endpoint.method, apiPath, {
|
|
289
320
|
params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
@@ -291,24 +322,55 @@ export default class Ledgers extends Command {
|
|
|
291
322
|
contextName: flags.context,
|
|
292
323
|
binary: true,
|
|
293
324
|
});
|
|
294
|
-
const fsModule = await import('node:fs');
|
|
295
325
|
const binData = binResponse.data;
|
|
296
326
|
const buffer = Buffer.isBuffer(binData)
|
|
297
327
|
? binData
|
|
298
328
|
: Buffer.from(binData);
|
|
329
|
+
if (toStdout) {
|
|
330
|
+
// Nothing else may reach stdout here — it is the file.
|
|
331
|
+
process.stdout.write(buffer);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const fsModule = await import('node:fs');
|
|
299
335
|
fsModule.writeFileSync(flags.file, buffer);
|
|
300
336
|
this.log(`Saved ${buffer.length} bytes to ${flags.file}`);
|
|
301
337
|
return;
|
|
302
338
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
339
|
+
let response;
|
|
340
|
+
if (endpoint.hasBinaryVariant) {
|
|
341
|
+
// This route answers JSON or a file depending on the request body, so the
|
|
342
|
+
// bytes are read first and the response's own content-type decides. Asking
|
|
343
|
+
// for text here would corrupt an xlsx/pdf before anything could inspect it.
|
|
344
|
+
const raw = await apiRequest(endpoint.method, apiPath, {
|
|
345
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
346
|
+
data,
|
|
347
|
+
contextName: flags.context,
|
|
348
|
+
binary: true,
|
|
349
|
+
});
|
|
350
|
+
const rawType = String(raw.headers['content-type'] || '').toLowerCase();
|
|
351
|
+
const rawData = raw.data;
|
|
352
|
+
const buffer = Buffer.isBuffer(rawData) ? rawData : Buffer.from(rawData);
|
|
353
|
+
if (!isTextualMediaType(rawType)) {
|
|
354
|
+
if (process.stdout.isTTY) {
|
|
355
|
+
this.error(`The API returned ${rawType || 'binary data'}. Redirect stdout to a file, e.g. ... > report.xlsx`);
|
|
356
|
+
}
|
|
357
|
+
// Nothing else may reach stdout here — it is the file.
|
|
358
|
+
process.stdout.write(buffer);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
response = { data: buffer.toString('utf8'), headers: raw.headers, status: raw.status };
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
response = await apiRequest(endpoint.method, apiPath, {
|
|
365
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
366
|
+
data,
|
|
367
|
+
contextName: flags.context,
|
|
368
|
+
acceptAny: true,
|
|
369
|
+
});
|
|
370
|
+
}
|
|
309
371
|
// Check content-type for non-JSON responses (XML, text, etc.)
|
|
310
372
|
const contentType = (response.headers['content-type'] || '').toLowerCase();
|
|
311
|
-
if (contentType
|
|
373
|
+
if (isTextualMediaType(contentType) && !contentType.startsWith('application/json')) {
|
|
312
374
|
// Output raw content for XML/text responses (CSV, plain, HTML, etc.)
|
|
313
375
|
this.log(String(response.data));
|
|
314
376
|
return;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class MyAccount extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: never[];
|
|
5
|
+
static args: {
|
|
6
|
+
action: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
context: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
table: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
set: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
page: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
limit: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
include: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'sort-by': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
filter: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
};
|
|
28
|
+
run(): Promise<void>;
|
|
29
|
+
private runImport;
|
|
30
|
+
private runExport;
|
|
31
|
+
private runCamt053Import;
|
|
32
|
+
private runNestedImport;
|
|
33
|
+
private parseFilterValue;
|
|
34
|
+
private sanitizeOutput;
|
|
35
|
+
private getColumns;
|
|
36
|
+
private getValue;
|
|
37
|
+
private printTable;
|
|
38
|
+
private printCsv;
|
|
39
|
+
}
|