@aderis-erp/cli 1.0.13 → 1.0.15

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 (86) hide show
  1. package/dist/commands/access-groups.js +21 -21
  2. package/dist/commands/account-transaction-allocations.js +21 -21
  3. package/dist/commands/account-transactions.js +23 -23
  4. package/dist/commands/accounts.js +23 -23
  5. package/dist/commands/agent-platform.js +23 -22
  6. package/dist/commands/analytics.d.ts +40 -0
  7. package/dist/commands/{documents.js → analytics.js} +33 -43
  8. package/dist/commands/audit-log.js +24 -24
  9. package/dist/commands/auth/login.js +11 -2
  10. package/dist/commands/auth/logout.d.ts +2 -0
  11. package/dist/commands/auth/logout.js +19 -6
  12. package/dist/commands/auth/status.js +26 -12
  13. package/dist/commands/auth/tenant.js +12 -3
  14. package/dist/commands/auth.js +32 -17
  15. package/dist/commands/bank-accounts.js +21 -21
  16. package/dist/commands/bank-integrations.js +21 -21
  17. package/dist/commands/business-partners.js +29 -26
  18. package/dist/commands/chat.js +21 -21
  19. package/dist/commands/config/add.d.ts +9 -0
  20. package/dist/commands/config/add.js +64 -2
  21. package/dist/commands/config/current.js +9 -4
  22. package/dist/commands/config/list.js +9 -4
  23. package/dist/commands/config/set-api-key.d.ts +10 -0
  24. package/dist/commands/config/set-api-key.js +49 -0
  25. package/dist/commands/config/use.js +3 -4
  26. package/dist/commands/credit-card-accounts.js +21 -21
  27. package/dist/commands/delivery-notes.js +28 -25
  28. package/dist/commands/dunning-configs.js +21 -21
  29. package/dist/commands/dunning-reminders.js +21 -21
  30. package/dist/commands/dunning-runs.js +21 -21
  31. package/dist/commands/email-transactions.js +21 -21
  32. package/dist/commands/employees.js +23 -23
  33. package/dist/commands/entity-configurations.js +21 -21
  34. package/dist/commands/event-processor-mappings.js +21 -21
  35. package/dist/commands/{documents.d.ts → files.d.ts} +1 -1
  36. package/dist/commands/{files-internal.js → files.js} +39 -33
  37. package/dist/commands/health.js +21 -21
  38. package/dist/commands/inbox.d.ts +1 -0
  39. package/dist/commands/inbox.js +25 -23
  40. package/dist/commands/integrations.js +21 -21
  41. package/dist/commands/item-categories.js +21 -21
  42. package/dist/commands/items.js +23 -23
  43. package/dist/commands/journal-lines.js +21 -21
  44. package/dist/commands/journals.js +27 -24
  45. package/dist/commands/ledgers.js +25 -22
  46. package/dist/commands/office-locations.js +21 -21
  47. package/dist/commands/payment-methods.js +21 -21
  48. package/dist/commands/payment-runs.js +23 -22
  49. package/dist/commands/payment-terms.js +21 -21
  50. package/dist/commands/payments.js +21 -21
  51. package/dist/commands/price-lists.js +21 -21
  52. package/dist/commands/processor-mappings.js +21 -21
  53. package/dist/commands/processors.js +21 -21
  54. package/dist/commands/purchase-order-types.js +21 -21
  55. package/dist/commands/purchase-orders.d.ts +1 -0
  56. package/dist/commands/purchase-orders.js +32 -25
  57. package/dist/commands/reports.js +21 -21
  58. package/dist/commands/salary-types.js +21 -21
  59. package/dist/commands/sales-invoices.js +33 -31
  60. package/dist/commands/sales-orders.js +23 -23
  61. package/dist/commands/saved-views.js +21 -21
  62. package/dist/commands/scheduled-processor-mappings.d.ts +40 -0
  63. package/dist/commands/scheduled-processor-mappings.js +1178 -0
  64. package/dist/commands/schedules.js +21 -21
  65. package/dist/commands/switch.js +10 -3
  66. package/dist/commands/{files-internal.d.ts → tag-configurations.d.ts} +1 -1
  67. package/dist/commands/tag-configurations.js +1178 -0
  68. package/dist/commands/tags.js +21 -21
  69. package/dist/commands/tax-codes.js +21 -21
  70. package/dist/commands/tax-matrix.js +21 -21
  71. package/dist/commands/tenants.js +23 -23
  72. package/dist/commands/text-templates.js +21 -21
  73. package/dist/commands/tools.js +21 -21
  74. package/dist/commands/vat-declarations.js +21 -21
  75. package/dist/commands/vendor-invoices.js +25 -25
  76. package/dist/commands/webhooks.js +21 -21
  77. package/dist/commands/workflows.js +21 -21
  78. package/dist/lib/api-client.d.ts +8 -0
  79. package/dist/lib/api-client.js +31 -6
  80. package/dist/lib/auth.d.ts +8 -0
  81. package/dist/lib/auth.js +51 -7
  82. package/dist/lib/base-api-command.js +6 -4
  83. package/dist/lib/config.d.ts +31 -1
  84. package/dist/lib/config.js +31 -0
  85. package/oclif.manifest.json +1099 -443
  86. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { Command, Args, Flags } from '@oclif/core';
