@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.
Files changed (105) hide show
  1. package/dist/commands/access-groups.js +49 -17
  2. package/dist/commands/account-transaction-allocations.js +46 -14
  3. package/dist/commands/account-transactions.js +75 -35
  4. package/dist/commands/accounts.js +54 -22
  5. package/dist/commands/agent-platform.js +53 -21
  6. package/dist/commands/{nango-integrations.d.ts → agent-runs.d.ts} +1 -1
  7. package/dist/commands/agent-runs.js +1155 -0
  8. package/dist/commands/analytics.js +47 -15
  9. package/dist/commands/api-keys.js +49 -16
  10. package/dist/commands/{text-templates.d.ts → async-jobs.d.ts} +1 -1
  11. package/dist/commands/async-jobs.js +1158 -0
  12. package/dist/commands/audit-log.js +46 -14
  13. package/dist/commands/bank-accounts.js +63 -30
  14. package/dist/commands/bank-integrations.d.ts +1 -0
  15. package/dist/commands/bank-integrations.js +66 -31
  16. package/dist/commands/business-partners.js +77 -44
  17. package/dist/commands/chat.js +52 -19
  18. package/dist/commands/credit-card-accounts.d.ts +1 -0
  19. package/dist/commands/credit-card-accounts.js +67 -29
  20. package/dist/commands/delivery-notes.js +78 -44
  21. package/dist/commands/dunning-configs.js +49 -17
  22. package/dist/commands/dunning-reminders.js +52 -20
  23. package/dist/commands/dunning-runs.js +45 -13
  24. package/dist/commands/email-transactions.js +47 -15
  25. package/dist/commands/employees.js +76 -44
  26. package/dist/commands/entity-configurations.js +47 -15
  27. package/dist/commands/event-processor-mappings.js +49 -17
  28. package/dist/commands/files.js +56 -24
  29. package/dist/commands/health.js +49 -17
  30. package/dist/commands/{tag-configurations.d.ts → imports.d.ts} +1 -1
  31. package/dist/commands/{tag-configurations.js → imports.js} +59 -31
  32. package/dist/commands/inbox.js +52 -19
  33. package/dist/commands/integration-identities.d.ts +40 -0
  34. package/dist/commands/integration-identities.js +1151 -0
  35. package/dist/commands/integrations.js +47 -15
  36. package/dist/commands/item-categories.js +49 -17
  37. package/dist/commands/items.js +49 -17
  38. package/dist/commands/journal-lines.js +45 -13
  39. package/dist/commands/journals.js +68 -36
  40. package/dist/commands/ledgers.d.ts +3 -1
  41. package/dist/commands/ledgers.js +96 -34
  42. package/dist/commands/my-account.d.ts +39 -0
  43. package/dist/commands/my-account.js +1160 -0
  44. package/dist/commands/office-locations.js +49 -17
  45. package/dist/commands/payment-methods.js +54 -22
  46. package/dist/commands/payment-runs.js +61 -29
  47. package/dist/commands/payment-terms.js +50 -18
  48. package/dist/commands/payments.js +51 -19
  49. package/dist/commands/payroll-runs.d.ts +43 -0
  50. package/dist/commands/payroll-runs.js +1188 -0
  51. package/dist/commands/permissions.d.ts +39 -0
  52. package/dist/commands/{text-templates.js → permissions.js} +54 -30
  53. package/dist/commands/price-lists.js +54 -22
  54. package/dist/commands/processor-mappings.js +48 -16
  55. package/dist/commands/processors.js +55 -24
  56. package/dist/commands/purchase-order-types.js +49 -17
  57. package/dist/commands/purchase-orders.js +69 -36
  58. package/dist/commands/reports.js +49 -17
  59. package/dist/commands/roles.d.ts +39 -0
  60. package/dist/commands/{nango-integrations.js → roles.js} +63 -26
  61. package/dist/commands/salary-types.js +49 -17
  62. package/dist/commands/sales-invoices.js +84 -51
  63. package/dist/commands/sales-orders.js +78 -44
  64. package/dist/commands/saved-views.js +47 -15
  65. package/dist/commands/scheduled-processor-mappings.js +49 -17
  66. package/dist/commands/schedules.js +53 -21
  67. package/dist/commands/support/end.d.ts +9 -0
  68. package/dist/commands/support/end.js +29 -0
  69. package/dist/commands/support/start.d.ts +14 -0
  70. package/dist/commands/support/start.js +50 -0
  71. package/dist/commands/support/status.d.ts +10 -0
  72. package/dist/commands/support/status.js +45 -0
  73. package/dist/commands/support/tenants.d.ts +10 -0
  74. package/dist/commands/support/tenants.js +39 -0
  75. package/dist/commands/tags.js +51 -18
  76. package/dist/commands/tax-codes.js +52 -20
  77. package/dist/commands/tax-matrix.js +49 -17
  78. package/dist/commands/templates.d.ts +39 -0
  79. package/dist/commands/templates.js +1157 -0
  80. package/dist/commands/tenants.js +52 -20
  81. package/dist/commands/tools.js +46 -14
  82. package/dist/commands/users.d.ts +42 -0
  83. package/dist/commands/users.js +1174 -0
  84. package/dist/commands/vat-declarations.d.ts +2 -0
  85. package/dist/commands/vat-declarations.js +72 -36
  86. package/dist/commands/vendor-invoices.js +81 -49
  87. package/dist/commands/webhooks.js +51 -19
  88. package/dist/commands/workflows.js +47 -15
  89. package/dist/lib/api-client.d.ts +6 -0
  90. package/dist/lib/api-client.js +13 -0
  91. package/dist/lib/auth/constants.d.ts +12 -0
  92. package/dist/lib/auth/constants.js +12 -0
  93. package/dist/lib/auth/index.d.ts +11 -1
  94. package/dist/lib/auth/index.js +105 -6
  95. package/dist/lib/auth/jwks.d.ts +19 -0
  96. package/dist/lib/auth/jwks.js +112 -0
  97. package/dist/lib/auth/keycloak-provider.d.ts +45 -7
  98. package/dist/lib/auth/keycloak-provider.js +161 -27
  99. package/dist/lib/auth/tokens.d.ts +8 -3
  100. package/dist/lib/auth/tokens.js +8 -7
  101. package/dist/lib/auth/types.d.ts +5 -1
  102. package/dist/lib/config.d.ts +18 -0
  103. package/dist/lib/config.js +10 -0
  104. package/oclif.manifest.json +2182 -744
  105. package/package.json +7 -4
