@aderis-erp/cli 1.1.1 → 1.1.2
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.d.ts +8 -0
- package/dist/commands/access-groups.js +54 -6
- package/dist/commands/account-transaction-allocations.d.ts +8 -0
- package/dist/commands/account-transaction-allocations.js +52 -5
- package/dist/commands/account-transactions.d.ts +8 -0
- package/dist/commands/account-transactions.js +55 -7
- package/dist/commands/accounts.d.ts +8 -0
- package/dist/commands/accounts.js +52 -5
- package/dist/commands/agent-platform.d.ts +8 -0
- package/dist/commands/agent-platform.js +52 -5
- package/dist/commands/agent-runs.d.ts +8 -0
- package/dist/commands/agent-runs.js +52 -5
- package/dist/commands/analytics.d.ts +8 -0
- package/dist/commands/analytics.js +52 -5
- package/dist/commands/api-keys.d.ts +8 -0
- package/dist/commands/api-keys.js +52 -5
- package/dist/commands/async-jobs.d.ts +8 -0
- package/dist/commands/async-jobs.js +52 -5
- package/dist/commands/audit-log.d.ts +8 -0
- package/dist/commands/audit-log.js +52 -5
- package/dist/commands/bank-accounts.d.ts +8 -0
- package/dist/commands/bank-accounts.js +52 -5
- package/dist/commands/bank-integrations.d.ts +8 -0
- package/dist/commands/bank-integrations.js +52 -5
- package/dist/commands/business-partners.d.ts +9 -0
- package/dist/commands/business-partners.js +64 -7
- package/dist/commands/chat.d.ts +8 -0
- package/dist/commands/chat.js +52 -5
- package/dist/commands/credit-card-accounts.d.ts +8 -0
- package/dist/commands/credit-card-accounts.js +52 -5
- package/dist/commands/delivery-notes.d.ts +8 -0
- package/dist/commands/delivery-notes.js +52 -5
- package/dist/commands/dunning-configs.d.ts +8 -0
- package/dist/commands/dunning-configs.js +52 -5
- package/dist/commands/dunning-reminders.d.ts +8 -0
- package/dist/commands/dunning-reminders.js +52 -5
- package/dist/commands/dunning-runs.d.ts +8 -0
- package/dist/commands/dunning-runs.js +52 -5
- package/dist/commands/email-transactions.d.ts +8 -0
- package/dist/commands/email-transactions.js +52 -5
- package/dist/commands/employees.d.ts +8 -0
- package/dist/commands/employees.js +52 -5
- package/dist/commands/entity-configurations.d.ts +8 -0
- package/dist/commands/entity-configurations.js +52 -5
- package/dist/commands/event-processor-mappings.d.ts +8 -0
- package/dist/commands/event-processor-mappings.js +52 -5
- package/dist/commands/files.d.ts +8 -0
- package/dist/commands/files.js +52 -5
- package/dist/commands/health.d.ts +8 -0
- package/dist/commands/health.js +52 -5
- package/dist/commands/imports.d.ts +8 -0
- package/dist/commands/imports.js +53 -8
- package/dist/commands/inbox.d.ts +8 -0
- package/dist/commands/inbox.js +53 -7
- package/dist/commands/integration-identities.d.ts +8 -0
- package/dist/commands/integration-identities.js +52 -5
- package/dist/commands/integrations.d.ts +8 -0
- package/dist/commands/integrations.js +52 -5
- package/dist/commands/item-categories.d.ts +8 -0
- package/dist/commands/item-categories.js +52 -5
- package/dist/commands/items.d.ts +8 -0
- package/dist/commands/items.js +52 -5
- package/dist/commands/journal-lines.d.ts +8 -0
- package/dist/commands/journal-lines.js +52 -5
- package/dist/commands/journals.d.ts +8 -0
- package/dist/commands/journals.js +52 -5
- package/dist/commands/ledgers.d.ts +8 -0
- package/dist/commands/ledgers.js +52 -5
- package/dist/commands/my-account.d.ts +8 -0
- package/dist/commands/my-account.js +52 -5
- package/dist/commands/office-locations.d.ts +8 -0
- package/dist/commands/office-locations.js +52 -5
- package/dist/commands/payment-methods.d.ts +8 -0
- package/dist/commands/payment-methods.js +52 -5
- package/dist/commands/payment-runs.d.ts +8 -0
- package/dist/commands/payment-runs.js +54 -6
- package/dist/commands/payment-terms.d.ts +8 -0
- package/dist/commands/payment-terms.js +52 -5
- package/dist/commands/payments.d.ts +8 -0
- package/dist/commands/payments.js +52 -5
- package/dist/commands/payroll-runs.d.ts +8 -0
- package/dist/commands/payroll-runs.js +52 -5
- package/dist/commands/permissions.d.ts +8 -0
- package/dist/commands/permissions.js +52 -5
- package/dist/commands/price-lists.d.ts +8 -0
- package/dist/commands/price-lists.js +52 -5
- package/dist/commands/processor-mappings.d.ts +8 -0
- package/dist/commands/processor-mappings.js +52 -5
- package/dist/commands/processors.d.ts +8 -0
- package/dist/commands/processors.js +52 -5
- package/dist/commands/purchase-order-types.d.ts +8 -0
- package/dist/commands/purchase-order-types.js +52 -5
- package/dist/commands/purchase-orders.d.ts +8 -0
- package/dist/commands/purchase-orders.js +52 -5
- package/dist/commands/reports.d.ts +8 -0
- package/dist/commands/reports.js +52 -5
- package/dist/commands/roles.d.ts +8 -0
- package/dist/commands/roles.js +52 -5
- package/dist/commands/salary-types.d.ts +8 -0
- package/dist/commands/salary-types.js +52 -5
- package/dist/commands/sales-invoices.d.ts +10 -0
- package/dist/commands/sales-invoices.js +62 -6
- package/dist/commands/sales-orders.d.ts +8 -0
- package/dist/commands/sales-orders.js +52 -5
- package/dist/commands/saved-views.d.ts +8 -0
- package/dist/commands/saved-views.js +52 -5
- package/dist/commands/scheduled-processor-mappings.d.ts +8 -0
- package/dist/commands/scheduled-processor-mappings.js +52 -5
- package/dist/commands/schedules.d.ts +8 -0
- package/dist/commands/schedules.js +52 -5
- package/dist/commands/tags.d.ts +8 -0
- package/dist/commands/tags.js +52 -5
- package/dist/commands/tax-codes.d.ts +8 -0
- package/dist/commands/tax-codes.js +52 -5
- package/dist/commands/tax-matrix.d.ts +8 -0
- package/dist/commands/tax-matrix.js +52 -5
- package/dist/commands/templates.d.ts +8 -0
- package/dist/commands/templates.js +52 -5
- package/dist/commands/tenants.d.ts +8 -0
- package/dist/commands/tenants.js +52 -5
- package/dist/commands/tools.d.ts +8 -0
- package/dist/commands/tools.js +52 -5
- package/dist/commands/users.d.ts +8 -0
- package/dist/commands/users.js +52 -5
- package/dist/commands/vat-declarations.d.ts +8 -0
- package/dist/commands/vat-declarations.js +52 -5
- package/dist/commands/vendor-invoices.d.ts +9 -0
- package/dist/commands/vendor-invoices.js +60 -8
- package/dist/commands/webhooks.d.ts +8 -0
- package/dist/commands/webhooks.js +52 -5
- package/dist/commands/workflows.d.ts +8 -0
- package/dist/commands/workflows.js +52 -5
- package/oclif.manifest.json +433 -10
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ export default class EventProcessorMappings extends Command {
|
|
|
23
23
|
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
24
|
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
25
|
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
27
|
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
};
|
|
28
29
|
run(): Promise<void>;
|
|
@@ -31,6 +32,13 @@ export default class EventProcessorMappings extends Command {
|
|
|
31
32
|
private runCamt053Import;
|
|
32
33
|
private runNestedImport;
|
|
33
34
|
private parseFilterValue;
|
|
35
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
36
|
+
private printPageSummary;
|
|
37
|
+
/**
|
|
38
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
39
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
40
|
+
*/
|
|
41
|
+
private warnShortPage;
|
|
34
42
|
private sanitizeOutput;
|
|
35
43
|
private getColumns;
|
|
36
44
|
private getValue;
|
|
@@ -44,6 +44,7 @@ export default class EventProcessorMappings extends Command {
|
|
|
44
44
|
query: Flags.string({ description: 'Additional query params as JSON' }),
|
|
45
45
|
fields: Flags.string({ description: 'Comma-separated list of fields to return, applied by the API (e.g. --fields=id,name,status)' }),
|
|
46
46
|
sanitize: Flags.boolean({ description: 'Remove null values, audit fields, and duplicate UUIDs from output' }),
|
|
47
|
+
meta: Flags.boolean({ description: 'Keep the API envelope in JSON output: data plus page, totals and sums' }),
|
|
47
48
|
'show-http-request': Flags.boolean({ description: 'Show HTTP request details (method, URL, body)' }),
|
|
48
49
|
};
|
|
49
50
|
async run() {
|
|
@@ -336,9 +337,15 @@ export default class EventProcessorMappings extends Command {
|
|
|
336
337
|
}
|
|
337
338
|
catch { /* keep as string */ }
|
|
338
339
|
}
|
|
339
|
-
//
|
|
340
|
+
// A paginated answer is { data, meta, links, totals }. The records are
|
|
341
|
+
// unwrapped for output, but what the API said about the page is kept:
|
|
342
|
+
// dropping it silently let a script read one page as the whole result
|
|
343
|
+
// (AderisERP/product#61).
|
|
344
|
+
let envelope;
|
|
340
345
|
if (output && typeof output === 'object' && !Array.isArray(output) && 'data' in output && Array.isArray(output.data)) {
|
|
341
|
-
|
|
346
|
+
const page = output;
|
|
347
|
+
envelope = page;
|
|
348
|
+
output = page.data;
|
|
342
349
|
}
|
|
343
350
|
// For table/csv on non-array responses, auto-extract the primary array
|
|
344
351
|
// e.g., { payments: [...], total: 3 } → extract payments array
|
|
@@ -355,12 +362,24 @@ export default class EventProcessorMappings extends Command {
|
|
|
355
362
|
output = this.sanitizeOutput(output);
|
|
356
363
|
}
|
|
357
364
|
const fieldList = flags.fields?.split(',').map(f => f.trim());
|
|
358
|
-
if (
|
|
365
|
+
if (envelope)
|
|
366
|
+
this.warnShortPage(envelope, flags.limit);
|
|
367
|
+
if (flags.csv || flags.output === 'csv') {
|
|
359
368
|
this.printCsv(output, fieldList);
|
|
360
|
-
|
|
369
|
+
}
|
|
370
|
+
else if (flags.table || flags.output === 'table') {
|
|
361
371
|
this.printTable(output, fieldList);
|
|
362
|
-
|
|
372
|
+
if (envelope)
|
|
373
|
+
this.printPageSummary(envelope);
|
|
374
|
+
}
|
|
375
|
+
else if (envelope && flags.meta) {
|
|
376
|
+
// The whole envelope, for a caller that asked for it; the default stays
|
|
377
|
+
// a bare array so existing scripts are unaffected.
|
|
378
|
+
this.log(JSON.stringify({ ...envelope, data: output }, null, 2));
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
363
381
|
this.log(JSON.stringify(output, null, 2));
|
|
382
|
+
}
|
|
364
383
|
}
|
|
365
384
|
catch (error) {
|
|
366
385
|
if (error instanceof ApiError) {
|
|
@@ -989,6 +1008,34 @@ export default class EventProcessorMappings extends Command {
|
|
|
989
1008
|
return `\$${op}`;
|
|
990
1009
|
return opRe.test(rest) ? `\$${op}:${this.parseFilterValue(rest)}` : `\$${op}:${rest}`;
|
|
991
1010
|
}
|
|
1011
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
1012
|
+
printPageSummary(envelope) {
|
|
1013
|
+
const meta = envelope.meta;
|
|
1014
|
+
if (meta && typeof meta.currentPage === 'number' && typeof meta.totalPages === 'number') {
|
|
1015
|
+
const shown = Array.isArray(envelope.data) ? envelope.data.length : 0;
|
|
1016
|
+
this.log(`
|
|
1017
|
+
Page ${meta.currentPage}/${meta.totalPages} — ${shown} of ${meta.totalItems ?? '?'} records`);
|
|
1018
|
+
}
|
|
1019
|
+
for (const total of envelope.totals ?? []) {
|
|
1020
|
+
const { currency, ...sums } = total;
|
|
1021
|
+
const parts = Object.entries(sums).map(([column, value]) => `${column} ${value}`).join(', ');
|
|
1022
|
+
this.log(`Total ${currency ?? ''}: ${parts}`.trim());
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
1027
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
1028
|
+
*/
|
|
1029
|
+
warnShortPage(envelope, requestedLimit) {
|
|
1030
|
+
const asked = requestedLimit === undefined ? undefined : Number(requestedLimit);
|
|
1031
|
+
const perPage = envelope.meta?.itemsPerPage;
|
|
1032
|
+
if (asked === undefined || Number.isNaN(asked) || typeof perPage !== 'number' || perPage >= asked)
|
|
1033
|
+
return;
|
|
1034
|
+
const pages = envelope.meta?.totalPages;
|
|
1035
|
+
const more = typeof pages === 'number' && pages > 1 ? ` Use --page, or the export action for every page.` : '';
|
|
1036
|
+
process.stderr.write(`! Asked for ${asked} records per page; the API returned at most ${perPage}.${more}
|
|
1037
|
+
`);
|
|
1038
|
+
}
|
|
992
1039
|
sanitizeOutput(data) {
|
|
993
1040
|
const auditFields = ['_type', 'tenantId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy'];
|
|
994
1041
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
package/dist/commands/files.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export default class Files extends Command {
|
|
|
23
23
|
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
24
|
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
25
|
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
27
|
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
};
|
|
28
29
|
run(): Promise<void>;
|
|
@@ -31,6 +32,13 @@ export default class Files extends Command {
|
|
|
31
32
|
private runCamt053Import;
|
|
32
33
|
private runNestedImport;
|
|
33
34
|
private parseFilterValue;
|
|
35
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
36
|
+
private printPageSummary;
|
|
37
|
+
/**
|
|
38
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
39
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
40
|
+
*/
|
|
41
|
+
private warnShortPage;
|
|
34
42
|
private sanitizeOutput;
|
|
35
43
|
private getColumns;
|
|
36
44
|
private getValue;
|
package/dist/commands/files.js
CHANGED
|
@@ -52,6 +52,7 @@ export default class Files extends Command {
|
|
|
52
52
|
query: Flags.string({ description: 'Additional query params as JSON' }),
|
|
53
53
|
fields: Flags.string({ description: 'Comma-separated list of fields to return, applied by the API (e.g. --fields=id,name,status)' }),
|
|
54
54
|
sanitize: Flags.boolean({ description: 'Remove null values, audit fields, and duplicate UUIDs from output' }),
|
|
55
|
+
meta: Flags.boolean({ description: 'Keep the API envelope in JSON output: data plus page, totals and sums' }),
|
|
55
56
|
'show-http-request': Flags.boolean({ description: 'Show HTTP request details (method, URL, body)' }),
|
|
56
57
|
};
|
|
57
58
|
async run() {
|
|
@@ -344,9 +345,15 @@ export default class Files extends Command {
|
|
|
344
345
|
}
|
|
345
346
|
catch { /* keep as string */ }
|
|
346
347
|
}
|
|
347
|
-
//
|
|
348
|
+
// A paginated answer is { data, meta, links, totals }. The records are
|
|
349
|
+
// unwrapped for output, but what the API said about the page is kept:
|
|
350
|
+
// dropping it silently let a script read one page as the whole result
|
|
351
|
+
// (AderisERP/product#61).
|
|
352
|
+
let envelope;
|
|
348
353
|
if (output && typeof output === 'object' && !Array.isArray(output) && 'data' in output && Array.isArray(output.data)) {
|
|
349
|
-
|
|
354
|
+
const page = output;
|
|
355
|
+
envelope = page;
|
|
356
|
+
output = page.data;
|
|
350
357
|
}
|
|
351
358
|
// For table/csv on non-array responses, auto-extract the primary array
|
|
352
359
|
// e.g., { payments: [...], total: 3 } → extract payments array
|
|
@@ -363,12 +370,24 @@ export default class Files extends Command {
|
|
|
363
370
|
output = this.sanitizeOutput(output);
|
|
364
371
|
}
|
|
365
372
|
const fieldList = flags.fields?.split(',').map(f => f.trim());
|
|
366
|
-
if (
|
|
373
|
+
if (envelope)
|
|
374
|
+
this.warnShortPage(envelope, flags.limit);
|
|
375
|
+
if (flags.csv || flags.output === 'csv') {
|
|
367
376
|
this.printCsv(output, fieldList);
|
|
368
|
-
|
|
377
|
+
}
|
|
378
|
+
else if (flags.table || flags.output === 'table') {
|
|
369
379
|
this.printTable(output, fieldList);
|
|
370
|
-
|
|
380
|
+
if (envelope)
|
|
381
|
+
this.printPageSummary(envelope);
|
|
382
|
+
}
|
|
383
|
+
else if (envelope && flags.meta) {
|
|
384
|
+
// The whole envelope, for a caller that asked for it; the default stays
|
|
385
|
+
// a bare array so existing scripts are unaffected.
|
|
386
|
+
this.log(JSON.stringify({ ...envelope, data: output }, null, 2));
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
371
389
|
this.log(JSON.stringify(output, null, 2));
|
|
390
|
+
}
|
|
372
391
|
}
|
|
373
392
|
catch (error) {
|
|
374
393
|
if (error instanceof ApiError) {
|
|
@@ -997,6 +1016,34 @@ export default class Files extends Command {
|
|
|
997
1016
|
return `\$${op}`;
|
|
998
1017
|
return opRe.test(rest) ? `\$${op}:${this.parseFilterValue(rest)}` : `\$${op}:${rest}`;
|
|
999
1018
|
}
|
|
1019
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
1020
|
+
printPageSummary(envelope) {
|
|
1021
|
+
const meta = envelope.meta;
|
|
1022
|
+
if (meta && typeof meta.currentPage === 'number' && typeof meta.totalPages === 'number') {
|
|
1023
|
+
const shown = Array.isArray(envelope.data) ? envelope.data.length : 0;
|
|
1024
|
+
this.log(`
|
|
1025
|
+
Page ${meta.currentPage}/${meta.totalPages} — ${shown} of ${meta.totalItems ?? '?'} records`);
|
|
1026
|
+
}
|
|
1027
|
+
for (const total of envelope.totals ?? []) {
|
|
1028
|
+
const { currency, ...sums } = total;
|
|
1029
|
+
const parts = Object.entries(sums).map(([column, value]) => `${column} ${value}`).join(', ');
|
|
1030
|
+
this.log(`Total ${currency ?? ''}: ${parts}`.trim());
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
1035
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
1036
|
+
*/
|
|
1037
|
+
warnShortPage(envelope, requestedLimit) {
|
|
1038
|
+
const asked = requestedLimit === undefined ? undefined : Number(requestedLimit);
|
|
1039
|
+
const perPage = envelope.meta?.itemsPerPage;
|
|
1040
|
+
if (asked === undefined || Number.isNaN(asked) || typeof perPage !== 'number' || perPage >= asked)
|
|
1041
|
+
return;
|
|
1042
|
+
const pages = envelope.meta?.totalPages;
|
|
1043
|
+
const more = typeof pages === 'number' && pages > 1 ? ` Use --page, or the export action for every page.` : '';
|
|
1044
|
+
process.stderr.write(`! Asked for ${asked} records per page; the API returned at most ${perPage}.${more}
|
|
1045
|
+
`);
|
|
1046
|
+
}
|
|
1000
1047
|
sanitizeOutput(data) {
|
|
1001
1048
|
const auditFields = ['_type', 'tenantId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy'];
|
|
1002
1049
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -23,6 +23,7 @@ export default class Health extends Command {
|
|
|
23
23
|
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
24
|
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
25
|
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
27
|
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
};
|
|
28
29
|
run(): Promise<void>;
|
|
@@ -31,6 +32,13 @@ export default class Health extends Command {
|
|
|
31
32
|
private runCamt053Import;
|
|
32
33
|
private runNestedImport;
|
|
33
34
|
private parseFilterValue;
|
|
35
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
36
|
+
private printPageSummary;
|
|
37
|
+
/**
|
|
38
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
39
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
40
|
+
*/
|
|
41
|
+
private warnShortPage;
|
|
34
42
|
private sanitizeOutput;
|
|
35
43
|
private getColumns;
|
|
36
44
|
private getValue;
|
package/dist/commands/health.js
CHANGED
|
@@ -40,6 +40,7 @@ export default class Health extends Command {
|
|
|
40
40
|
query: Flags.string({ description: 'Additional query params as JSON' }),
|
|
41
41
|
fields: Flags.string({ description: 'Comma-separated list of fields to return, applied by the API (e.g. --fields=id,name,status)' }),
|
|
42
42
|
sanitize: Flags.boolean({ description: 'Remove null values, audit fields, and duplicate UUIDs from output' }),
|
|
43
|
+
meta: Flags.boolean({ description: 'Keep the API envelope in JSON output: data plus page, totals and sums' }),
|
|
43
44
|
'show-http-request': Flags.boolean({ description: 'Show HTTP request details (method, URL, body)' }),
|
|
44
45
|
};
|
|
45
46
|
async run() {
|
|
@@ -332,9 +333,15 @@ export default class Health extends Command {
|
|
|
332
333
|
}
|
|
333
334
|
catch { /* keep as string */ }
|
|
334
335
|
}
|
|
335
|
-
//
|
|
336
|
+
// A paginated answer is { data, meta, links, totals }. The records are
|
|
337
|
+
// unwrapped for output, but what the API said about the page is kept:
|
|
338
|
+
// dropping it silently let a script read one page as the whole result
|
|
339
|
+
// (AderisERP/product#61).
|
|
340
|
+
let envelope;
|
|
336
341
|
if (output && typeof output === 'object' && !Array.isArray(output) && 'data' in output && Array.isArray(output.data)) {
|
|
337
|
-
|
|
342
|
+
const page = output;
|
|
343
|
+
envelope = page;
|
|
344
|
+
output = page.data;
|
|
338
345
|
}
|
|
339
346
|
// For table/csv on non-array responses, auto-extract the primary array
|
|
340
347
|
// e.g., { payments: [...], total: 3 } → extract payments array
|
|
@@ -351,12 +358,24 @@ export default class Health extends Command {
|
|
|
351
358
|
output = this.sanitizeOutput(output);
|
|
352
359
|
}
|
|
353
360
|
const fieldList = flags.fields?.split(',').map(f => f.trim());
|
|
354
|
-
if (
|
|
361
|
+
if (envelope)
|
|
362
|
+
this.warnShortPage(envelope, flags.limit);
|
|
363
|
+
if (flags.csv || flags.output === 'csv') {
|
|
355
364
|
this.printCsv(output, fieldList);
|
|
356
|
-
|
|
365
|
+
}
|
|
366
|
+
else if (flags.table || flags.output === 'table') {
|
|
357
367
|
this.printTable(output, fieldList);
|
|
358
|
-
|
|
368
|
+
if (envelope)
|
|
369
|
+
this.printPageSummary(envelope);
|
|
370
|
+
}
|
|
371
|
+
else if (envelope && flags.meta) {
|
|
372
|
+
// The whole envelope, for a caller that asked for it; the default stays
|
|
373
|
+
// a bare array so existing scripts are unaffected.
|
|
374
|
+
this.log(JSON.stringify({ ...envelope, data: output }, null, 2));
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
359
377
|
this.log(JSON.stringify(output, null, 2));
|
|
378
|
+
}
|
|
360
379
|
}
|
|
361
380
|
catch (error) {
|
|
362
381
|
if (error instanceof ApiError) {
|
|
@@ -985,6 +1004,34 @@ export default class Health extends Command {
|
|
|
985
1004
|
return `\$${op}`;
|
|
986
1005
|
return opRe.test(rest) ? `\$${op}:${this.parseFilterValue(rest)}` : `\$${op}:${rest}`;
|
|
987
1006
|
}
|
|
1007
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
1008
|
+
printPageSummary(envelope) {
|
|
1009
|
+
const meta = envelope.meta;
|
|
1010
|
+
if (meta && typeof meta.currentPage === 'number' && typeof meta.totalPages === 'number') {
|
|
1011
|
+
const shown = Array.isArray(envelope.data) ? envelope.data.length : 0;
|
|
1012
|
+
this.log(`
|
|
1013
|
+
Page ${meta.currentPage}/${meta.totalPages} — ${shown} of ${meta.totalItems ?? '?'} records`);
|
|
1014
|
+
}
|
|
1015
|
+
for (const total of envelope.totals ?? []) {
|
|
1016
|
+
const { currency, ...sums } = total;
|
|
1017
|
+
const parts = Object.entries(sums).map(([column, value]) => `${column} ${value}`).join(', ');
|
|
1018
|
+
this.log(`Total ${currency ?? ''}: ${parts}`.trim());
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
1023
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
1024
|
+
*/
|
|
1025
|
+
warnShortPage(envelope, requestedLimit) {
|
|
1026
|
+
const asked = requestedLimit === undefined ? undefined : Number(requestedLimit);
|
|
1027
|
+
const perPage = envelope.meta?.itemsPerPage;
|
|
1028
|
+
if (asked === undefined || Number.isNaN(asked) || typeof perPage !== 'number' || perPage >= asked)
|
|
1029
|
+
return;
|
|
1030
|
+
const pages = envelope.meta?.totalPages;
|
|
1031
|
+
const more = typeof pages === 'number' && pages > 1 ? ` Use --page, or the export action for every page.` : '';
|
|
1032
|
+
process.stderr.write(`! Asked for ${asked} records per page; the API returned at most ${perPage}.${more}
|
|
1033
|
+
`);
|
|
1034
|
+
}
|
|
988
1035
|
sanitizeOutput(data) {
|
|
989
1036
|
const auditFields = ['_type', 'tenantId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy'];
|
|
990
1037
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -23,6 +23,7 @@ export default class Imports extends Command {
|
|
|
23
23
|
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
24
|
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
25
|
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
27
|
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
};
|
|
28
29
|
run(): Promise<void>;
|
|
@@ -31,6 +32,13 @@ export default class Imports extends Command {
|
|
|
31
32
|
private runCamt053Import;
|
|
32
33
|
private runNestedImport;
|
|
33
34
|
private parseFilterValue;
|
|
35
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
36
|
+
private printPageSummary;
|
|
37
|
+
/**
|
|
38
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
39
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
40
|
+
*/
|
|
41
|
+
private warnShortPage;
|
|
34
42
|
private sanitizeOutput;
|
|
35
43
|
private getColumns;
|
|
36
44
|
private getValue;
|
package/dist/commands/imports.js
CHANGED
|
@@ -6,10 +6,9 @@ const HAS_IMPORT = false;
|
|
|
6
6
|
const HAS_EXPORT = true;
|
|
7
7
|
const HAS_CAMT053 = false;
|
|
8
8
|
const NESTED_IMPORTS = [];
|
|
9
|
-
const SUBCOMMANDS = [...["list", "
|
|
9
|
+
const SUBCOMMANDS = [...["list", "get", "delete"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
10
10
|
const ENDPOINTS = {
|
|
11
11
|
'list': { method: 'GET', path: '/v1/imports', summary: 'List the tenant\'s import runs', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
12
|
-
'create': { method: 'POST', path: '/v1/imports', summary: 'Import records of one resource type', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
13
12
|
'get': { method: 'GET', path: '/v1/imports/{id}', summary: 'Read one import run back', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
14
13
|
'delete': { method: 'DELETE', path: '/v1/imports/{id}', summary: 'Throw one import run away', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
15
14
|
};
|
|
@@ -18,7 +17,6 @@ export default class Imports extends Command {
|
|
|
18
17
|
static examples = [
|
|
19
18
|
'<%= config.bin %> imports list',
|
|
20
19
|
'<%= config.bin %> imports get <id>',
|
|
21
|
-
'<%= config.bin %> imports create --data \'{...}\'',
|
|
22
20
|
'<%= config.bin %> imports export --csv > imports.csv',
|
|
23
21
|
];
|
|
24
22
|
static args = {
|
|
@@ -42,6 +40,7 @@ export default class Imports extends Command {
|
|
|
42
40
|
query: Flags.string({ description: 'Additional query params as JSON' }),
|
|
43
41
|
fields: Flags.string({ description: 'Comma-separated list of fields to return, applied by the API (e.g. --fields=id,name,status)' }),
|
|
44
42
|
sanitize: Flags.boolean({ description: 'Remove null values, audit fields, and duplicate UUIDs from output' }),
|
|
43
|
+
meta: Flags.boolean({ description: 'Keep the API envelope in JSON output: data plus page, totals and sums' }),
|
|
45
44
|
'show-http-request': Flags.boolean({ description: 'Show HTTP request details (method, URL, body)' }),
|
|
46
45
|
};
|
|
47
46
|
async run() {
|
|
@@ -334,9 +333,15 @@ export default class Imports extends Command {
|
|
|
334
333
|
}
|
|
335
334
|
catch { /* keep as string */ }
|
|
336
335
|
}
|
|
337
|
-
//
|
|
336
|
+
// A paginated answer is { data, meta, links, totals }. The records are
|
|
337
|
+
// unwrapped for output, but what the API said about the page is kept:
|
|
338
|
+
// dropping it silently let a script read one page as the whole result
|
|
339
|
+
// (AderisERP/product#61).
|
|
340
|
+
let envelope;
|
|
338
341
|
if (output && typeof output === 'object' && !Array.isArray(output) && 'data' in output && Array.isArray(output.data)) {
|
|
339
|
-
|
|
342
|
+
const page = output;
|
|
343
|
+
envelope = page;
|
|
344
|
+
output = page.data;
|
|
340
345
|
}
|
|
341
346
|
// For table/csv on non-array responses, auto-extract the primary array
|
|
342
347
|
// e.g., { payments: [...], total: 3 } → extract payments array
|
|
@@ -353,12 +358,24 @@ export default class Imports extends Command {
|
|
|
353
358
|
output = this.sanitizeOutput(output);
|
|
354
359
|
}
|
|
355
360
|
const fieldList = flags.fields?.split(',').map(f => f.trim());
|
|
356
|
-
if (
|
|
361
|
+
if (envelope)
|
|
362
|
+
this.warnShortPage(envelope, flags.limit);
|
|
363
|
+
if (flags.csv || flags.output === 'csv') {
|
|
357
364
|
this.printCsv(output, fieldList);
|
|
358
|
-
|
|
365
|
+
}
|
|
366
|
+
else if (flags.table || flags.output === 'table') {
|
|
359
367
|
this.printTable(output, fieldList);
|
|
360
|
-
|
|
368
|
+
if (envelope)
|
|
369
|
+
this.printPageSummary(envelope);
|
|
370
|
+
}
|
|
371
|
+
else if (envelope && flags.meta) {
|
|
372
|
+
// The whole envelope, for a caller that asked for it; the default stays
|
|
373
|
+
// a bare array so existing scripts are unaffected.
|
|
374
|
+
this.log(JSON.stringify({ ...envelope, data: output }, null, 2));
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
361
377
|
this.log(JSON.stringify(output, null, 2));
|
|
378
|
+
}
|
|
362
379
|
}
|
|
363
380
|
catch (error) {
|
|
364
381
|
if (error instanceof ApiError) {
|
|
@@ -987,6 +1004,34 @@ export default class Imports extends Command {
|
|
|
987
1004
|
return `\$${op}`;
|
|
988
1005
|
return opRe.test(rest) ? `\$${op}:${this.parseFilterValue(rest)}` : `\$${op}:${rest}`;
|
|
989
1006
|
}
|
|
1007
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
1008
|
+
printPageSummary(envelope) {
|
|
1009
|
+
const meta = envelope.meta;
|
|
1010
|
+
if (meta && typeof meta.currentPage === 'number' && typeof meta.totalPages === 'number') {
|
|
1011
|
+
const shown = Array.isArray(envelope.data) ? envelope.data.length : 0;
|
|
1012
|
+
this.log(`
|
|
1013
|
+
Page ${meta.currentPage}/${meta.totalPages} — ${shown} of ${meta.totalItems ?? '?'} records`);
|
|
1014
|
+
}
|
|
1015
|
+
for (const total of envelope.totals ?? []) {
|
|
1016
|
+
const { currency, ...sums } = total;
|
|
1017
|
+
const parts = Object.entries(sums).map(([column, value]) => `${column} ${value}`).join(', ');
|
|
1018
|
+
this.log(`Total ${currency ?? ''}: ${parts}`.trim());
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
1023
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
1024
|
+
*/
|
|
1025
|
+
warnShortPage(envelope, requestedLimit) {
|
|
1026
|
+
const asked = requestedLimit === undefined ? undefined : Number(requestedLimit);
|
|
1027
|
+
const perPage = envelope.meta?.itemsPerPage;
|
|
1028
|
+
if (asked === undefined || Number.isNaN(asked) || typeof perPage !== 'number' || perPage >= asked)
|
|
1029
|
+
return;
|
|
1030
|
+
const pages = envelope.meta?.totalPages;
|
|
1031
|
+
const more = typeof pages === 'number' && pages > 1 ? ` Use --page, or the export action for every page.` : '';
|
|
1032
|
+
process.stderr.write(`! Asked for ${asked} records per page; the API returned at most ${perPage}.${more}
|
|
1033
|
+
`);
|
|
1034
|
+
}
|
|
990
1035
|
sanitizeOutput(data) {
|
|
991
1036
|
const auditFields = ['_type', 'tenantId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy'];
|
|
992
1037
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
package/dist/commands/inbox.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export default class Inbox extends Command {
|
|
|
24
24
|
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
25
|
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
26
|
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
29
|
};
|
|
29
30
|
run(): Promise<void>;
|
|
@@ -32,6 +33,13 @@ export default class Inbox extends Command {
|
|
|
32
33
|
private runCamt053Import;
|
|
33
34
|
private runNestedImport;
|
|
34
35
|
private parseFilterValue;
|
|
36
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
37
|
+
private printPageSummary;
|
|
38
|
+
/**
|
|
39
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
40
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
41
|
+
*/
|
|
42
|
+
private warnShortPage;
|
|
35
43
|
private sanitizeOutput;
|
|
36
44
|
private getColumns;
|
|
37
45
|
private getValue;
|
package/dist/commands/inbox.js
CHANGED
|
@@ -6,13 +6,12 @@ const HAS_IMPORT = false;
|
|
|
6
6
|
const HAS_EXPORT = false;
|
|
7
7
|
const HAS_CAMT053 = false;
|
|
8
8
|
const NESTED_IMPORTS = [];
|
|
9
|
-
const SUBCOMMANDS = [...["create-upload", "email-webhook", "document-types", "uploads-files-content", "
|
|
9
|
+
const SUBCOMMANDS = [...["create-upload", "email-webhook", "document-types", "uploads-files-content", "list-processing-logs", "processing-logs"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
10
10
|
const ENDPOINTS = {
|
|
11
11
|
'create-upload': { method: 'POST', path: '/v1/inbox/upload', summary: 'Upload document(s) to inbox for processing', pathParams: [], hasBody: false, isMultipart: true, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
12
12
|
'email-webhook': { method: 'POST', path: '/v1/inbox/email-webhook/{secret}', summary: 'Email webhook for document ingestion (SendGrid inbound-parse)', pathParams: ['secret'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
13
13
|
'document-types': { method: 'GET', path: '/v1/inbox/document-types', summary: 'Get available document types and per-parent allowed types', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
14
14
|
'uploads-files-content': { method: 'GET', path: '/v1/inbox/uploads/{processingId}/files/{fileId}/content', summary: 'Stream the original bytes of an uploaded inbox file', pathParams: ['fileId', 'processingId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
15
|
-
'import': { method: 'POST', path: '/v1/inbox/import', summary: 'Import a provider-identified document into the inbox, refusing duplicates', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
16
15
|
'list-processing-logs': { method: 'GET', path: '/v1/inbox/processing-logs', summary: 'List recent inbox processing logs (newest first)', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
17
16
|
'processing-logs': { method: 'GET', path: '/v1/inbox/processing-logs/{processingId}', summary: 'Get a processing run by its processing identifier', pathParams: ['processingId'], hasBody: false, isMultipart: false, isBinaryResponse: false, hasBinaryVariant: false, bodyArrayFields: [] },
|
|
18
17
|
};
|
|
@@ -41,6 +40,7 @@ export default class Inbox extends Command {
|
|
|
41
40
|
query: Flags.string({ description: 'Additional query params as JSON' }),
|
|
42
41
|
fields: Flags.string({ description: 'Comma-separated list of fields to return, applied by the API (e.g. --fields=id,name,status)' }),
|
|
43
42
|
sanitize: Flags.boolean({ description: 'Remove null values, audit fields, and duplicate UUIDs from output' }),
|
|
43
|
+
meta: Flags.boolean({ description: 'Keep the API envelope in JSON output: data plus page, totals and sums' }),
|
|
44
44
|
'show-http-request': Flags.boolean({ description: 'Show HTTP request details (method, URL, body)' }),
|
|
45
45
|
};
|
|
46
46
|
async run() {
|
|
@@ -333,9 +333,15 @@ export default class Inbox extends Command {
|
|
|
333
333
|
}
|
|
334
334
|
catch { /* keep as string */ }
|
|
335
335
|
}
|
|
336
|
-
//
|
|
336
|
+
// A paginated answer is { data, meta, links, totals }. The records are
|
|
337
|
+
// unwrapped for output, but what the API said about the page is kept:
|
|
338
|
+
// dropping it silently let a script read one page as the whole result
|
|
339
|
+
// (AderisERP/product#61).
|
|
340
|
+
let envelope;
|
|
337
341
|
if (output && typeof output === 'object' && !Array.isArray(output) && 'data' in output && Array.isArray(output.data)) {
|
|
338
|
-
|
|
342
|
+
const page = output;
|
|
343
|
+
envelope = page;
|
|
344
|
+
output = page.data;
|
|
339
345
|
}
|
|
340
346
|
// For table/csv on non-array responses, auto-extract the primary array
|
|
341
347
|
// e.g., { payments: [...], total: 3 } → extract payments array
|
|
@@ -352,12 +358,24 @@ export default class Inbox extends Command {
|
|
|
352
358
|
output = this.sanitizeOutput(output);
|
|
353
359
|
}
|
|
354
360
|
const fieldList = flags.fields?.split(',').map(f => f.trim());
|
|
355
|
-
if (
|
|
361
|
+
if (envelope)
|
|
362
|
+
this.warnShortPage(envelope, flags.limit);
|
|
363
|
+
if (flags.csv || flags.output === 'csv') {
|
|
356
364
|
this.printCsv(output, fieldList);
|
|
357
|
-
|
|
365
|
+
}
|
|
366
|
+
else if (flags.table || flags.output === 'table') {
|
|
358
367
|
this.printTable(output, fieldList);
|
|
359
|
-
|
|
368
|
+
if (envelope)
|
|
369
|
+
this.printPageSummary(envelope);
|
|
370
|
+
}
|
|
371
|
+
else if (envelope && flags.meta) {
|
|
372
|
+
// The whole envelope, for a caller that asked for it; the default stays
|
|
373
|
+
// a bare array so existing scripts are unaffected.
|
|
374
|
+
this.log(JSON.stringify({ ...envelope, data: output }, null, 2));
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
360
377
|
this.log(JSON.stringify(output, null, 2));
|
|
378
|
+
}
|
|
361
379
|
}
|
|
362
380
|
catch (error) {
|
|
363
381
|
if (error instanceof ApiError) {
|
|
@@ -986,6 +1004,34 @@ export default class Inbox extends Command {
|
|
|
986
1004
|
return `\$${op}`;
|
|
987
1005
|
return opRe.test(rest) ? `\$${op}:${this.parseFilterValue(rest)}` : `\$${op}:${rest}`;
|
|
988
1006
|
}
|
|
1007
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
1008
|
+
printPageSummary(envelope) {
|
|
1009
|
+
const meta = envelope.meta;
|
|
1010
|
+
if (meta && typeof meta.currentPage === 'number' && typeof meta.totalPages === 'number') {
|
|
1011
|
+
const shown = Array.isArray(envelope.data) ? envelope.data.length : 0;
|
|
1012
|
+
this.log(`
|
|
1013
|
+
Page ${meta.currentPage}/${meta.totalPages} — ${shown} of ${meta.totalItems ?? '?'} records`);
|
|
1014
|
+
}
|
|
1015
|
+
for (const total of envelope.totals ?? []) {
|
|
1016
|
+
const { currency, ...sums } = total;
|
|
1017
|
+
const parts = Object.entries(sums).map(([column, value]) => `${column} ${value}`).join(', ');
|
|
1018
|
+
this.log(`Total ${currency ?? ''}: ${parts}`.trim());
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
1023
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
1024
|
+
*/
|
|
1025
|
+
warnShortPage(envelope, requestedLimit) {
|
|
1026
|
+
const asked = requestedLimit === undefined ? undefined : Number(requestedLimit);
|
|
1027
|
+
const perPage = envelope.meta?.itemsPerPage;
|
|
1028
|
+
if (asked === undefined || Number.isNaN(asked) || typeof perPage !== 'number' || perPage >= asked)
|
|
1029
|
+
return;
|
|
1030
|
+
const pages = envelope.meta?.totalPages;
|
|
1031
|
+
const more = typeof pages === 'number' && pages > 1 ? ` Use --page, or the export action for every page.` : '';
|
|
1032
|
+
process.stderr.write(`! Asked for ${asked} records per page; the API returned at most ${perPage}.${more}
|
|
1033
|
+
`);
|
|
1034
|
+
}
|
|
989
1035
|
sanitizeOutput(data) {
|
|
990
1036
|
const auditFields = ['_type', 'tenantId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy'];
|
|
991
1037
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -24,6 +24,7 @@ export default class IntegrationIdentities extends Command {
|
|
|
24
24
|
query: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
25
|
fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
26
|
sanitize: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
meta: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
29
|
};
|
|
29
30
|
run(): Promise<void>;
|
|
@@ -32,6 +33,13 @@ export default class IntegrationIdentities extends Command {
|
|
|
32
33
|
private runCamt053Import;
|
|
33
34
|
private runNestedImport;
|
|
34
35
|
private parseFilterValue;
|
|
36
|
+
/** The page line under a table: which page, how many, and any sums the API returned. */
|
|
37
|
+
private printPageSummary;
|
|
38
|
+
/**
|
|
39
|
+
* The API caps how many records a page may hold. Asking for more and getting
|
|
40
|
+
* fewer looks like "that is everything" unless it is said out loud.
|
|
41
|
+
*/
|
|
42
|
+
private warnShortPage;
|
|
35
43
|
private sanitizeOutput;
|
|
36
44
|
private getColumns;
|
|
37
45
|
private getValue;
|