@aderis-erp/cli 1.0.17 → 1.1.0
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/imports.d.ts +39 -0
- package/dist/commands/{nango-integrations.js → imports.js} +61 -25
- 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 +95 -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/roles.js +1152 -0
- 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/tag-configurations.js +50 -18
- package/dist/commands/tags.js +49 -17
- 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/index.js +15 -4
- 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 +23 -7
- package/dist/lib/auth/keycloak-provider.js +53 -24
- 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/oclif.manifest.json +2152 -715
- package/package.json +4 -4
package/dist/commands/ledgers.js
CHANGED
|
@@ -1,32 +1,59 @@
|
|
|
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", "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'] },
|
|
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'] },
|
|
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', 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
|
+
'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: [] },
|
|
44
|
+
'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: [] },
|
|
45
|
+
'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: [] },
|
|
46
|
+
'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: [] },
|
|
47
|
+
'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: [] },
|
|
48
|
+
'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: [] },
|
|
49
|
+
'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: [] },
|
|
50
|
+
'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: [] },
|
|
51
|
+
'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: [] },
|
|
52
|
+
'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: [] },
|
|
53
|
+
'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: [] },
|
|
54
|
+
'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: [] },
|
|
55
|
+
'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: [] },
|
|
56
|
+
'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
57
|
};
|
|
31
58
|
export default class Ledgers extends Command {
|
|
32
59
|
static description = 'Manage ledgers';
|
|
@@ -50,8 +77,10 @@ export default class Ledgers extends Command {
|
|
|
50
77
|
data: Flags.string({ char: 'd', description: 'JSON data for request body' }),
|
|
51
78
|
file: Flags.string({ char: 'f', description: 'Read request body from file' }),
|
|
52
79
|
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
80
|
'id': Flags.string({ description: 'Path param: id' }),
|
|
81
|
+
'accrual-id': Flags.string({ description: 'Path param: accrualId' }),
|
|
82
|
+
'finding-id': Flags.string({ description: 'Path param: findingId' }),
|
|
83
|
+
'note-id': Flags.string({ description: 'Path param: noteId' }),
|
|
55
84
|
page: Flags.string({ description: 'Page number' }),
|
|
56
85
|
limit: Flags.string({ description: 'Items per page' }),
|
|
57
86
|
include: Flags.string({ description: 'Relations to include' }),
|
|
@@ -280,10 +309,11 @@ export default class Ledgers extends Command {
|
|
|
280
309
|
process.stderr.write('\n');
|
|
281
310
|
}
|
|
282
311
|
try {
|
|
283
|
-
// Binary response:
|
|
312
|
+
// Binary response: to -f / --file, or to stdout when it is redirected.
|
|
284
313
|
if (endpoint.isBinaryResponse) {
|
|
285
|
-
|
|
286
|
-
|
|
314
|
+
const toStdout = !flags.file;
|
|
315
|
+
if (toStdout && process.stdout.isTTY) {
|
|
316
|
+
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
317
|
}
|
|
288
318
|
const binResponse = await apiRequest(endpoint.method, apiPath, {
|
|
289
319
|
params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
@@ -291,24 +321,55 @@ export default class Ledgers extends Command {
|
|
|
291
321
|
contextName: flags.context,
|
|
292
322
|
binary: true,
|
|
293
323
|
});
|
|
294
|
-
const fsModule = await import('node:fs');
|
|
295
324
|
const binData = binResponse.data;
|
|
296
325
|
const buffer = Buffer.isBuffer(binData)
|
|
297
326
|
? binData
|
|
298
327
|
: Buffer.from(binData);
|
|
328
|
+
if (toStdout) {
|
|
329
|
+
// Nothing else may reach stdout here — it is the file.
|
|
330
|
+
process.stdout.write(buffer);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const fsModule = await import('node:fs');
|
|
299
334
|
fsModule.writeFileSync(flags.file, buffer);
|
|
300
335
|
this.log(`Saved ${buffer.length} bytes to ${flags.file}`);
|
|
301
336
|
return;
|
|
302
337
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
338
|
+
let response;
|
|
339
|
+
if (endpoint.hasBinaryVariant) {
|
|
340
|
+
// This route answers JSON or a file depending on the request body, so the
|
|
341
|
+
// bytes are read first and the response's own content-type decides. Asking
|
|
342
|
+
// for text here would corrupt an xlsx/pdf before anything could inspect it.
|
|
343
|
+
const raw = await apiRequest(endpoint.method, apiPath, {
|
|
344
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
345
|
+
data,
|
|
346
|
+
contextName: flags.context,
|
|
347
|
+
binary: true,
|
|
348
|
+
});
|
|
349
|
+
const rawType = String(raw.headers['content-type'] || '').toLowerCase();
|
|
350
|
+
const rawData = raw.data;
|
|
351
|
+
const buffer = Buffer.isBuffer(rawData) ? rawData : Buffer.from(rawData);
|
|
352
|
+
if (!isTextualMediaType(rawType)) {
|
|
353
|
+
if (process.stdout.isTTY) {
|
|
354
|
+
this.error(`The API returned ${rawType || 'binary data'}. Redirect stdout to a file, e.g. ... > report.xlsx`);
|
|
355
|
+
}
|
|
356
|
+
// Nothing else may reach stdout here — it is the file.
|
|
357
|
+
process.stdout.write(buffer);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
response = { data: buffer.toString('utf8'), headers: raw.headers, status: raw.status };
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
response = await apiRequest(endpoint.method, apiPath, {
|
|
364
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
365
|
+
data,
|
|
366
|
+
contextName: flags.context,
|
|
367
|
+
acceptAny: true,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
309
370
|
// Check content-type for non-JSON responses (XML, text, etc.)
|
|
310
371
|
const contentType = (response.headers['content-type'] || '').toLowerCase();
|
|
311
|
-
if (contentType
|
|
372
|
+
if (isTextualMediaType(contentType) && !contentType.startsWith('application/json')) {
|
|
312
373
|
// Output raw content for XML/text responses (CSV, plain, HTML, etc.)
|
|
313
374
|
this.log(String(response.data));
|
|
314
375
|
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
|
+
}
|