@@ -1,5 +1,5 @@
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 = false;
@@ -8,15 +8,15 @@ const HAS_CAMT053 = false;
8
8
  const NESTED_IMPORTS = [];
9
9
  const SUBCOMMANDS = [...["get-runs", "get-runs-runId", "runs-retry", "runs-restart", "runs-discard", "uploads", "uploads-counts", "uploads-files", "usage"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
10
10
  const ENDPOINTS = {
11
- 'get-runs': { method: 'GET', path: '/v1/agent-platform/runs', summary: 'List agent runs (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
12
- 'get-runs-runId': { method: 'GET', path: '/v1/agent-platform/runs/{runId}', summary: 'Fetch one agent run (agents-platform pass-through).', pathParams: ['runId'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
13
- 'runs-retry': { method: 'POST', path: '/v1/agent-platform/runs/{runId}/retry', summary: 'Retry a run awaiting review (agents-platform pass-through).', pathParams: ['runId'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
14
- 'runs-restart': { method: 'POST', path: '/v1/agent-platform/runs/{runId}/restart', summary: 'Restart a failed run (agents-platform pass-through).', pathParams: ['runId'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
15
- 'runs-discard': { method: 'POST', path: '/v1/agent-platform/runs/{runId}/discard', summary: 'Discard a run (agents-platform pass-through).', pathParams: ['runId'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
16
- 'uploads': { method: 'GET', path: '/v1/agent-platform/uploads', summary: 'List uploads (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
17
- 'uploads-counts': { method: 'GET', path: '/v1/agent-platform/uploads/counts', summary: 'Fetch upload counts (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
18
- 'uploads-files': { method: 'GET', path: '/v1/agent-platform/uploads/{processingId}/files/{fileId}', summary: 'Fetch one of an upload\'s files (agents-platform pass-through).', pathParams: ['processingId', 'fileId'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
19
- 'usage': { method: 'GET', path: '/v1/agent-platform/usage', summary: 'Fetch tenant LLM usage report (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
11
+ 'get-runs': { method: 'GET', path: '/v1/agent-platform/runs', summary: 'List agent runs (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
12
+ 'get-runs-runId': { method: 'GET', path: '/v1/agent-platform/runs/{runId}', summary: 'Fetch one agent run (agents-platform pass-through).', pathParams: ['runId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
13
+ 'runs-retry': { method: 'POST', path: '/v1/agent-platform/runs/{runId}/retry', summary: 'Retry a run awaiting review (agents-platform pass-through).', pathParams: ['runId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
14
+ 'runs-restart': { method: 'POST', path: '/v1/agent-platform/runs/{runId}/restart', summary: 'Restart a failed run (agents-platform pass-through).', pathParams: ['runId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
15
+ 'runs-discard': { method: 'POST', path: '/v1/agent-platform/runs/{runId}/discard', summary: 'Discard a run (agents-platform pass-through).', pathParams: ['runId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
16
+ 'uploads': { method: 'GET', path: '/v1/agent-platform/uploads', summary: 'List uploads (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
17
+ 'uploads-counts': { method: 'GET', path: '/v1/agent-platform/uploads/counts', summary: 'Fetch upload counts (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
18
+ 'uploads-files': { method: 'GET', path: '/v1/agent-platform/uploads/{processingId}/files/{fileId}', summary: 'Fetch one of an upload\'s files (agents-platform pass-through).', pathParams: ['processingId', 'fileId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
19
+ 'usage': { method: 'GET', path: '/v1/agent-platform/usage', summary: 'Fetch tenant LLM usage report (agents-platform pass-through).', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
20
20
  };
21
21
  export default class AgentPlatform extends Command {
22
22
  static description = 'Manage agent platform';
@@ -262,10 +262,11 @@ export default class AgentPlatform extends Command {
262
262
  process.stderr.write('\n');
263
263
  }
264
264
  try {
265
- // Binary response: download to file
265
+ // Binary response: to -f / --file, or to stdout when it is redirected.
266
266
  if (endpoint.isBinaryResponse) {
267
- if (!flags.file) {
268
- this.error(`Endpoint returns a binary file. Specify the output path with -f / --file (e.g. -f report.xlsx).`);
267
+ const toStdout = !flags.file;
268
+ if (toStdout && process.stdout.isTTY) {
269
+ 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.`);
269
270
  }
270
271
  const binResponse = await apiRequest(endpoint.method, apiPath, {
271
272
  params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
@@ -273,24 +274,55 @@ export default class AgentPlatform extends Command {
273
274
  contextName: flags.context,
274
275
  binary: true,
275
276
  });
276
- const fsModule = await import('node:fs');
277
277
  const binData = binResponse.data;
278
278
  const buffer = Buffer.isBuffer(binData)
279
279
  ? binData
280
280
  : Buffer.from(binData);
281
+ if (toStdout) {
282
+ // Nothing else may reach stdout here — it is the file.
283
+ process.stdout.write(buffer);
284
+ return;
285
+ }
286
+ const fsModule = await import('node:fs');
281
287
  fsModule.writeFileSync(flags.file, buffer);
282
288
  this.log(`Saved ${buffer.length} bytes to ${flags.file}`);
283
289
  return;
284
290
  }
285
- const response = await apiRequest(endpoint.method, apiPath, {
286
- params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
287
- data,
288
- contextName: flags.context,
289
- acceptAny: true,
290
- });
291
+ let response;
292
+ if (endpoint.hasBinaryVariant) {
293
+ // This route answers JSON or a file depending on the request body, so the
294
+ // bytes are read first and the response's own content-type decides. Asking
295
+ // for text here would corrupt an xlsx/pdf before anything could inspect it.
296
+ const raw = await apiRequest(endpoint.method, apiPath, {
297
+ params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
298
+ data,
299
+ contextName: flags.context,
300
+ binary: true,
301
+ });
302
+ const rawType = String(raw.headers['content-type'] || '').toLowerCase();
303
+ const rawData = raw.data;
304
+ const buffer = Buffer.isBuffer(rawData) ? rawData : Buffer.from(rawData);
305
+ if (!isTextualMediaType(rawType)) {
306
+ if (process.stdout.isTTY) {
307
+ this.error(`The API returned ${rawType || 'binary data'}. Redirect stdout to a file, e.g. ... > report.xlsx`);
308
+ }
309
+ // Nothing else may reach stdout here — it is the file.
310
+ process.stdout.write(buffer);
311
+ return;
312
+ }
313
+ response = { data: buffer.toString('utf8'), headers: raw.headers, status: raw.status };
314
+ }
315
+ else {
316
+ response = await apiRequest(endpoint.method, apiPath, {
317
+ params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
318
+ data,
319
+ contextName: flags.context,
320
+ acceptAny: true,
321
+ });
322
+ }
291
323
  // Check content-type for non-JSON responses (XML, text, etc.)
292
324
  const contentType = (response.headers['content-type'] || '').toLowerCase();
293
- if (contentType.includes('xml') || contentType.includes('text/')) {
325
+ if (isTextualMediaType(contentType) && !contentType.startsWith('application/json')) {
294
326
  // Output raw content for XML/text responses (CSV, plain, HTML, etc.)
295
327
  this.log(String(response.data));
296
328
  return;
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- export default class NangoIntegrations extends Command {
2
+ export default class AgentRuns extends Command {
3
3
  static description: string;
4
4
  static examples: never[];
5
5
  static args: {