@aderis-erp/cli 1.1.3 → 1.1.4
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/README.md +1 -0
- package/dist/commands/api-clients.d.ts +58 -0
- package/dist/commands/api-clients.js +1341 -0
- package/dist/commands/bank-accounts.js +1 -1
- package/dist/commands/credit-card-accounts.d.ts +4 -0
- package/dist/commands/credit-card-accounts.js +8 -3
- package/dist/commands/currencies.d.ts +56 -0
- package/dist/commands/{workflows.js → currencies.js} +13 -15
- package/dist/commands/custody-accounts.d.ts +56 -0
- package/dist/commands/{integration-identities.js → custody-accounts.js} +25 -22
- package/dist/commands/{integration-identities.d.ts → dashboards.d.ts} +3 -3
- package/dist/commands/dashboards.js +1347 -0
- package/dist/commands/document-checksums.d.ts +56 -0
- package/dist/commands/document-checksums.js +1324 -0
- package/dist/commands/financial-instrument-types.d.ts +56 -0
- package/dist/commands/financial-instrument-types.js +1335 -0
- package/dist/commands/financial-instruments.d.ts +56 -0
- package/dist/commands/financial-instruments.js +1335 -0
- package/dist/commands/items.js +2 -2
- package/dist/commands/{workflows.d.ts → kpis.d.ts} +1 -1
- package/dist/commands/kpis.js +1337 -0
- package/dist/commands/ledgers.js +1 -1
- package/dist/commands/notifications.d.ts +56 -0
- package/dist/commands/notifications.js +1326 -0
- package/dist/commands/sales-orders.js +1 -1
- package/dist/commands/settings.d.ts +56 -0
- package/dist/commands/settings.js +1327 -0
- package/dist/commands/templates.js +2 -1
- package/dist/commands/vendor-invoices.js +2 -1
- package/dist/commands/work-summary.d.ts +56 -0
- package/dist/commands/work-summary.js +1326 -0
- package/dist/lib/auth/index.js +5 -0
- package/dist/lib/production-guard.d.ts +42 -0
- package/dist/lib/production-guard.js +92 -0
- package/oclif.manifest.json +1943 -331
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ const ENDPOINTS = {
|
|
|
28
28
|
'get-notes': { method: 'GET', path: '/v1/bank-accounts/{bankAccountId}/notes/{noteId}', summary: 'Get a specific note for a bank account', pathParams: ['bankAccountId', 'noteId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
29
29
|
'update-notes': { method: 'PATCH', path: '/v1/bank-accounts/{bankAccountId}/notes/{noteId}', summary: 'Update a note for a bank account', pathParams: ['bankAccountId', 'noteId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
30
30
|
'delete-notes': { method: 'DELETE', path: '/v1/bank-accounts/{bankAccountId}/notes/{noteId}', summary: 'Delete a note from a bank account', pathParams: ['bankAccountId', 'noteId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
31
|
-
'list-daily-balances': { method: 'GET', path: '/v1/bank-accounts/{bankAccountId}/daily-balances', summary: 'Get a bank account\'s daily closing balances for a date range', pathParams: ['bankAccountId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
31
|
+
'list-daily-balances': { method: 'GET', path: '/v1/bank-accounts/{bankAccountId}/daily-balances', summary: 'Get a bank account\'s daily closing balances for a date range, one row per day and currency', pathParams: ['bankAccountId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
32
32
|
};
|
|
33
33
|
export default class BankAccounts extends Command {
|
|
34
34
|
static description = 'Manage bank accounts';
|
|
@@ -14,6 +14,10 @@ export default class CreditCardAccounts extends Command {
|
|
|
14
14
|
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
15
|
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
set: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
mode: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
reference: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
async: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
21
|
'mapping-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
22
|
'note-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
23
|
'card-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -7,9 +7,9 @@ import { getCurrentContext, getContext, getBaseUrls, hasCredentials, missingCred
|
|
|
7
7
|
const HAS_UPSERT = true;
|
|
8
8
|
const HAS_EXPORT = true;
|
|
9
9
|
const HAS_CAMT053 = false;
|
|
10
|
-
const SERVER_IMPORTS = [];
|
|
11
|
-
const NESTED_UPSERTS = ["ledger-mappings", "notes"
|
|
12
|
-
const SUBCOMMANDS = [...["list", "create", "get", "update", "delete", "list-ledger-mappings", "create-ledger-mappings", "get-ledger-mappings", "update-ledger-mappings", "delete-ledger-mappings", "list-notes", "create-notes", "get-notes", "update-notes", "delete-notes", "list-cards", "create-cards", "get-cards", "update-cards", "delete-cards"], ...(HAS_UPSERT ? ['upsert'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_UPSERTS.map(n => `upsert-${n}`)];
|
|
10
|
+
const SERVER_IMPORTS = ["import-cards"];
|
|
11
|
+
const NESTED_UPSERTS = ["ledger-mappings", "notes"];
|
|
12
|
+
const SUBCOMMANDS = [...["list", "create", "get", "update", "delete", "list-ledger-mappings", "create-ledger-mappings", "get-ledger-mappings", "update-ledger-mappings", "delete-ledger-mappings", "list-notes", "create-notes", "get-notes", "update-notes", "delete-notes", "list-cards", "create-cards", "get-cards", "update-cards", "delete-cards", "import-cards"], ...(HAS_UPSERT ? ['upsert'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_UPSERTS.map(n => `upsert-${n}`)];
|
|
13
13
|
const ENDPOINTS = {
|
|
14
14
|
'list': { method: 'GET', path: '/v1/credit-card-accounts', summary: 'Get all credit card accounts with pagination', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
15
15
|
'create': { method: 'POST', path: '/v1/credit-card-accounts', summary: 'Create a new credit card account (with optional notes)', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: ['notes'] },
|
|
@@ -31,6 +31,7 @@ const ENDPOINTS = {
|
|
|
31
31
|
'get-cards': { method: 'GET', path: '/v1/credit-card-accounts/{creditCardAccountId}/cards/{cardId}', summary: 'Get a card by ID', pathParams: ['creditCardAccountId', 'cardId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
32
32
|
'update-cards': { method: 'PATCH', path: '/v1/credit-card-accounts/{creditCardAccountId}/cards/{cardId}', summary: 'Update a card', pathParams: ['creditCardAccountId', 'cardId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
33
33
|
'delete-cards': { method: 'DELETE', path: '/v1/credit-card-accounts/{creditCardAccountId}/cards/{cardId}', summary: 'Delete a manual card', pathParams: ['creditCardAccountId', 'cardId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
34
|
+
'import-cards': { method: 'POST', path: '/v1/credit-card-accounts/{creditCardAccountId}/cards/import', summary: 'Import provider cards into a credit card account', pathParams: ['creditCardAccountId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
34
35
|
};
|
|
35
36
|
export default class CreditCardAccounts extends Command {
|
|
36
37
|
static description = 'Manage credit card accounts';
|
|
@@ -54,6 +55,10 @@ export default class CreditCardAccounts extends Command {
|
|
|
54
55
|
data: Flags.string({ char: 'd', description: 'JSON data for request body' }),
|
|
55
56
|
file: Flags.string({ char: 'f', description: 'Read request body from file' }),
|
|
56
57
|
set: Flags.string({ char: 's', description: 'Set individual field (e.g. --set firstName=John)', multiple: true }),
|
|
58
|
+
mode: Flags.string({ description: 'Import mode: upsert (default) creates, updates or skips each record; create refuses records that already exist; update refuses records that do not', options: ['upsert', 'create', 'update'] }),
|
|
59
|
+
reference: Flags.string({ description: 'Caller-defined text stored on the import run, for tracking and filtering' }),
|
|
60
|
+
async: Flags.boolean({ description: 'Import in the background: answers with a PENDING run to follow via "aderis imports get <id>"' }),
|
|
61
|
+
'idempotency-key': Flags.string({ description: 'Repeating a key returns the earlier import run unchanged and imports nothing' }),
|
|
57
62
|
'mapping-id': Flags.string({ description: 'Path param: mappingId' }),
|
|
58
63
|
'note-id': Flags.string({ description: 'Path param: noteId' }),
|
|
59
64
|
'card-id': Flags.string({ description: 'Path param: cardId' }),
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Currencies extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
action: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
context: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
table: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
set: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
page: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
limit: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
include: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'sort-by': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
filter: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
};
|
|
29
|
+
run(): Promise<void>;
|
|
30
|
+
private runUpsert;
|
|
31
|
+
/**
|
|
32
|
+
* The API's own import: the whole array goes up in one request and comes
|
|
33
|
+
* back as an import run, which records what happened to every record. A bad
|
|
34
|
+
* record lands in errorLog and the rest are still applied, and the run stays
|
|
35
|
+
* readable afterwards with: aderis imports get <id>.
|
|
36
|
+
*/
|
|
37
|
+
private runServerImport;
|
|
38
|
+
/** Renders an import run: its counts, then whatever the server refused. */
|
|
39
|
+
private printImportRun;
|
|
40
|
+
private runExport;
|
|
41
|
+
private runCamt053Import;
|
|
42
|
+
private runNestedUpsert;
|
|
43
|
+
private parseFilterValue;
|
|
44
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
45
|
+
private printPageSummary;
|
|
46
|
+
/**
|
|
47
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
48
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
49
|
+
*/
|
|
50
|
+
private warnShortPage;
|
|
51
|
+
private sanitizeOutput;
|
|
52
|
+
private getColumns;
|
|
53
|
+
private getValue;
|
|
54
|
+
private printTable;
|
|
55
|
+
private printCsv;
|
|
56
|
+
}
|
|
@@ -9,17 +9,15 @@ const HAS_EXPORT = true;
|
|
|
9
9
|
const HAS_CAMT053 = false;
|
|
10
10
|
const SERVER_IMPORTS = [];
|
|
11
11
|
const NESTED_UPSERTS = [];
|
|
12
|
-
const SUBCOMMANDS = [...["list"
|
|
12
|
+
const SUBCOMMANDS = [...["list"], ...(HAS_UPSERT ? ['upsert'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_UPSERTS.map(n => `upsert-${n}`)];
|
|
13
13
|
const ENDPOINTS = {
|
|
14
|
-
'list': { method: 'GET', path: '/v1/
|
|
15
|
-
'status': { method: 'POST', path: '/v1/workflows/status', summary: 'Create a new workflow status update', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
16
|
-
'find': { method: 'GET', path: '/v1/workflows/{workflowId}', summary: 'Get workflow details including status updates and entity changes', pathParams: ['workflowId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
14
|
+
'list': { method: 'GET', path: '/v1/currencies', summary: 'GET /v1/currencies', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
17
15
|
};
|
|
18
|
-
export default class
|
|
19
|
-
static description = 'Manage
|
|
16
|
+
export default class Currencies extends Command {
|
|
17
|
+
static description = 'Manage currencies';
|
|
20
18
|
static examples = [
|
|
21
|
-
'<%= config.bin %>
|
|
22
|
-
'<%= config.bin %>
|
|
19
|
+
'<%= config.bin %> currencies list',
|
|
20
|
+
'<%= config.bin %> currencies export --csv > currencies.csv',
|
|
23
21
|
];
|
|
24
22
|
static args = {
|
|
25
23
|
action: Args.string({ description: 'Action: ' + SUBCOMMANDS.join(', '), required: true }),
|
|
@@ -46,14 +44,14 @@ export default class Workflows extends Command {
|
|
|
46
44
|
'show-http-request': Flags.boolean({ description: 'Show HTTP request details (method, URL, body)' }),
|
|
47
45
|
};
|
|
48
46
|
async run() {
|
|
49
|
-
const { args, flags } = await this.parse(
|
|
47
|
+
const { args, flags } = await this.parse(Currencies);
|
|
50
48
|
// Bulk actions. 'import' is the API's own endpoint: one request, answered
|
|
51
49
|
// by a run that records what happened to every record. 'upsert' is the CLI
|
|
52
50
|
// looping create/update. A resource has one or the other, never both.
|
|
53
51
|
if (args.action === 'upsert') {
|
|
54
52
|
if (!HAS_UPSERT) {
|
|
55
53
|
this.error(SERVER_IMPORTS.includes('import')
|
|
56
|
-
? 'This resource is imported by the API. Use: aderis
|
|
54
|
+
? 'This resource is imported by the API. Use: aderis currencies import --file data.json'
|
|
57
55
|
: 'Upsert needs both a create and an update endpoint, which this resource does not have');
|
|
58
56
|
}
|
|
59
57
|
await this.runUpsert(flags);
|
|
@@ -63,7 +61,7 @@ export default class Workflows extends Command {
|
|
|
63
61
|
const suffix = args.action.replace('upsert-', '');
|
|
64
62
|
if (!NESTED_UPSERTS.includes(suffix)) {
|
|
65
63
|
this.error(SERVER_IMPORTS.includes('import-' + suffix)
|
|
66
|
-
? `That resource is imported by the API. Use: aderis
|
|
64
|
+
? `That resource is imported by the API. Use: aderis currencies import-${suffix} <id> --file data.json`
|
|
67
65
|
: `Unknown action: ${args.action}. Available: ${SUBCOMMANDS.join(', ')}`);
|
|
68
66
|
}
|
|
69
67
|
await this.runNestedUpsert(suffix, args.id, flags);
|
|
@@ -93,7 +91,7 @@ export default class Workflows extends Command {
|
|
|
93
91
|
const suffix = args.action === 'import' ? '' : '-' + args.action.replace('import-', '');
|
|
94
92
|
const loops = args.action === 'import' ? HAS_UPSERT : NESTED_UPSERTS.includes(args.action.replace('import-', ''));
|
|
95
93
|
if (loops) {
|
|
96
|
-
this.error(`This resource has no import endpoint. Use: aderis
|
|
94
|
+
this.error(`This resource has no import endpoint. Use: aderis currencies upsert${suffix}${suffix ? ' <id>' : ''} --file data.json`);
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
97
|
const endpoint = ENDPOINTS[args.action];
|
|
@@ -107,7 +105,7 @@ export default class Workflows extends Command {
|
|
|
107
105
|
// First path param always comes from positional argument
|
|
108
106
|
value = args.id;
|
|
109
107
|
if (!value)
|
|
110
|
-
this.error('Missing required argument: id. Usage: aderis
|
|
108
|
+
this.error('Missing required argument: id. Usage: aderis currencies <action> <id>');
|
|
111
109
|
}
|
|
112
110
|
else {
|
|
113
111
|
const flagName = param.replace(/\./g, '-').replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '');
|
|
@@ -638,7 +636,7 @@ export default class Workflows extends Command {
|
|
|
638
636
|
let apiPath = endpoint.path;
|
|
639
637
|
if (endpoint.pathParams.length > 0) {
|
|
640
638
|
if (!parentId)
|
|
641
|
-
this.error(`Missing required argument: id. Usage: aderis
|
|
639
|
+
this.error(`Missing required argument: id. Usage: aderis currencies ${action} <parent-id> --file data.json`);
|
|
642
640
|
apiPath = apiPath.replace(`{${endpoint.pathParams[0]}}`, parentId);
|
|
643
641
|
}
|
|
644
642
|
// The endpoint takes an array. A single object is wrapped, so importing
|
|
@@ -911,7 +909,7 @@ export default class Workflows extends Command {
|
|
|
911
909
|
}
|
|
912
910
|
async runNestedUpsert(suffix, parentId, flags) {
|
|
913
911
|
if (!parentId) {
|
|
914
|
-
this.error(`Missing required argument: id. Usage: aderis
|
|
912
|
+
this.error(`Missing required argument: id. Usage: aderis currencies upsert-${suffix} <parent-id> --file data.json`);
|
|
915
913
|
}
|
|
916
914
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
917
915
|
if (!context)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class CustodyAccounts extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
action: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
context: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
table: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
set: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
page: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
limit: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
include: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'sort-by': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
filter: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
};
|
|
29
|
+
run(): Promise<void>;
|
|
30
|
+
private runUpsert;
|
|
31
|
+
/**
|
|
32
|
+
* The API's own import: the whole array goes up in one request and comes
|
|
33
|
+
* back as an import run, which records what happened to every record. A bad
|
|
34
|
+
* record lands in errorLog and the rest are still applied, and the run stays
|
|
35
|
+
* readable afterwards with: aderis imports get <id>.
|
|
36
|
+
*/
|
|
37
|
+
private runServerImport;
|
|
38
|
+
/** Renders an import run: its counts, then whatever the server refused. */
|
|
39
|
+
private printImportRun;
|
|
40
|
+
private runExport;
|
|
41
|
+
private runCamt053Import;
|
|
42
|
+
private runNestedUpsert;
|
|
43
|
+
private parseFilterValue;
|
|
44
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
45
|
+
private printPageSummary;
|
|
46
|
+
/**
|
|
47
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
48
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
49
|
+
*/
|
|
50
|
+
private warnShortPage;
|
|
51
|
+
private sanitizeOutput;
|
|
52
|
+
private getColumns;
|
|
53
|
+
private getValue;
|
|
54
|
+
private printTable;
|
|
55
|
+
private printCsv;
|
|
56
|
+
}
|
|
@@ -4,25 +4,29 @@ import { getCurrentContext, getContext, getBaseUrls, hasCredentials, missingCred
|
|
|
4
4
|
// 'upsert' loops create/update from the CLI, one request per record. It exists
|
|
5
5
|
// only where the API has no import endpoint of its own; those keep the name
|
|
6
6
|
// 'import' and are listed in SERVER_IMPORTS.
|
|
7
|
-
const HAS_UPSERT =
|
|
8
|
-
const HAS_EXPORT =
|
|
7
|
+
const HAS_UPSERT = true;
|
|
8
|
+
const HAS_EXPORT = true;
|
|
9
9
|
const HAS_CAMT053 = false;
|
|
10
10
|
const SERVER_IMPORTS = [];
|
|
11
11
|
const NESTED_UPSERTS = [];
|
|
12
|
-
const SUBCOMMANDS = [...["list
|
|
12
|
+
const SUBCOMMANDS = [...["list", "create", "get", "update", "delete"], ...(HAS_UPSERT ? ['upsert'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_UPSERTS.map(n => `upsert-${n}`)];
|
|
13
13
|
const ENDPOINTS = {
|
|
14
|
-
'list
|
|
15
|
-
'create
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'create-integrations-secrets': { method: 'POST', path: '/v1/auth/integrations/{integrationId}/secrets', summary: 'Issue an integration secret', pathParams: ['integrationId'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
20
|
-
'delete-integrations-secrets': { method: 'DELETE', path: '/v1/auth/integrations/{integrationId}/secrets/{secretId}', summary: 'Revoke one integration secret', pathParams: ['integrationId', 'secretId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
21
|
-
'integrations-disable': { method: 'POST', path: '/v1/auth/integrations/{integrationId}/disable', summary: 'Disable an integration and end its sessions', pathParams: ['integrationId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
14
|
+
'list': { method: 'GET', path: '/v1/custody-accounts', summary: 'List custody accounts', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
15
|
+
'create': { method: 'POST', path: '/v1/custody-accounts', summary: 'Create a custody account', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
16
|
+
'get': { method: 'GET', path: '/v1/custody-accounts/{id}', summary: 'Read a custody account', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
17
|
+
'update': { method: 'PATCH', path: '/v1/custody-accounts/{id}', summary: 'Update a custody account', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
18
|
+
'delete': { method: 'DELETE', path: '/v1/custody-accounts/{id}', summary: 'Delete a custody account', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
22
19
|
};
|
|
23
|
-
export default class
|
|
24
|
-
static description = 'Manage
|
|
25
|
-
static examples = [
|
|
20
|
+
export default class CustodyAccounts extends Command {
|
|
21
|
+
static description = 'Manage custody accounts';
|
|
22
|
+
static examples = [
|
|
23
|
+
'<%= config.bin %> custody-accounts list',
|
|
24
|
+
'<%= config.bin %> custody-accounts get <id>',
|
|
25
|
+
'<%= config.bin %> custody-accounts create --data \'{...}\'',
|
|
26
|
+
'<%= config.bin %> custody-accounts update <id> --set field=value',
|
|
27
|
+
'<%= config.bin %> custody-accounts upsert --file data.json',
|
|
28
|
+
'<%= config.bin %> custody-accounts export --csv > custody-accounts.csv',
|
|
29
|
+
];
|
|
26
30
|
static args = {
|
|
27
31
|
action: Args.string({ description: 'Action: ' + SUBCOMMANDS.join(', '), required: true }),
|
|
28
32
|
id: Args.string({ description: 'Resource ID (for get, update, delete operations)', required: false }),
|
|
@@ -35,7 +39,6 @@ export default class IntegrationIdentities extends Command {
|
|
|
35
39
|
data: Flags.string({ char: 'd', description: 'JSON data for request body' }),
|
|
36
40
|
file: Flags.string({ char: 'f', description: 'Read request body from file' }),
|
|
37
41
|
set: Flags.string({ char: 's', description: 'Set individual field (e.g. --set firstName=John)', multiple: true }),
|
|
38
|
-
'secret-id': Flags.string({ description: 'Path param: secretId' }),
|
|
39
42
|
page: Flags.string({ description: 'Page number' }),
|
|
40
43
|
limit: Flags.string({ description: 'Items per page' }),
|
|
41
44
|
include: Flags.string({ description: 'Relations to include' }),
|
|
@@ -49,14 +52,14 @@ export default class IntegrationIdentities extends Command {
|
|
|
49
52
|
'show-http-request': Flags.boolean({ description: 'Show HTTP request details (method, URL, body)' }),
|
|
50
53
|
};
|
|
51
54
|
async run() {
|
|
52
|
-
const { args, flags } = await this.parse(
|
|
55
|
+
const { args, flags } = await this.parse(CustodyAccounts);
|
|
53
56
|
// Bulk actions. 'import' is the API's own endpoint: one request, answered
|
|
54
57
|
// by a run that records what happened to every record. 'upsert' is the CLI
|
|
55
58
|
// looping create/update. A resource has one or the other, never both.
|
|
56
59
|
if (args.action === 'upsert') {
|
|
57
60
|
if (!HAS_UPSERT) {
|
|
58
61
|
this.error(SERVER_IMPORTS.includes('import')
|
|
59
|
-
? 'This resource is imported by the API. Use: aderis
|
|
62
|
+
? 'This resource is imported by the API. Use: aderis custody-accounts import --file data.json'
|
|
60
63
|
: 'Upsert needs both a create and an update endpoint, which this resource does not have');
|
|
61
64
|
}
|
|
62
65
|
await this.runUpsert(flags);
|
|
@@ -66,7 +69,7 @@ export default class IntegrationIdentities extends Command {
|
|
|
66
69
|
const suffix = args.action.replace('upsert-', '');
|
|
67
70
|
if (!NESTED_UPSERTS.includes(suffix)) {
|
|
68
71
|
this.error(SERVER_IMPORTS.includes('import-' + suffix)
|
|
69
|
-
? `That resource is imported by the API. Use: aderis
|
|
72
|
+
? `That resource is imported by the API. Use: aderis custody-accounts import-${suffix} <id> --file data.json`
|
|
70
73
|
: `Unknown action: ${args.action}. Available: ${SUBCOMMANDS.join(', ')}`);
|
|
71
74
|
}
|
|
72
75
|
await this.runNestedUpsert(suffix, args.id, flags);
|
|
@@ -96,7 +99,7 @@ export default class IntegrationIdentities extends Command {
|
|
|
96
99
|
const suffix = args.action === 'import' ? '' : '-' + args.action.replace('import-', '');
|
|
97
100
|
const loops = args.action === 'import' ? HAS_UPSERT : NESTED_UPSERTS.includes(args.action.replace('import-', ''));
|
|
98
101
|
if (loops) {
|
|
99
|
-
this.error(`This resource has no import endpoint. Use: aderis
|
|
102
|
+
this.error(`This resource has no import endpoint. Use: aderis custody-accounts upsert${suffix}${suffix ? ' <id>' : ''} --file data.json`);
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
const endpoint = ENDPOINTS[args.action];
|
|
@@ -110,7 +113,7 @@ export default class IntegrationIdentities extends Command {
|
|
|
110
113
|
// First path param always comes from positional argument
|
|
111
114
|
value = args.id;
|
|
112
115
|
if (!value)
|
|
113
|
-
this.error('Missing required argument: id. Usage: aderis
|
|
116
|
+
this.error('Missing required argument: id. Usage: aderis custody-accounts <action> <id>');
|
|
114
117
|
}
|
|
115
118
|
else {
|
|
116
119
|
const flagName = param.replace(/\./g, '-').replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '');
|
|
@@ -641,7 +644,7 @@ export default class IntegrationIdentities extends Command {
|
|
|
641
644
|
let apiPath = endpoint.path;
|
|
642
645
|
if (endpoint.pathParams.length > 0) {
|
|
643
646
|
if (!parentId)
|
|
644
|
-
this.error(`Missing required argument: id. Usage: aderis
|
|
647
|
+
this.error(`Missing required argument: id. Usage: aderis custody-accounts ${action} <parent-id> --file data.json`);
|
|
645
648
|
apiPath = apiPath.replace(`{${endpoint.pathParams[0]}}`, parentId);
|
|
646
649
|
}
|
|
647
650
|
// The endpoint takes an array. A single object is wrapped, so importing
|
|
@@ -914,7 +917,7 @@ export default class IntegrationIdentities extends Command {
|
|
|
914
917
|
}
|
|
915
918
|
async runNestedUpsert(suffix, parentId, flags) {
|
|
916
919
|
if (!parentId) {
|
|
917
|
-
this.error(`Missing required argument: id. Usage: aderis
|
|
920
|
+
this.error(`Missing required argument: id. Usage: aderis custody-accounts upsert-${suffix} <parent-id> --file data.json`);
|
|
918
921
|
}
|
|
919
922
|
const context = flags.context ? getContext(flags.context) : getCurrentContext();
|
|
920
923
|
if (!context)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
export default class
|
|
2
|
+
export default class Dashboards extends Command {
|
|
3
3
|
static description: string;
|
|
4
|
-
static examples:
|
|
4
|
+
static examples: string[];
|
|
5
5
|
static args: {
|
|
6
6
|
action: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
7
|
id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
@@ -14,7 +14,7 @@ export default class IntegrationIdentities extends Command {
|
|
|
14
14
|
data: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
15
|
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
set: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
-
'
|
|
17
|
+
'widget-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
18
|
page: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
19
|
limit: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
20
|
include: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|