2
- import { apiRequest, ApiError } from '../lib/api-client.js';
3
- import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.js';
2
+ import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
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;
@@ -31,7 +31,7 @@ export default class Payments extends Command {
31
31
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
32
32
  };
33
33
  static flags = {
34
- context: Flags.string({ char: 'c', description: 'Context to use' }),
34
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
35
35
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
36
36
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
37
37
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -42,7 +42,7 @@ export default class Payments extends Command {
42
42
  limit: Flags.string({ description: 'Items per page' }),
43
43
  include: Flags.string({ description: 'Relations to include' }),
44
44
  search: Flags.string({ description: 'Search term' }),
45
- 'sort-by': Flags.string({ description: 'Sort field' }),
45
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
46
46
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
47
47
  query: Flags.string({ description: 'Additional query params as JSON' }),
48
48
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -103,9 +103,9 @@ export default class Payments extends Command {
103
103
  }
104
104
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
105
105
  if (!context)
106
- this.error('No context configured. Run: aderis auth login --new');
107
- if (!context.tokens)
108
- this.error('Not logged in. Run: aderis auth login');
106
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
107
+ if (!hasCredentials(context))
108
+ this.error(missingCredentialsMessage(context));
109
109
  const queryParams = {};
110
110
  if (flags.page)
111
111
  queryParams.page = flags.page;
@@ -116,7 +116,7 @@ export default class Payments extends Command {
116
116
  if (flags.search)
117
117
  queryParams.search = flags.search;
118
118
  if (flags['sort-by'])
119
- queryParams.sortBy = flags['sort-by'];
119
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
120
120
  if (flags.query) {
121
121
  try {
122
122
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -348,9 +348,9 @@ export default class Payments extends Command {
348
348
  async runImport(flags) {
349
349
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
350
350
  if (!context)
351
- this.error('No context configured. Run: aderis auth login --new');
352
- if (!context.tokens)
353
- this.error('Not logged in. Run: aderis auth login');
351
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
352
+ if (!hasCredentials(context))
353
+ this.error(missingCredentialsMessage(context));
354
354
  // Get data from file, --data, or --set flags
355
355
  let items = [];
356
356
  if (flags.file) {
@@ -560,9 +560,9 @@ export default class Payments extends Command {
560
560
  async runExport(flags) {
561
561
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
562
562
  if (!context)
563
- this.error('No context configured. Run: aderis auth login --new');
564
- if (!context.tokens)
565
- this.error('Not logged in. Run: aderis auth login');
563
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
564
+ if (!hasCredentials(context))
565
+ this.error(missingCredentialsMessage(context));
566
566
  const listEndpoint = ENDPOINTS['list'];
567
567
  if (!listEndpoint)
568
568
  this.error('Export requires a list endpoint');
@@ -575,7 +575,7 @@ export default class Payments extends Command {
575
575
  if (flags.search)
576
576
  baseParams.search = flags.search;
577
577
  if (flags['sort-by'])
578
- baseParams.sortBy = flags['sort-by'];
578
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
579
579
  if (flags.include)
580
580
  baseParams.include = flags.include;
581
581
  if (flags.query) {
@@ -654,9 +654,9 @@ export default class Payments extends Command {
654
654
  async runCamt053Import(flags) {
655
655
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
656
656
  if (!context)
657
- this.error('No context configured. Run: aderis auth login --new');
658
- if (!context.tokens)
659
- this.error('Not logged in. Run: aderis auth login');
657
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
658
+ if (!hasCredentials(context))
659
+ this.error(missingCredentialsMessage(context));
660
660
  if (!flags.file) {
661
661
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
662
662
  }
@@ -744,9 +744,9 @@ export default class Payments extends Command {
744
744
  }
745
745
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
746
746
  if (!context)
747
- this.error('No context configured. Run: aderis auth login --new');
748
- if (!context.tokens)
749
- this.error('Not logged in. Run: aderis auth login');
747
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
748
+ if (!hasCredentials(context))
749
+ this.error(missingCredentialsMessage(context));
750
750
  // Get data from file, --data, or --set flags
751
751
  let items = [];
752
752
  if (flags.file) {
@@ -1,6 +1,6 @@
1
1
  import { Command, Args, Flags } from '@oclif/core';
2
- import { apiRequest, ApiError } from '../lib/api-client.js';
3
- import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.js';
2
+ import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
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;
@@ -34,7 +34,7 @@ export default class PriceLists extends Command {
34
34
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
35
35
  };
36
36
  static flags = {
37
- context: Flags.string({ char: 'c', description: 'Context to use' }),
37
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
38
38
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
39
39
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
40
40
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -46,7 +46,7 @@ export default class PriceLists extends Command {
46
46
  limit: Flags.string({ description: 'Items per page' }),
47
47
  include: Flags.string({ description: 'Relations to include' }),
48
48
  search: Flags.string({ description: 'Search term' }),
49
- 'sort-by': Flags.string({ description: 'Sort field' }),
49
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
50
50
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
51
51
  query: Flags.string({ description: 'Additional query params as JSON' }),
52
52
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -107,9 +107,9 @@ export default class PriceLists extends Command {
107
107
  }
108
108
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
109
109
  if (!context)
110
- this.error('No context configured. Run: aderis auth login --new');
111
- if (!context.tokens)
112
- this.error('Not logged in. Run: aderis auth login');
110
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
111
+ if (!hasCredentials(context))
112
+ this.error(missingCredentialsMessage(context));
113
113
  const queryParams = {};
114
114
  if (flags.page)
115
115
  queryParams.page = flags.page;
@@ -120,7 +120,7 @@ export default class PriceLists extends Command {
120
120
  if (flags.search)
121
121
  queryParams.search = flags.search;
122
122
  if (flags['sort-by'])
123
- queryParams.sortBy = flags['sort-by'];
123
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
124
124
  if (flags.query) {
125
125
  try {
126
126
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -352,9 +352,9 @@ export default class PriceLists extends Command {
352
352
  async runImport(flags) {
353
353
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
354
354
  if (!context)
355
- this.error('No context configured. Run: aderis auth login --new');
356
- if (!context.tokens)
357
- this.error('Not logged in. Run: aderis auth login');
355
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
356
+ if (!hasCredentials(context))
357
+ this.error(missingCredentialsMessage(context));
358
358
  // Get data from file, --data, or --set flags
359
359
  let items = [];
360
360
  if (flags.file) {
@@ -564,9 +564,9 @@ export default class PriceLists extends Command {
564
564
  async runExport(flags) {
565
565
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
566
566
  if (!context)
567
- this.error('No context configured. Run: aderis auth login --new');
568
- if (!context.tokens)
569
- this.error('Not logged in. Run: aderis auth login');
567
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
568
+ if (!hasCredentials(context))
569
+ this.error(missingCredentialsMessage(context));
570
570
  const listEndpoint = ENDPOINTS['list'];
571
571
  if (!listEndpoint)
572
572
  this.error('Export requires a list endpoint');
@@ -579,7 +579,7 @@ export default class PriceLists extends Command {
579
579
  if (flags.search)
580
580
  baseParams.search = flags.search;
581
581
  if (flags['sort-by'])
582
- baseParams.sortBy = flags['sort-by'];
582
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
583
583
  if (flags.include)
584
584
  baseParams.include = flags.include;
585
585
  if (flags.query) {
@@ -658,9 +658,9 @@ export default class PriceLists extends Command {
658
658
  async runCamt053Import(flags) {
659
659
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
660
660
  if (!context)
661
- this.error('No context configured. Run: aderis auth login --new');
662
- if (!context.tokens)
663
- this.error('Not logged in. Run: aderis auth login');
661
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
662
+ if (!hasCredentials(context))
663
+ this.error(missingCredentialsMessage(context));
664
664
  if (!flags.file) {
665
665
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
666
666
  }
@@ -748,9 +748,9 @@ export default class PriceLists extends Command {
748
748
  }
749
749
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
750
750
  if (!context)
751
- this.error('No context configured. Run: aderis auth login --new');
752
- if (!context.tokens)
753
- this.error('Not logged in. Run: aderis auth login');
751
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
752
+ if (!hasCredentials(context))
753
+ this.error(missingCredentialsMessage(context));
754
754
  // Get data from file, --data, or --set flags
755
755
  let items = [];
756
756
  if (flags.file) {
@@ -1,6 +1,6 @@
1
1
  import { Command, Args, Flags } from '@oclif/core';
2
- import { apiRequest, ApiError } from '../lib/api-client.js';
3
- import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.js';
2
+ import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
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;
@@ -27,7 +27,7 @@ export default class ProcessorMappings extends Command {
27
27
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
28
28
  };
29
29
  static flags = {
30
- context: Flags.string({ char: 'c', description: 'Context to use' }),
30
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
31
31
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
32
32
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
33
33
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -38,7 +38,7 @@ export default class ProcessorMappings extends Command {
38
38
  limit: Flags.string({ description: 'Items per page' }),
39
39
  include: Flags.string({ description: 'Relations to include' }),
40
40
  search: Flags.string({ description: 'Search term' }),
41
- 'sort-by': Flags.string({ description: 'Sort field' }),
41
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
42
42
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
43
43
  query: Flags.string({ description: 'Additional query params as JSON' }),
44
44
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -99,9 +99,9 @@ export default class ProcessorMappings extends Command {
99
99
  }
100
100
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
101
101
  if (!context)
102
- this.error('No context configured. Run: aderis auth login --new');
103
- if (!context.tokens)
104
- this.error('Not logged in. Run: aderis auth login');
102
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
103
+ if (!hasCredentials(context))
104
+ this.error(missingCredentialsMessage(context));
105
105
  const queryParams = {};
106
106
  if (flags.page)
107
107
  queryParams.page = flags.page;
@@ -112,7 +112,7 @@ export default class ProcessorMappings extends Command {
112
112
  if (flags.search)
113
113
  queryParams.search = flags.search;
114
114
  if (flags['sort-by'])
115
- queryParams.sortBy = flags['sort-by'];
115
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
116
116
  if (flags.query) {
117
117
  try {
118
118
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -344,9 +344,9 @@ export default class ProcessorMappings extends Command {
344
344
  async runImport(flags) {
345
345
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
346
346
  if (!context)
347
- this.error('No context configured. Run: aderis auth login --new');
348
- if (!context.tokens)
349
- this.error('Not logged in. Run: aderis auth login');
347
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
348
+ if (!hasCredentials(context))
349
+ this.error(missingCredentialsMessage(context));
350
350
  // Get data from file, --data, or --set flags
351
351
  let items = [];
352
352
  if (flags.file) {
@@ -556,9 +556,9 @@ export default class ProcessorMappings extends Command {
556
556
  async runExport(flags) {
557
557
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
558
558
  if (!context)
559
- this.error('No context configured. Run: aderis auth login --new');
560
- if (!context.tokens)
561
- this.error('Not logged in. Run: aderis auth login');
559
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
560
+ if (!hasCredentials(context))
561
+ this.error(missingCredentialsMessage(context));
562
562
  const listEndpoint = ENDPOINTS['list'];
563
563
  if (!listEndpoint)
564
564
  this.error('Export requires a list endpoint');
@@ -571,7 +571,7 @@ export default class ProcessorMappings extends Command {
571
571
  if (flags.search)
572
572
  baseParams.search = flags.search;
573
573
  if (flags['sort-by'])
574
- baseParams.sortBy = flags['sort-by'];
574
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
575
575
  if (flags.include)
576
576
  baseParams.include = flags.include;
577
577
  if (flags.query) {
@@ -650,9 +650,9 @@ export default class ProcessorMappings extends Command {
650
650
  async runCamt053Import(flags) {
651
651
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
652
652
  if (!context)
653
- this.error('No context configured. Run: aderis auth login --new');
654
- if (!context.tokens)
655
- this.error('Not logged in. Run: aderis auth login');
653
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
654
+ if (!hasCredentials(context))
655
+ this.error(missingCredentialsMessage(context));
656
656
  if (!flags.file) {
657
657
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
658
658
  }
@@ -740,9 +740,9 @@ export default class ProcessorMappings extends Command {
740
740
  }
741
741
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
742
742
  if (!context)
743
- this.error('No context configured. Run: aderis auth login --new');
744
- if (!context.tokens)
745
- this.error('Not logged in. Run: aderis auth login');
743
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
744
+ if (!hasCredentials(context))
745
+ this.error(missingCredentialsMessage(context));
746
746
  // Get data from file, --data, or --set flags
747
747
  let items = [];
748
748
  if (flags.file) {
@@ -1,6 +1,6 @@
1
1
  import { Command, Args, Flags } from '@oclif/core';
2
- import { apiRequest, ApiError } from '../lib/api-client.js';
3
- import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.js';
2
+ import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
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;
@@ -35,7 +35,7 @@ export default class Processors extends Command {
35
35
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
36
36
  };
37
37
  static flags = {
38
- context: Flags.string({ char: 'c', description: 'Context to use' }),
38
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
39
39
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
40
40
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
41
41
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -46,7 +46,7 @@ export default class Processors extends Command {
46
46
  limit: Flags.string({ description: 'Items per page' }),
47
47
  include: Flags.string({ description: 'Relations to include' }),
48
48
  search: Flags.string({ description: 'Search term' }),
49
- 'sort-by': Flags.string({ description: 'Sort field' }),
49
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
50
50
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
51
51
  query: Flags.string({ description: 'Additional query params as JSON' }),
52
52
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -107,9 +107,9 @@ export default class Processors extends Command {
107
107
  }
108
108
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
109
109
  if (!context)
110
- this.error('No context configured. Run: aderis auth login --new');
111
- if (!context.tokens)
112
- this.error('Not logged in. Run: aderis auth login');
110
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
111
+ if (!hasCredentials(context))
112
+ this.error(missingCredentialsMessage(context));
113
113
  const queryParams = {};
114
114
  if (flags.page)
115
115
  queryParams.page = flags.page;
@@ -120,7 +120,7 @@ export default class Processors extends Command {
120
120
  if (flags.search)
121
121
  queryParams.search = flags.search;
122
122
  if (flags['sort-by'])
123
- queryParams.sortBy = flags['sort-by'];
123
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
124
124
  if (flags.query) {
125
125
  try {
126
126
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -352,9 +352,9 @@ export default class Processors extends Command {
352
352
  async runImport(flags) {
353
353
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
354
354
  if (!context)
355
- this.error('No context configured. Run: aderis auth login --new');
356
- if (!context.tokens)
357
- this.error('Not logged in. Run: aderis auth login');
355
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
356
+ if (!hasCredentials(context))
357
+ this.error(missingCredentialsMessage(context));
358
358
  // Get data from file, --data, or --set flags
359
359
  let items = [];
360
360
  if (flags.file) {
@@ -564,9 +564,9 @@ export default class Processors extends Command {
564
564
  async runExport(flags) {
565
565
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
566
566
  if (!context)
567
- this.error('No context configured. Run: aderis auth login --new');
568
- if (!context.tokens)
569
- this.error('Not logged in. Run: aderis auth login');
567
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
568
+ if (!hasCredentials(context))
569
+ this.error(missingCredentialsMessage(context));
570
570
  const listEndpoint = ENDPOINTS['list'];
571
571
  if (!listEndpoint)
572
572
  this.error('Export requires a list endpoint');
@@ -579,7 +579,7 @@ export default class Processors extends Command {
579
579
  if (flags.search)
580
580
  baseParams.search = flags.search;
581
581
  if (flags['sort-by'])
582
- baseParams.sortBy = flags['sort-by'];
582
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
583
583
  if (flags.include)
584
584
  baseParams.include = flags.include;
585
585
  if (flags.query) {
@@ -658,9 +658,9 @@ export default class Processors extends Command {
658
658
  async runCamt053Import(flags) {
659
659
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
660
660
  if (!context)
661
- this.error('No context configured. Run: aderis auth login --new');
662
- if (!context.tokens)
663
- this.error('Not logged in. Run: aderis auth login');
661
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
662
+ if (!hasCredentials(context))
663
+ this.error(missingCredentialsMessage(context));
664
664
  if (!flags.file) {
665
665
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
666
666
  }
@@ -748,9 +748,9 @@ export default class Processors extends Command {
748
748
  }
749
749
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
750
750
  if (!context)
751
- this.error('No context configured. Run: aderis auth login --new');
752
- if (!context.tokens)
753
- this.error('Not logged in. Run: aderis auth login');
751
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
752
+ if (!hasCredentials(context))
753
+ this.error(missingCredentialsMessage(context));
754
754
  // Get data from file, --data, or --set flags
755
755
  let items = [];
756
756
  if (flags.file) {
@@ -1,6 +1,6 @@
1
1
  import { Command, Args, Flags } from '@oclif/core';
2
- import { apiRequest, ApiError } from '../lib/api-client.js';
3
- import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.js';
2
+ import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
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;
@@ -29,7 +29,7 @@ export default class PurchaseOrderTypes extends Command {
29
29
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
30
30
  };
31
31
  static flags = {
32
- context: Flags.string({ char: 'c', description: 'Context to use' }),
32
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
33
33
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
34
34
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
35
35
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -40,7 +40,7 @@ export default class PurchaseOrderTypes extends Command {
40
40
  limit: Flags.string({ description: 'Items per page' }),
41
41
  include: Flags.string({ description: 'Relations to include' }),
42
42
  search: Flags.string({ description: 'Search term' }),
43
- 'sort-by': Flags.string({ description: 'Sort field' }),
43
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
44
44
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
45
45
  query: Flags.string({ description: 'Additional query params as JSON' }),
46
46
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -101,9 +101,9 @@ export default class PurchaseOrderTypes extends Command {
101
101
  }
102
102
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
103
103
  if (!context)
104
- this.error('No context configured. Run: aderis auth login --new');
105
- if (!context.tokens)
106
- this.error('Not logged in. Run: aderis auth login');
104
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
105
+ if (!hasCredentials(context))
106
+ this.error(missingCredentialsMessage(context));
107
107
  const queryParams = {};
108
108
  if (flags.page)
109
109
  queryParams.page = flags.page;
@@ -114,7 +114,7 @@ export default class PurchaseOrderTypes extends Command {
114
114
  if (flags.search)
115
115
  queryParams.search = flags.search;
116
116
  if (flags['sort-by'])
117
- queryParams.sortBy = flags['sort-by'];
117
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
118
118
  if (flags.query) {
119
119
  try {
120
120
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -346,9 +346,9 @@ export default class PurchaseOrderTypes extends Command {
346
346
  async runImport(flags) {
347
347
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
348
348
  if (!context)
349
- this.error('No context configured. Run: aderis auth login --new');
350
- if (!context.tokens)
351
- this.error('Not logged in. Run: aderis auth login');
349
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
350
+ if (!hasCredentials(context))
351
+ this.error(missingCredentialsMessage(context));
352
352
  // Get data from file, --data, or --set flags
353
353
  let items = [];
354
354
  if (flags.file) {
@@ -558,9 +558,9 @@ export default class PurchaseOrderTypes extends Command {
558
558
  async runExport(flags) {
559
559
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
560
560
  if (!context)
561
- this.error('No context configured. Run: aderis auth login --new');
562
- if (!context.tokens)
563
- this.error('Not logged in. Run: aderis auth login');
561
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
562
+ if (!hasCredentials(context))
563
+ this.error(missingCredentialsMessage(context));
564
564
  const listEndpoint = ENDPOINTS['list'];
565
565
  if (!listEndpoint)
566
566
  this.error('Export requires a list endpoint');
@@ -573,7 +573,7 @@ export default class PurchaseOrderTypes extends Command {
573
573
  if (flags.search)
574
574
  baseParams.search = flags.search;
575
575
  if (flags['sort-by'])
576
- baseParams.sortBy = flags['sort-by'];
576
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
577
577
  if (flags.include)
578
578
  baseParams.include = flags.include;
579
579
  if (flags.query) {
@@ -652,9 +652,9 @@ export default class PurchaseOrderTypes extends Command {
652
652
  async runCamt053Import(flags) {
653
653
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
654
654
  if (!context)
655
- this.error('No context configured. Run: aderis auth login --new');
656
- if (!context.tokens)
657
- this.error('Not logged in. Run: aderis auth login');
655
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
656
+ if (!hasCredentials(context))
657
+ this.error(missingCredentialsMessage(context));
658
658
  if (!flags.file) {
659
659
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
660
660
  }
@@ -742,9 +742,9 @@ export default class PurchaseOrderTypes extends Command {
742
742
  }
743
743
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
744
744
  if (!context)
745
- this.error('No context configured. Run: aderis auth login --new');
746
- if (!context.tokens)
747
- this.error('Not logged in. Run: aderis auth login');
745
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
746
+ if (!hasCredentials(context))
747
+ this.error(missingCredentialsMessage(context));
748
748
  // Get data from file, --data, or --set flags
749
749
  let items = [];
750
750
  if (flags.file) {
@@ -16,6 +16,7 @@ export default class PurchaseOrders extends Command {
16
16
  set: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
17
  'line-item-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
18
  'note-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'file-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
20
  page: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
21
  limit: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
22
  include: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;