@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 = false;
6
6
  const HAS_EXPORT = true;
@@ -30,7 +30,7 @@ export default class DunningReminders extends Command {
30
30
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
31
31
  };
32
32
  static flags = {
33
- context: Flags.string({ char: 'c', description: 'Context to use' }),
33
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
34
34
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
35
35
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
36
36
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -41,7 +41,7 @@ export default class DunningReminders extends Command {
41
41
  limit: Flags.string({ description: 'Items per page' }),
42
42
  include: Flags.string({ description: 'Relations to include' }),
43
43
  search: Flags.string({ description: 'Search term' }),
44
- 'sort-by': Flags.string({ description: 'Sort field' }),
44
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
45
45
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
46
46
  query: Flags.string({ description: 'Additional query params as JSON' }),
47
47
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -102,9 +102,9 @@ export default class DunningReminders extends Command {
102
102
  }
103
103
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
104
104
  if (!context)
105
- this.error('No context configured. Run: aderis auth login --new');
106
- if (!context.tokens)
107
- this.error('Not logged in. Run: aderis auth login');
105
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
106
+ if (!hasCredentials(context))
107
+ this.error(missingCredentialsMessage(context));
108
108
  const queryParams = {};
109
109
  if (flags.page)
110
110
  queryParams.page = flags.page;
@@ -115,7 +115,7 @@ export default class DunningReminders extends Command {
115
115
  if (flags.search)
116
116
  queryParams.search = flags.search;
117
117
  if (flags['sort-by'])
118
- queryParams.sortBy = flags['sort-by'];
118
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
119
119
  if (flags.query) {
120
120
  try {
121
121
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -347,9 +347,9 @@ export default class DunningReminders extends Command {
347
347
  async runImport(flags) {
348
348
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
349
349
  if (!context)
350
- this.error('No context configured. Run: aderis auth login --new');
351
- if (!context.tokens)
352
- this.error('Not logged in. Run: aderis auth login');
350
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
351
+ if (!hasCredentials(context))
352
+ this.error(missingCredentialsMessage(context));
353
353
  // Get data from file, --data, or --set flags
354
354
  let items = [];
355
355
  if (flags.file) {
@@ -559,9 +559,9 @@ export default class DunningReminders extends Command {
559
559
  async runExport(flags) {
560
560
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
561
561
  if (!context)
562
- this.error('No context configured. Run: aderis auth login --new');
563
- if (!context.tokens)
564
- this.error('Not logged in. Run: aderis auth login');
562
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
563
+ if (!hasCredentials(context))
564
+ this.error(missingCredentialsMessage(context));
565
565
  const listEndpoint = ENDPOINTS['list'];
566
566
  if (!listEndpoint)
567
567
  this.error('Export requires a list endpoint');
@@ -574,7 +574,7 @@ export default class DunningReminders extends Command {
574
574
  if (flags.search)
575
575
  baseParams.search = flags.search;
576
576
  if (flags['sort-by'])
577
- baseParams.sortBy = flags['sort-by'];
577
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
578
578
  if (flags.include)
579
579
  baseParams.include = flags.include;
580
580
  if (flags.query) {
@@ -653,9 +653,9 @@ export default class DunningReminders extends Command {
653
653
  async runCamt053Import(flags) {
654
654
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
655
655
  if (!context)
656
- this.error('No context configured. Run: aderis auth login --new');
657
- if (!context.tokens)
658
- this.error('Not logged in. Run: aderis auth login');
656
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
657
+ if (!hasCredentials(context))
658
+ this.error(missingCredentialsMessage(context));
659
659
  if (!flags.file) {
660
660
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
661
661
  }
@@ -743,9 +743,9 @@ export default class DunningReminders extends Command {
743
743
  }
744
744
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
745
745
  if (!context)
746
- this.error('No context configured. Run: aderis auth login --new');
747
- if (!context.tokens)
748
- this.error('Not logged in. Run: aderis auth login');
746
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
747
+ if (!hasCredentials(context))
748
+ this.error(missingCredentialsMessage(context));
749
749
  // Get data from file, --data, or --set flags
750
750
  let items = [];
751
751
  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 = false;
6
6
  const HAS_EXPORT = false;
@@ -18,7 +18,7 @@ export default class DunningRuns extends Command {
18
18
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
19
19
  };
20
20
  static flags = {
21
- context: Flags.string({ char: 'c', description: 'Context to use' }),
21
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
22
22
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
23
23
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
24
24
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -29,7 +29,7 @@ export default class DunningRuns extends Command {
29
29
  limit: Flags.string({ description: 'Items per page' }),
30
30
  include: Flags.string({ description: 'Relations to include' }),
31
31
  search: Flags.string({ description: 'Search term' }),
32
- 'sort-by': Flags.string({ description: 'Sort field' }),
32
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
33
33
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
34
34
  query: Flags.string({ description: 'Additional query params as JSON' }),
35
35
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -90,9 +90,9 @@ export default class DunningRuns extends Command {
90
90
  }
91
91
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
92
92
  if (!context)
93
- this.error('No context configured. Run: aderis auth login --new');
94
- if (!context.tokens)
95
- this.error('Not logged in. Run: aderis auth login');
93
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
94
+ if (!hasCredentials(context))
95
+ this.error(missingCredentialsMessage(context));
96
96
  const queryParams = {};
97
97
  if (flags.page)
98
98
  queryParams.page = flags.page;
@@ -103,7 +103,7 @@ export default class DunningRuns extends Command {
103
103
  if (flags.search)
104
104
  queryParams.search = flags.search;
105
105
  if (flags['sort-by'])
106
- queryParams.sortBy = flags['sort-by'];
106
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
107
107
  if (flags.query) {
108
108
  try {
109
109
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -335,9 +335,9 @@ export default class DunningRuns extends Command {
335
335
  async runImport(flags) {
336
336
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
337
337
  if (!context)
338
- this.error('No context configured. Run: aderis auth login --new');
339
- if (!context.tokens)
340
- this.error('Not logged in. Run: aderis auth login');
338
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
339
+ if (!hasCredentials(context))
340
+ this.error(missingCredentialsMessage(context));
341
341
  // Get data from file, --data, or --set flags
342
342
  let items = [];
343
343
  if (flags.file) {
@@ -547,9 +547,9 @@ export default class DunningRuns extends Command {
547
547
  async runExport(flags) {
548
548
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
549
549
  if (!context)
550
- this.error('No context configured. Run: aderis auth login --new');
551
- if (!context.tokens)
552
- this.error('Not logged in. Run: aderis auth login');
550
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
551
+ if (!hasCredentials(context))
552
+ this.error(missingCredentialsMessage(context));
553
553
  const listEndpoint = ENDPOINTS['list'];
554
554
  if (!listEndpoint)
555
555
  this.error('Export requires a list endpoint');
@@ -562,7 +562,7 @@ export default class DunningRuns extends Command {
562
562
  if (flags.search)
563
563
  baseParams.search = flags.search;
564
564
  if (flags['sort-by'])
565
- baseParams.sortBy = flags['sort-by'];
565
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
566
566
  if (flags.include)
567
567
  baseParams.include = flags.include;
568
568
  if (flags.query) {
@@ -641,9 +641,9 @@ export default class DunningRuns extends Command {
641
641
  async runCamt053Import(flags) {
642
642
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
643
643
  if (!context)
644
- this.error('No context configured. Run: aderis auth login --new');
645
- if (!context.tokens)
646
- this.error('Not logged in. Run: aderis auth login');
644
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
645
+ if (!hasCredentials(context))
646
+ this.error(missingCredentialsMessage(context));
647
647
  if (!flags.file) {
648
648
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
649
649
  }
@@ -731,9 +731,9 @@ export default class DunningRuns extends Command {
731
731
  }
732
732
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
733
733
  if (!context)
734
- this.error('No context configured. Run: aderis auth login --new');
735
- if (!context.tokens)
736
- this.error('Not logged in. Run: aderis auth login');
734
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
735
+ if (!hasCredentials(context))
736
+ this.error(missingCredentialsMessage(context));
737
737
  // Get data from file, --data, or --set flags
738
738
  let items = [];
739
739
  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 = false;
6
6
  const HAS_EXPORT = true;
@@ -24,7 +24,7 @@ export default class EmailTransactions extends Command {
24
24
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
25
25
  };
26
26
  static flags = {
27
- context: Flags.string({ char: 'c', description: 'Context to use' }),
27
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
28
28
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
29
29
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
30
30
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -35,7 +35,7 @@ export default class EmailTransactions extends Command {
35
35
  limit: Flags.string({ description: 'Items per page' }),
36
36
  include: Flags.string({ description: 'Relations to include' }),
37
37
  search: Flags.string({ description: 'Search term' }),
38
- 'sort-by': Flags.string({ description: 'Sort field' }),
38
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
39
39
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
40
40
  query: Flags.string({ description: 'Additional query params as JSON' }),
41
41
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -96,9 +96,9 @@ export default class EmailTransactions extends Command {
96
96
  }
97
97
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
98
98
  if (!context)
99
- this.error('No context configured. Run: aderis auth login --new');
100
- if (!context.tokens)
101
- this.error('Not logged in. Run: aderis auth login');
99
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
100
+ if (!hasCredentials(context))
101
+ this.error(missingCredentialsMessage(context));
102
102
  const queryParams = {};
103
103
  if (flags.page)
104
104
  queryParams.page = flags.page;
@@ -109,7 +109,7 @@ export default class EmailTransactions extends Command {
109
109
  if (flags.search)
110
110
  queryParams.search = flags.search;
111
111
  if (flags['sort-by'])
112
- queryParams.sortBy = flags['sort-by'];
112
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
113
113
  if (flags.query) {
114
114
  try {
115
115
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -341,9 +341,9 @@ export default class EmailTransactions extends Command {
341
341
  async runImport(flags) {
342
342
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
343
343
  if (!context)
344
- this.error('No context configured. Run: aderis auth login --new');
345
- if (!context.tokens)
346
- this.error('Not logged in. Run: aderis auth login');
344
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
345
+ if (!hasCredentials(context))
346
+ this.error(missingCredentialsMessage(context));
347
347
  // Get data from file, --data, or --set flags
348
348
  let items = [];
349
349
  if (flags.file) {
@@ -553,9 +553,9 @@ export default class EmailTransactions extends Command {
553
553
  async runExport(flags) {
554
554
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
555
555
  if (!context)
556
- this.error('No context configured. Run: aderis auth login --new');
557
- if (!context.tokens)
558
- this.error('Not logged in. Run: aderis auth login');
556
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
557
+ if (!hasCredentials(context))
558
+ this.error(missingCredentialsMessage(context));
559
559
  const listEndpoint = ENDPOINTS['list'];
560
560
  if (!listEndpoint)
561
561
  this.error('Export requires a list endpoint');
@@ -568,7 +568,7 @@ export default class EmailTransactions extends Command {
568
568
  if (flags.search)
569
569
  baseParams.search = flags.search;
570
570
  if (flags['sort-by'])
571
- baseParams.sortBy = flags['sort-by'];
571
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
572
572
  if (flags.include)
573
573
  baseParams.include = flags.include;
574
574
  if (flags.query) {
@@ -647,9 +647,9 @@ export default class EmailTransactions extends Command {
647
647
  async runCamt053Import(flags) {
648
648
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
649
649
  if (!context)
650
- this.error('No context configured. Run: aderis auth login --new');
651
- if (!context.tokens)
652
- this.error('Not logged in. Run: aderis auth login');
650
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
651
+ if (!hasCredentials(context))
652
+ this.error(missingCredentialsMessage(context));
653
653
  if (!flags.file) {
654
654
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
655
655
  }
@@ -737,9 +737,9 @@ export default class EmailTransactions extends Command {
737
737
  }
738
738
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
739
739
  if (!context)
740
- this.error('No context configured. Run: aderis auth login --new');
741
- if (!context.tokens)
742
- this.error('Not logged in. Run: aderis auth login');
740
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
741
+ if (!hasCredentials(context))
742
+ this.error(missingCredentialsMessage(context));
743
743
  // Get data from file, --data, or --set flags
744
744
  let items = [];
745
745
  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;
@@ -9,9 +9,9 @@ const NESTED_IMPORTS = ["salaries", "payments", "notes", "files", "salary-paymen
9
9
  const SUBCOMMANDS = [...["list", "create", "get", "update", "delete", "get-salaries", "create-salaries", "get-salaries-salaryId", "update-salaries", "delete-salaries", "get-payments", "create-payments", "get-payments-paymentId", "update-payments", "delete-payments", "list-notes", "create-notes", "get-notes", "update-notes", "delete-notes", "list-files", "create-files", "get-files", "update-files", "delete-files", "files-download", "list-salary-payment-files", "create-salary-payment-files", "get-salary-payment-files", "update-salary-payment-files", "delete-salary-payment-files", "download-salary-payment-files"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
10
10
  const ENDPOINTS = {
11
11
  'list': { method: 'GET', path: '/v1/employees', summary: 'Get all employees with pagination', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
12
- 'create': { method: 'POST', path: '/v1/employees', summary: 'Create a new employee', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['beneficiaries', 'children', 'salaries', 'files', 'notes'] },
12
+ 'create': { method: 'POST', path: '/v1/employees', summary: 'Create a new employee', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['beneficiaries', 'children', 'salaries', 'files', 'notes', 'tagIds', 'tagCodes'] },
13
13
  'get': { method: 'GET', path: '/v1/employees/{id}', summary: 'Get an employee by ID', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
14
- 'update': { method: 'PATCH', path: '/v1/employees/{id}', summary: 'Update an employee', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['beneficiaries', 'children', 'salaries', 'files', 'notes'] },
14
+ 'update': { method: 'PATCH', path: '/v1/employees/{id}', summary: 'Update an employee', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['beneficiaries', 'children', 'salaries', 'files', 'notes', 'tagIds', 'tagCodes'] },
15
15
  'delete': { method: 'DELETE', path: '/v1/employees/{id}', summary: 'Delete an employee', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
16
16
  'get-salaries': { method: 'GET', path: '/v1/employees/{id}/salaries', summary: 'Get all salaries for an employee', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
17
17
  'create-salaries': { method: 'POST', path: '/v1/employees/{id}/salaries', summary: 'Add a salary configuration to an employee', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
@@ -56,7 +56,7 @@ export default class Employees extends Command {
56
56
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
57
57
  };
58
58
  static flags = {
59
- context: Flags.string({ char: 'c', description: 'Context to use' }),
59
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
60
60
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
61
61
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
62
62
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -71,7 +71,7 @@ export default class Employees extends Command {
71
71
  limit: Flags.string({ description: 'Items per page' }),
72
72
  include: Flags.string({ description: 'Relations to include' }),
73
73
  search: Flags.string({ description: 'Search term' }),
74
- 'sort-by': Flags.string({ description: 'Sort field' }),
74
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
75
75
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
76
76
  query: Flags.string({ description: 'Additional query params as JSON' }),
77
77
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -132,9 +132,9 @@ export default class Employees extends Command {
132
132
  }
133
133
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
134
134
  if (!context)
135
- this.error('No context configured. Run: aderis auth login --new');
136
- if (!context.tokens)
137
- this.error('Not logged in. Run: aderis auth login');
135
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
136
+ if (!hasCredentials(context))
137
+ this.error(missingCredentialsMessage(context));
138
138
  const queryParams = {};
139
139
  if (flags.page)
140
140
  queryParams.page = flags.page;
@@ -145,7 +145,7 @@ export default class Employees extends Command {
145
145
  if (flags.search)
146
146
  queryParams.search = flags.search;
147
147
  if (flags['sort-by'])
148
- queryParams.sortBy = flags['sort-by'];
148
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
149
149
  if (flags.query) {
150
150
  try {
151
151
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -377,9 +377,9 @@ export default class Employees extends Command {
377
377
  async runImport(flags) {
378
378
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
379
379
  if (!context)
380
- this.error('No context configured. Run: aderis auth login --new');
381
- if (!context.tokens)
382
- this.error('Not logged in. Run: aderis auth login');
380
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
381
+ if (!hasCredentials(context))
382
+ this.error(missingCredentialsMessage(context));
383
383
  // Get data from file, --data, or --set flags
384
384
  let items = [];
385
385
  if (flags.file) {
@@ -589,9 +589,9 @@ export default class Employees extends Command {
589
589
  async runExport(flags) {
590
590
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
591
591
  if (!context)
592
- this.error('No context configured. Run: aderis auth login --new');
593
- if (!context.tokens)
594
- this.error('Not logged in. Run: aderis auth login');
592
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
593
+ if (!hasCredentials(context))
594
+ this.error(missingCredentialsMessage(context));
595
595
  const listEndpoint = ENDPOINTS['list'];
596
596
  if (!listEndpoint)
597
597
  this.error('Export requires a list endpoint');
@@ -604,7 +604,7 @@ export default class Employees extends Command {
604
604
  if (flags.search)
605
605
  baseParams.search = flags.search;
606
606
  if (flags['sort-by'])
607
- baseParams.sortBy = flags['sort-by'];
607
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
608
608
  if (flags.include)
609
609
  baseParams.include = flags.include;
610
610
  if (flags.query) {
@@ -683,9 +683,9 @@ export default class Employees extends Command {
683
683
  async runCamt053Import(flags) {
684
684
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
685
685
  if (!context)
686
- this.error('No context configured. Run: aderis auth login --new');
687
- if (!context.tokens)
688
- this.error('Not logged in. Run: aderis auth login');
686
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
687
+ if (!hasCredentials(context))
688
+ this.error(missingCredentialsMessage(context));
689
689
  if (!flags.file) {
690
690
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
691
691
  }
@@ -773,9 +773,9 @@ export default class Employees extends Command {
773
773
  }
774
774
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
775
775
  if (!context)
776
- this.error('No context configured. Run: aderis auth login --new');
777
- if (!context.tokens)
778
- this.error('Not logged in. Run: aderis auth login');
776
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
777
+ if (!hasCredentials(context))
778
+ this.error(missingCredentialsMessage(context));
779
779
  // Get data from file, --data, or --set flags
780
780
  let items = [];
781
781
  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 = false;
6
6
  const HAS_EXPORT = false;
@@ -20,7 +20,7 @@ export default class EntityConfigurations extends Command {
20
20
  id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
21
21
  };
22
22
  static flags = {
23
- context: Flags.string({ char: 'c', description: 'Context to use' }),
23
+ context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
24
24
  output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
25
25
  table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
26
26
  csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
@@ -31,7 +31,7 @@ export default class EntityConfigurations extends Command {
31
31
  limit: Flags.string({ description: 'Items per page' }),
32
32
  include: Flags.string({ description: 'Relations to include' }),
33
33
  search: Flags.string({ description: 'Search term' }),
34
- 'sort-by': Flags.string({ description: 'Sort field' }),
34
+ 'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
35
35
  filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
36
36
  query: Flags.string({ description: 'Additional query params as JSON' }),
37
37
  fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
@@ -92,9 +92,9 @@ export default class EntityConfigurations extends Command {
92
92
  }
93
93
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
94
94
  if (!context)
95
- this.error('No context configured. Run: aderis auth login --new');
96
- if (!context.tokens)
97
- this.error('Not logged in. Run: aderis auth login');
95
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
96
+ if (!hasCredentials(context))
97
+ this.error(missingCredentialsMessage(context));
98
98
  const queryParams = {};
99
99
  if (flags.page)
100
100
  queryParams.page = flags.page;
@@ -105,7 +105,7 @@ export default class EntityConfigurations extends Command {
105
105
  if (flags.search)
106
106
  queryParams.search = flags.search;
107
107
  if (flags['sort-by'])
108
- queryParams.sortBy = flags['sort-by'];
108
+ queryParams.sortBy = normalizeSortBy(flags['sort-by']);
109
109
  if (flags.query) {
110
110
  try {
111
111
  Object.assign(queryParams, JSON.parse(flags.query));
@@ -337,9 +337,9 @@ export default class EntityConfigurations extends Command {
337
337
  async runImport(flags) {
338
338
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
339
339
  if (!context)
340
- this.error('No context configured. Run: aderis auth login --new');
341
- if (!context.tokens)
342
- this.error('Not logged in. Run: aderis auth login');
340
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
341
+ if (!hasCredentials(context))
342
+ this.error(missingCredentialsMessage(context));
343
343
  // Get data from file, --data, or --set flags
344
344
  let items = [];
345
345
  if (flags.file) {
@@ -549,9 +549,9 @@ export default class EntityConfigurations extends Command {
549
549
  async runExport(flags) {
550
550
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
551
551
  if (!context)
552
- this.error('No context configured. Run: aderis auth login --new');
553
- if (!context.tokens)
554
- this.error('Not logged in. Run: aderis auth login');
552
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
553
+ if (!hasCredentials(context))
554
+ this.error(missingCredentialsMessage(context));
555
555
  const listEndpoint = ENDPOINTS['list'];
556
556
  if (!listEndpoint)
557
557
  this.error('Export requires a list endpoint');
@@ -564,7 +564,7 @@ export default class EntityConfigurations extends Command {
564
564
  if (flags.search)
565
565
  baseParams.search = flags.search;
566
566
  if (flags['sort-by'])
567
- baseParams.sortBy = flags['sort-by'];
567
+ baseParams.sortBy = normalizeSortBy(flags['sort-by']);
568
568
  if (flags.include)
569
569
  baseParams.include = flags.include;
570
570
  if (flags.query) {
@@ -643,9 +643,9 @@ export default class EntityConfigurations extends Command {
643
643
  async runCamt053Import(flags) {
644
644
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
645
645
  if (!context)
646
- this.error('No context configured. Run: aderis auth login --new');
647
- if (!context.tokens)
648
- this.error('Not logged in. Run: aderis auth login');
646
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
647
+ if (!hasCredentials(context))
648
+ this.error(missingCredentialsMessage(context));
649
649
  if (!flags.file) {
650
650
  this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
651
651
  }
@@ -733,9 +733,9 @@ export default class EntityConfigurations extends Command {
733
733
  }
734
734
  const context = flags.context ? getContext(flags.context) : getCurrentContext();
735
735
  if (!context)
736
- this.error('No context configured. Run: aderis auth login --new');
737
- if (!context.tokens)
738
- this.error('Not logged in. Run: aderis auth login');
736
+ this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
737
+ if (!hasCredentials(context))
738
+ this.error(missingCredentialsMessage(context));
739
739
  // Get data from file, --data, or --set flags
740
740
  let items = [];
741
741
  if (flags.file) {