@aderis-erp/cli 1.0.14 → 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.
- package/dist/commands/access-groups.js +17 -17
- package/dist/commands/account-transaction-allocations.js +17 -17
- package/dist/commands/account-transactions.js +19 -19
- package/dist/commands/accounts.js +19 -19
- package/dist/commands/agent-platform.js +19 -18
- package/dist/commands/analytics.d.ts +40 -0
- package/dist/commands/{documents.js → analytics.js} +29 -39
- package/dist/commands/audit-log.js +17 -17
- package/dist/commands/auth/login.js +11 -2
- package/dist/commands/auth/logout.d.ts +2 -0
- package/dist/commands/auth/logout.js +19 -6
- package/dist/commands/auth/status.js +26 -12
- package/dist/commands/auth/tenant.js +12 -3
- package/dist/commands/auth.js +32 -17
- package/dist/commands/bank-accounts.js +17 -17
- package/dist/commands/bank-integrations.js +17 -17
- package/dist/commands/business-partners.js +25 -22
- package/dist/commands/chat.js +17 -17
- package/dist/commands/config/add.d.ts +9 -0
- package/dist/commands/config/add.js +64 -2
- package/dist/commands/config/current.js +9 -4
- package/dist/commands/config/list.js +9 -4
- package/dist/commands/config/set-api-key.d.ts +10 -0
- package/dist/commands/config/set-api-key.js +49 -0
- package/dist/commands/config/use.js +3 -4
- package/dist/commands/credit-card-accounts.js +17 -17
- package/dist/commands/delivery-notes.js +22 -21
- package/dist/commands/dunning-configs.js +17 -17
- package/dist/commands/dunning-reminders.js +17 -17
- package/dist/commands/dunning-runs.js +17 -17
- package/dist/commands/email-transactions.js +17 -17
- package/dist/commands/employees.js +19 -19
- package/dist/commands/entity-configurations.js +17 -17
- package/dist/commands/event-processor-mappings.js +17 -17
- package/dist/commands/{documents.d.ts → files.d.ts} +1 -1
- package/dist/commands/{files-internal.js → files.js} +35 -29
- package/dist/commands/health.js +17 -17
- package/dist/commands/inbox.js +17 -17
- package/dist/commands/integrations.js +17 -17
- package/dist/commands/item-categories.js +17 -17
- package/dist/commands/items.js +19 -19
- package/dist/commands/journal-lines.js +17 -17
- package/dist/commands/journals.js +21 -20
- package/dist/commands/ledgers.js +21 -18
- package/dist/commands/office-locations.js +17 -17
- package/dist/commands/payment-methods.js +17 -17
- package/dist/commands/payment-runs.js +19 -18
- package/dist/commands/payment-terms.js +17 -17
- package/dist/commands/payments.js +17 -17
- package/dist/commands/price-lists.js +17 -17
- package/dist/commands/processor-mappings.js +17 -17
- package/dist/commands/processors.js +17 -17
- package/dist/commands/purchase-order-types.js +17 -17
- package/dist/commands/purchase-orders.d.ts +1 -0
- package/dist/commands/purchase-orders.js +28 -21
- package/dist/commands/reports.js +17 -17
- package/dist/commands/salary-types.js +17 -17
- package/dist/commands/sales-invoices.js +27 -25
- package/dist/commands/sales-orders.js +19 -19
- package/dist/commands/saved-views.js +17 -17
- package/dist/commands/scheduled-processor-mappings.js +17 -17
- package/dist/commands/schedules.js +17 -17
- package/dist/commands/switch.js +10 -3
- package/dist/commands/{files-internal.d.ts → tag-configurations.d.ts} +1 -1
- package/dist/commands/tag-configurations.js +1178 -0
- package/dist/commands/tags.js +17 -17
- package/dist/commands/tax-codes.js +17 -17
- package/dist/commands/tax-matrix.js +17 -17
- package/dist/commands/tenants.js +17 -17
- package/dist/commands/text-templates.js +17 -17
- package/dist/commands/tools.js +17 -17
- package/dist/commands/vat-declarations.js +17 -17
- package/dist/commands/vendor-invoices.js +21 -21
- package/dist/commands/webhooks.js +17 -17
- package/dist/commands/workflows.js +17 -17
- package/dist/lib/api-client.js +11 -6
- package/dist/lib/auth.d.ts +8 -0
- package/dist/lib/auth.js +51 -7
- package/dist/lib/base-api-command.js +6 -4
- package/dist/lib/config.d.ts +31 -1
- package/dist/lib/config.js +31 -0
- package/oclif.manifest.json +729 -247
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Args, Flags } from '@oclif/core';
|
|
2
2
|
import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
|
|
3
|
-
import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.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,10 +9,10 @@ const NESTED_IMPORTS = ["line-items", "notes", "files"];
|
|
|
9
9
|
const SUBCOMMANDS = [...["list", "create", "create-invoices", "get", "update", "delete", "pdf", "submit", "approve", "accept", "terminate", "cancel", "replace", "merge", "create-invoice", "send", "create-line-items", "update-line-items-reorder", "update-line-items", "delete-line-items", "list-notes", "create-notes", "get-notes", "update-notes", "delete-notes", "list-files", "create-files", "get-files", "update-files", "delete-files", "files-download"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
10
10
|
const ENDPOINTS = {
|
|
11
11
|
'list': { method: 'GET', path: '/v1/sales-orders', summary: 'Get all sales orders with pagination', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
12
|
-
'create': { method: 'POST', path: '/v1/sales-orders', summary: 'Create a new sales order', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['files', 'notes', 'tagIds', 'discounts', 'lineItems'] },
|
|
12
|
+
'create': { method: 'POST', path: '/v1/sales-orders', summary: 'Create a new sales order', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['files', 'notes', 'tagIds', 'tagCodes', 'discounts', 'lineItems'] },
|
|
13
13
|
'create-invoices': { method: 'POST', path: '/v1/sales-orders/create-invoices', summary: 'Create ONE draft invoice from several sales orders (same customer)', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['salesOrderIds'] },
|
|
14
14
|
'get': { method: 'GET', path: '/v1/sales-orders/{id}', summary: 'Get a sales order by ID', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
15
|
-
'update': { method: 'PATCH', path: '/v1/sales-orders/{id}', summary: 'Update a sales order', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['files', 'notes', 'tagIds', 'discounts', 'lineItems', 'removeFileIds'] },
|
|
15
|
+
'update': { method: 'PATCH', path: '/v1/sales-orders/{id}', summary: 'Update a sales order', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['files', 'notes', 'tagIds', 'tagCodes', 'discounts', 'lineItems', 'removeFileIds'] },
|
|
16
16
|
'delete': { method: 'DELETE', path: '/v1/sales-orders/{id}', summary: 'Delete a sales order', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
17
17
|
'pdf': { method: 'GET', path: '/v1/sales-orders/{id}/pdf', summary: 'Render a sales order PDF using the configured PDF processor', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
18
18
|
'submit': { method: 'POST', path: '/v1/sales-orders/{id}/submit', summary: 'Submit order for approval (DRAFT or CANCELLED → PENDING_APPROVAL)', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
@@ -55,7 +55,7 @@ export default class SalesOrders extends Command {
|
|
|
55
55
|
id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
|
|
56
56
|
};
|
|
57
57
|
static flags = {
|
|
58
|
-
context: Flags.string({ char: 'c', description: 'Context to use' }),
|
|
58
|
+
context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
|
|
59
59
|
output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
|
|
60
60
|
table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
|
|
61
61
|
csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
|
|
@@ -130,9 +130,9 @@ export default class SalesOrders extends Command {
|
|
|
130
130
|
}
|
|
131
131
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
132
132
|
if (!context)
|
|
133
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
134
|
-
if (!context
|
|
135
|
-
this.error(
|
|
133
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
134
|
+
if (!hasCredentials(context))
|
|
135
|
+
this.error(missingCredentialsMessage(context));
|
|
136
136
|
const queryParams = {};
|
|
137
137
|
if (flags.page)
|
|
138
138
|
queryParams.page = flags.page;
|
|
@@ -375,9 +375,9 @@ export default class SalesOrders extends Command {
|
|
|
375
375
|
async runImport(flags) {
|
|
376
376
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
377
377
|
if (!context)
|
|
378
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
379
|
-
if (!context
|
|
380
|
-
this.error(
|
|
378
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
379
|
+
if (!hasCredentials(context))
|
|
380
|
+
this.error(missingCredentialsMessage(context));
|
|
381
381
|
// Get data from file, --data, or --set flags
|
|
382
382
|
let items = [];
|
|
383
383
|
if (flags.file) {
|
|
@@ -587,9 +587,9 @@ export default class SalesOrders extends Command {
|
|
|
587
587
|
async runExport(flags) {
|
|
588
588
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
589
589
|
if (!context)
|
|
590
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
591
|
-
if (!context
|
|
592
|
-
this.error(
|
|
590
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
591
|
+
if (!hasCredentials(context))
|
|
592
|
+
this.error(missingCredentialsMessage(context));
|
|
593
593
|
const listEndpoint = ENDPOINTS['list'];
|
|
594
594
|
if (!listEndpoint)
|
|
595
595
|
this.error('Export requires a list endpoint');
|
|
@@ -681,9 +681,9 @@ export default class SalesOrders extends Command {
|
|
|
681
681
|
async runCamt053Import(flags) {
|
|
682
682
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
683
683
|
if (!context)
|
|
684
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
685
|
-
if (!context
|
|
686
|
-
this.error(
|
|
684
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
685
|
+
if (!hasCredentials(context))
|
|
686
|
+
this.error(missingCredentialsMessage(context));
|
|
687
687
|
if (!flags.file) {
|
|
688
688
|
this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
|
|
689
689
|
}
|
|
@@ -771,9 +771,9 @@ export default class SalesOrders extends Command {
|
|
|
771
771
|
}
|
|
772
772
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
773
773
|
if (!context)
|
|
774
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
775
|
-
if (!context
|
|
776
|
-
this.error(
|
|
774
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
775
|
+
if (!hasCredentials(context))
|
|
776
|
+
this.error(missingCredentialsMessage(context));
|
|
777
777
|
// Get data from file, --data, or --set flags
|
|
778
778
|
let items = [];
|
|
779
779
|
if (flags.file) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Args, Flags } from '@oclif/core';
|
|
2
2
|
import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
|
|
3
|
-
import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.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;
|
|
@@ -23,7 +23,7 @@ export default class SavedViews extends Command {
|
|
|
23
23
|
id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
|
|
24
24
|
};
|
|
25
25
|
static flags = {
|
|
26
|
-
context: Flags.string({ char: 'c', description: 'Context to use' }),
|
|
26
|
+
context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
|
|
27
27
|
output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
|
|
28
28
|
table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
|
|
29
29
|
csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
|
|
@@ -95,9 +95,9 @@ export default class SavedViews extends Command {
|
|
|
95
95
|
}
|
|
96
96
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
97
97
|
if (!context)
|
|
98
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
99
|
-
if (!context
|
|
100
|
-
this.error(
|
|
98
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
99
|
+
if (!hasCredentials(context))
|
|
100
|
+
this.error(missingCredentialsMessage(context));
|
|
101
101
|
const queryParams = {};
|
|
102
102
|
if (flags.page)
|
|
103
103
|
queryParams.page = flags.page;
|
|
@@ -340,9 +340,9 @@ export default class SavedViews extends Command {
|
|
|
340
340
|
async runImport(flags) {
|
|
341
341
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
342
342
|
if (!context)
|
|
343
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
344
|
-
if (!context
|
|
345
|
-
this.error(
|
|
343
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
344
|
+
if (!hasCredentials(context))
|
|
345
|
+
this.error(missingCredentialsMessage(context));
|
|
346
346
|
// Get data from file, --data, or --set flags
|
|
347
347
|
let items = [];
|
|
348
348
|
if (flags.file) {
|
|
@@ -552,9 +552,9 @@ export default class SavedViews extends Command {
|
|
|
552
552
|
async runExport(flags) {
|
|
553
553
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
554
554
|
if (!context)
|
|
555
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
556
|
-
if (!context
|
|
557
|
-
this.error(
|
|
555
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
556
|
+
if (!hasCredentials(context))
|
|
557
|
+
this.error(missingCredentialsMessage(context));
|
|
558
558
|
const listEndpoint = ENDPOINTS['list'];
|
|
559
559
|
if (!listEndpoint)
|
|
560
560
|
this.error('Export requires a list endpoint');
|
|
@@ -646,9 +646,9 @@ export default class SavedViews extends Command {
|
|
|
646
646
|
async runCamt053Import(flags) {
|
|
647
647
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
648
648
|
if (!context)
|
|
649
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
650
|
-
if (!context
|
|
651
|
-
this.error(
|
|
649
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
650
|
+
if (!hasCredentials(context))
|
|
651
|
+
this.error(missingCredentialsMessage(context));
|
|
652
652
|
if (!flags.file) {
|
|
653
653
|
this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
|
|
654
654
|
}
|
|
@@ -736,9 +736,9 @@ export default class SavedViews extends Command {
|
|
|
736
736
|
}
|
|
737
737
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
738
738
|
if (!context)
|
|
739
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
740
|
-
if (!context
|
|
741
|
-
this.error(
|
|
739
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
740
|
+
if (!hasCredentials(context))
|
|
741
|
+
this.error(missingCredentialsMessage(context));
|
|
742
742
|
// Get data from file, --data, or --set flags
|
|
743
743
|
let items = [];
|
|
744
744
|
if (flags.file) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Args, Flags } from '@oclif/core';
|
|
2
2
|
import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
|
|
3
|
-
import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.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 ScheduledProcessorMappings 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)' }),
|
|
@@ -101,9 +101,9 @@ export default class ScheduledProcessorMappings 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
|
|
106
|
-
this.error(
|
|
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;
|
|
@@ -346,9 +346,9 @@ export default class ScheduledProcessorMappings 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
|
|
351
|
-
this.error(
|
|
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 ScheduledProcessorMappings 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
|
|
563
|
-
this.error(
|
|
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');
|
|
@@ -652,9 +652,9 @@ export default class ScheduledProcessorMappings 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
|
|
657
|
-
this.error(
|
|
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 ScheduledProcessorMappings 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
|
|
747
|
-
this.error(
|
|
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) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Args, Flags } from '@oclif/core';
|
|
2
2
|
import { apiRequest, ApiError, normalizeSortBy } from '../lib/api-client.js';
|
|
3
|
-
import { getCurrentContext, getContext, getBaseUrls } from '../lib/config.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;
|
|
@@ -33,7 +33,7 @@ export default class Schedules extends Command {
|
|
|
33
33
|
id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
|
|
34
34
|
};
|
|
35
35
|
static flags = {
|
|
36
|
-
context: Flags.string({ char: 'c', description: 'Context to use' }),
|
|
36
|
+
context: Flags.string({ char: 'c', aliases: ['config'], env: 'ADERIS_CONTEXT', description: 'Context to use for this command, overriding the current context (alias: --config)' }),
|
|
37
37
|
output: Flags.string({ char: 'o', description: 'Output format (default: table for import, json for other commands)', options: ['json', 'table', 'csv'] }),
|
|
38
38
|
table: Flags.boolean({ char: 't', description: 'Output as table (shortcut for --output table)' }),
|
|
39
39
|
csv: Flags.boolean({ description: 'Output as CSV (shortcut for --output csv)' }),
|
|
@@ -105,9 +105,9 @@ export default class Schedules extends Command {
|
|
|
105
105
|
}
|
|
106
106
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
107
107
|
if (!context)
|
|
108
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
109
|
-
if (!context
|
|
110
|
-
this.error(
|
|
108
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
109
|
+
if (!hasCredentials(context))
|
|
110
|
+
this.error(missingCredentialsMessage(context));
|
|
111
111
|
const queryParams = {};
|
|
112
112
|
if (flags.page)
|
|
113
113
|
queryParams.page = flags.page;
|
|
@@ -350,9 +350,9 @@ export default class Schedules extends Command {
|
|
|
350
350
|
async runImport(flags) {
|
|
351
351
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
352
352
|
if (!context)
|
|
353
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
354
|
-
if (!context
|
|
355
|
-
this.error(
|
|
353
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
354
|
+
if (!hasCredentials(context))
|
|
355
|
+
this.error(missingCredentialsMessage(context));
|
|
356
356
|
// Get data from file, --data, or --set flags
|
|
357
357
|
let items = [];
|
|
358
358
|
if (flags.file) {
|
|
@@ -562,9 +562,9 @@ export default class Schedules extends Command {
|
|
|
562
562
|
async runExport(flags) {
|
|
563
563
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
564
564
|
if (!context)
|
|
565
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
566
|
-
if (!context
|
|
567
|
-
this.error(
|
|
565
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
566
|
+
if (!hasCredentials(context))
|
|
567
|
+
this.error(missingCredentialsMessage(context));
|
|
568
568
|
const listEndpoint = ENDPOINTS['list'];
|
|
569
569
|
if (!listEndpoint)
|
|
570
570
|
this.error('Export requires a list endpoint');
|
|
@@ -656,9 +656,9 @@ export default class Schedules extends Command {
|
|
|
656
656
|
async runCamt053Import(flags) {
|
|
657
657
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
658
658
|
if (!context)
|
|
659
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
660
|
-
if (!context
|
|
661
|
-
this.error(
|
|
659
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
660
|
+
if (!hasCredentials(context))
|
|
661
|
+
this.error(missingCredentialsMessage(context));
|
|
662
662
|
if (!flags.file) {
|
|
663
663
|
this.error('CAMT.053 import requires --file (-f) flag with path to XML file');
|
|
664
664
|
}
|
|
@@ -746,9 +746,9 @@ export default class Schedules extends Command {
|
|
|
746
746
|
}
|
|
747
747
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
748
748
|
if (!context)
|
|
749
|
-
this.error('No context configured. Run: aderis auth login --new');
|
|
750
|
-
if (!context
|
|
751
|
-
this.error(
|
|
749
|
+
this.error(flags.context ? `Context "${flags.context}" not found. List contexts with: aderis config list` : 'No context configured. Run: aderis auth login --new');
|
|
750
|
+
if (!hasCredentials(context))
|
|
751
|
+
this.error(missingCredentialsMessage(context));
|
|
752
752
|
// Get data from file, --data, or --set flags
|
|
753
753
|
let items = [];
|
|
754
754
|
if (flags.file) {
|
package/dist/commands/switch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { confirm, select } from '@inquirer/prompts';
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
3
|
import { loginAndSwitchTenant } from '../lib/auth.js';
|
|
4
|
-
import { getContext, getCurrentContext, listContexts, setCurrentContext } from '../lib/config.js';
|
|
4
|
+
import { getAuthType, getContext, getCurrentContext, hasCredentials, listContexts, setCurrentContext, } from '../lib/config.js';
|
|
5
5
|
export default class Switch extends Command {
|
|
6
6
|
static description = 'Switch context and tenant interactively';
|
|
7
7
|
static examples = ['<%= config.bin %> switch'];
|
|
@@ -23,9 +23,10 @@ export default class Switch extends Command {
|
|
|
23
23
|
const selectedContext = await select({
|
|
24
24
|
choices: sortedContexts.map((ctx) => {
|
|
25
25
|
const isCurrent = current?.name === ctx.name;
|
|
26
|
-
const auth = ctx
|
|
26
|
+
const auth = hasCredentials(ctx) ? '✓' : '✗';
|
|
27
|
+
const kind = getAuthType(ctx) === 'api_key' ? ' api-key' : '';
|
|
27
28
|
return {
|
|
28
|
-
name: `${ctx.name} [${ctx.environment}] auth:${auth}${isCurrent ? ' (current)' : ''}`,
|
|
29
|
+
name: `${ctx.name} [${ctx.environment}] auth:${auth}${kind}${isCurrent ? ' (current)' : ''}`,
|
|
29
30
|
value: ctx.name,
|
|
30
31
|
};
|
|
31
32
|
}),
|
|
@@ -35,6 +36,12 @@ export default class Switch extends Command {
|
|
|
35
36
|
setCurrentContext(selectedContext);
|
|
36
37
|
this.log(`Switched to context: ${selectedContext}`);
|
|
37
38
|
}
|
|
39
|
+
// An API key is issued for one tenant, so there is no tenant step to run.
|
|
40
|
+
const selected = getContext(selectedContext);
|
|
41
|
+
if (selected && getAuthType(selected) === 'api_key') {
|
|
42
|
+
this.log('This context authenticates with an API key, which is scoped to a single tenant.');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
38
45
|
// Step 2: Select tenant within chosen context.
|
|
39
46
|
// If the session is expired, prompt the user to re-login and then retry.
|
|
40
47
|
const { default: AuthTenant } = await import('./auth/tenant.js');
|