@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.
- package/dist/commands/access-groups.js +21 -21
- package/dist/commands/account-transaction-allocations.js +21 -21
- package/dist/commands/account-transactions.js +23 -23
- package/dist/commands/accounts.js +23 -23
- package/dist/commands/agent-platform.js +23 -22
- package/dist/commands/analytics.d.ts +40 -0
- package/dist/commands/{documents.js → analytics.js} +33 -43
- package/dist/commands/audit-log.js +24 -24
- 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 +21 -21
- package/dist/commands/bank-integrations.js +21 -21
- package/dist/commands/business-partners.js +29 -26
- package/dist/commands/chat.js +21 -21
- 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 +21 -21
- package/dist/commands/delivery-notes.js +28 -25
- package/dist/commands/dunning-configs.js +21 -21
- package/dist/commands/dunning-reminders.js +21 -21
- package/dist/commands/dunning-runs.js +21 -21
- package/dist/commands/email-transactions.js +21 -21
- package/dist/commands/employees.js +23 -23
- package/dist/commands/entity-configurations.js +21 -21
- package/dist/commands/event-processor-mappings.js +21 -21
- package/dist/commands/{documents.d.ts → files.d.ts} +1 -1
- package/dist/commands/{files-internal.js → files.js} +39 -33
- package/dist/commands/health.js +21 -21
- package/dist/commands/inbox.d.ts +1 -0
- package/dist/commands/inbox.js +25 -23
- package/dist/commands/integrations.js +21 -21
- package/dist/commands/item-categories.js +21 -21
- package/dist/commands/items.js +23 -23
- package/dist/commands/journal-lines.js +21 -21
- package/dist/commands/journals.js +27 -24
- package/dist/commands/ledgers.js +25 -22
- package/dist/commands/office-locations.js +21 -21
- package/dist/commands/payment-methods.js +21 -21
- package/dist/commands/payment-runs.js +23 -22
- package/dist/commands/payment-terms.js +21 -21
- package/dist/commands/payments.js +21 -21
- package/dist/commands/price-lists.js +21 -21
- package/dist/commands/processor-mappings.js +21 -21
- package/dist/commands/processors.js +21 -21
- package/dist/commands/purchase-order-types.js +21 -21
- package/dist/commands/purchase-orders.d.ts +1 -0
- package/dist/commands/purchase-orders.js +32 -25
- package/dist/commands/reports.js +21 -21
- package/dist/commands/salary-types.js +21 -21
- package/dist/commands/sales-invoices.js +33 -31
- package/dist/commands/sales-orders.js +23 -23
- package/dist/commands/saved-views.js +21 -21
- package/dist/commands/scheduled-processor-mappings.d.ts +40 -0
- package/dist/commands/scheduled-processor-mappings.js +1178 -0
- package/dist/commands/schedules.js +21 -21
- 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 +21 -21
- package/dist/commands/tax-codes.js +21 -21
- package/dist/commands/tax-matrix.js +21 -21
- package/dist/commands/tenants.js +23 -23
- package/dist/commands/text-templates.js +21 -21
- package/dist/commands/tools.js +21 -21
- package/dist/commands/vat-declarations.js +21 -21
- package/dist/commands/vendor-invoices.js +25 -25
- package/dist/commands/webhooks.js +21 -21
- package/dist/commands/workflows.js +21 -21
- package/dist/lib/api-client.d.ts +8 -0
- package/dist/lib/api-client.js +31 -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 +1099 -443
- 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;
|
|
@@ -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)' }),
|
|
@@ -44,7 +44,7 @@ export default class Schedules extends Command {
|
|
|
44
44
|
limit: Flags.string({ description: 'Items per page' }),
|
|
45
45
|
include: Flags.string({ description: 'Relations to include' }),
|
|
46
46
|
search: Flags.string({ description: 'Search term' }),
|
|
47
|
-
'sort-by': Flags.string({ description: 'Sort field' }),
|
|
47
|
+
'sort-by': Flags.string({ description: 'Sort field(s), comma-separated. Direction (:ASC/:DESC) is optional; date-like fields default to DESC, others to ASC.' }),
|
|
48
48
|
filter: Flags.string({ description: 'Filter (e.g. --filter status=ACTIVE). Operators: in:A,B, like:%, gt:, lt:, null:', multiple: true }),
|
|
49
49
|
query: Flags.string({ description: 'Additional query params as JSON' }),
|
|
50
50
|
fields: Flags.string({ description: 'Comma-separated list of fields to show (e.g. --fields=id,name,status)' }),
|
|
@@ -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;
|
|
@@ -118,7 +118,7 @@ export default class Schedules extends Command {
|
|
|
118
118
|
if (flags.search)
|
|
119
119
|
queryParams.search = flags.search;
|
|
120
120
|
if (flags['sort-by'])
|
|
121
|
-
queryParams.sortBy = flags['sort-by'];
|
|
121
|
+
queryParams.sortBy = normalizeSortBy(flags['sort-by']);
|
|
122
122
|
if (flags.query) {
|
|
123
123
|
try {
|
|
124
124
|
Object.assign(queryParams, JSON.parse(flags.query));
|
|
@@ -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');
|
|
@@ -577,7 +577,7 @@ export default class Schedules extends Command {
|
|
|
577
577
|
if (flags.search)
|
|
578
578
|
baseParams.search = flags.search;
|
|
579
579
|
if (flags['sort-by'])
|
|
580
|
-
baseParams.sortBy = flags['sort-by'];
|
|
580
|
+
baseParams.sortBy = normalizeSortBy(flags['sort-by']);
|
|
581
581
|
if (flags.include)
|
|
582
582
|
baseParams.include = flags.include;
|
|
583
583
|
if (flags.query) {
|
|
@@ -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');
|