@aderis-erp/cli 1.0.10 → 1.0.11
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/access-groups.js +178 -86
- package/dist/commands/account-transaction-allocations.js +178 -86
- package/dist/commands/account-transactions.js +181 -87
- package/dist/commands/accounts.js +178 -86
- package/dist/commands/agent-runs.d.ts +1 -0
- package/dist/commands/agent-runs.js +183 -87
- package/dist/commands/audit-log.js +178 -86
- package/dist/commands/auth/login.js +4 -3
- package/dist/commands/bank-accounts.js +178 -86
- package/dist/commands/bank-integrations.js +178 -86
- package/dist/commands/business-partners.js +178 -86
- package/dist/commands/config/add.js +4 -3
- package/dist/commands/credit-card-accounts.js +178 -86
- package/dist/commands/documents.js +178 -86
- package/dist/commands/dunning-configs.js +180 -88
- package/dist/commands/dunning-reminders.js +178 -86
- package/dist/commands/dunning-runs.js +178 -86
- package/dist/commands/employees.js +180 -88
- package/dist/commands/entity-configurations.d.ts +40 -0
- package/dist/commands/entity-configurations.js +1169 -0
- package/dist/commands/event-processor-mappings.js +178 -86
- package/dist/commands/files-internal.js +178 -86
- package/dist/commands/health.js +178 -86
- package/dist/commands/inbox.js +181 -89
- package/dist/commands/integrations.js +178 -86
- package/dist/commands/item-categories.js +178 -86
- package/dist/commands/items.js +178 -86
- package/dist/commands/journal-lines.js +178 -86
- package/dist/commands/journals.js +178 -86
- package/dist/commands/ledgers.js +178 -86
- package/dist/commands/office-locations.js +178 -86
- package/dist/commands/payment-methods.js +178 -86
- package/dist/commands/payment-runs.js +178 -86
- package/dist/commands/payment-terms.js +178 -86
- package/dist/commands/price-lists.js +178 -86
- package/dist/commands/processor-mappings.js +178 -86
- package/dist/commands/processors.js +181 -87
- package/dist/commands/purchase-order-types.d.ts +40 -0
- package/dist/commands/purchase-order-types.js +1178 -0
- package/dist/commands/purchase-orders.d.ts +40 -0
- package/dist/commands/purchase-orders.js +1182 -0
- package/dist/commands/reports.js +178 -86
- package/dist/commands/salary-types.js +178 -86
- package/dist/commands/sales-invoices.js +178 -86
- package/dist/commands/sales-orders.js +182 -89
- package/dist/commands/saved-views.js +178 -86
- package/dist/commands/tags.js +178 -86
- package/dist/commands/tax-codes.js +178 -86
- package/dist/commands/tax-matrix.js +178 -86
- package/dist/commands/tenants.js +178 -86
- package/dist/commands/text-templates.js +178 -86
- package/dist/commands/tools.js +178 -86
- package/dist/commands/vat-declarations.d.ts +1 -0
- package/dist/commands/vat-declarations.js +188 -89
- package/dist/commands/vendor-invoices.js +178 -86
- package/dist/commands/webhooks.js +178 -86
- package/dist/commands/workflows.js +178 -86
- package/dist/lib/auth.js +2 -2
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +5 -0
- package/oclif.manifest.json +516 -9
- package/package.json +1 -1
|
@@ -9,9 +9,9 @@ const NESTED_IMPORTS = ["salaries", "payments", "notes", "files", "salary-paymen
|
|
|
9
9
|
const SUBCOMMANDS = [...["list", "create", "get", "update", "delete", "get-salaries", "create-salaries", "get-salaries-salaryId", "update-salaries", "delete-salaries", "get-payments", "create-payments", "get-payments-paymentId", "update-payments", "delete-payments", "list-notes", "create-notes", "get-notes", "update-notes", "delete-notes", "list-files", "create-files", "get-files", "update-files", "delete-files", "files-download", "list-salary-payment-files", "create-salary-payment-files", "get-salary-payment-files", "update-salary-payment-files", "delete-salary-payment-files", "download-salary-payment-files"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
10
10
|
const ENDPOINTS = {
|
|
11
11
|
'list': { method: 'GET', path: '/v1/employees', summary: 'Get all employees with pagination', pathParams: [], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
12
|
-
'create': { method: 'POST', path: '/v1/employees', summary: 'Create a new employee', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['children', 'salaries', 'files', 'notes'] },
|
|
12
|
+
'create': { method: 'POST', path: '/v1/employees', summary: 'Create a new employee', pathParams: [], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['beneficiaries', 'children', 'salaries', 'files', 'notes'] },
|
|
13
13
|
'get': { method: 'GET', path: '/v1/employees/{id}', summary: 'Get an employee by ID', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
14
|
-
'update': { method: 'PATCH', path: '/v1/employees/{id}', summary: 'Update an employee', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['children', 'salaries', 'files', 'notes'] },
|
|
14
|
+
'update': { method: 'PATCH', path: '/v1/employees/{id}', summary: 'Update an employee', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: ['beneficiaries', 'children', 'salaries', 'files', 'notes'] },
|
|
15
15
|
'delete': { method: 'DELETE', path: '/v1/employees/{id}', summary: 'Delete an employee', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
16
16
|
'get-salaries': { method: 'GET', path: '/v1/employees/{id}/salaries', summary: 'Get all salaries for an employee', pathParams: ['id'], hasBody: false, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
17
17
|
'create-salaries': { method: 'POST', path: '/v1/employees/{id}/salaries', summary: 'Add a salary configuration to an employee', pathParams: ['id'], hasBody: true, isMultipart: false, isBinaryResponse: false, bodyArrayFields: [] },
|
|
@@ -462,76 +462,126 @@ export default class Employees extends Command {
|
|
|
462
462
|
return '';
|
|
463
463
|
};
|
|
464
464
|
const results = [];
|
|
465
|
-
|
|
465
|
+
// Stream output row-by-row so progress is visible during long imports.
|
|
466
|
+
// Pre-compute the identifier column width from the input items so the
|
|
467
|
+
// table stays aligned without buffering all rows.
|
|
468
|
+
// When stdout is piped (IDE terminals, tee, CI), Node switches to async-buffered
|
|
469
|
+
// mode and rows accumulate in the pipe buffer until it fills. Force blocking
|
|
470
|
+
// mode so each \n-terminated write flushes immediately.
|
|
471
|
+
const stdoutHandle = process.stdout._handle;
|
|
472
|
+
if (stdoutHandle?.setBlocking)
|
|
473
|
+
stdoutHandle.setBlocking(true);
|
|
474
|
+
const outputFormat = flags.output || 'table';
|
|
475
|
+
const useCsv = outputFormat === 'csv' || Boolean(flags.csv);
|
|
476
|
+
const useJson = outputFormat === 'json';
|
|
477
|
+
const statusWidth = 8;
|
|
478
|
+
const identifierWidth = Math.max(10, ...items.map(i => getItemIdentifier(i).length));
|
|
479
|
+
if (useCsv) {
|
|
480
|
+
this.log('status,identifier,id,error');
|
|
481
|
+
}
|
|
482
|
+
else if (!useJson) {
|
|
483
|
+
this.log(`${'status'.padEnd(statusWidth)} ${'identifier'.padEnd(identifierWidth)} error`);
|
|
484
|
+
this.log(`${'-'.repeat(statusWidth)} ${'-'.repeat(identifierWidth)} ${'-'.repeat(50)}`);
|
|
485
|
+
}
|
|
486
|
+
const emitRow = (r) => {
|
|
487
|
+
if (useJson)
|
|
488
|
+
return;
|
|
489
|
+
if (useCsv) {
|
|
490
|
+
const err = (r.error || '').replace(/"/g, '""');
|
|
491
|
+
this.log(`${r.status},${r.identifier || ''},${r.id || ''},"${err}"`);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
this.log(`${r.status.padEnd(statusWidth)} ${(r.identifier || '').padEnd(identifierWidth)} ${r.error || ''}`);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
// Server-managed fields the API rejects in create/update bodies. Stripped
|
|
498
|
+
// before every request so re-importing a previously-exported payload Just Works.
|
|
499
|
+
const STRIP_FIELDS = new Set(['id', '_type', 'tenantId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy']);
|
|
500
|
+
const stripServerFields = (item) => {
|
|
501
|
+
const out = {};
|
|
502
|
+
for (const [k, v] of Object.entries(item)) {
|
|
503
|
+
if (!STRIP_FIELDS.has(k))
|
|
504
|
+
out[k] = v;
|
|
505
|
+
}
|
|
506
|
+
return out;
|
|
507
|
+
};
|
|
508
|
+
const processItem = async (item) => {
|
|
466
509
|
const identifier = getItemIdentifier(item);
|
|
510
|
+
const body = stripServerFields(item);
|
|
511
|
+
// If the payload carries an id (e.g. re-importing an export), PATCH directly.
|
|
512
|
+
// Fall through to POST only on 404 (so a missing record still gets created).
|
|
513
|
+
const itemId = typeof item.id === 'string' ? item.id : undefined;
|
|
514
|
+
if (itemId) {
|
|
515
|
+
try {
|
|
516
|
+
const updatePath = updateEndpoint.path.replace('{id}', itemId);
|
|
517
|
+
await apiRequest('PATCH', updatePath, {
|
|
518
|
+
data: body,
|
|
519
|
+
contextName: flags.context,
|
|
520
|
+
});
|
|
521
|
+
return { status: 'updated', id: itemId, identifier };
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
if (!(error instanceof ApiError && error.status === 404)) {
|
|
525
|
+
const msg = error instanceof ApiError ? `(${error.status}) ${error.message}` : String(error);
|
|
526
|
+
return { status: 'error', id: itemId, identifier, error: msg };
|
|
527
|
+
}
|
|
528
|
+
// 404 → record gone, try create below
|
|
529
|
+
}
|
|
530
|
+
}
|
|
467
531
|
try {
|
|
468
|
-
// Try to create
|
|
469
532
|
const response = await apiRequest('POST', createEndpoint.path, {
|
|
470
|
-
data:
|
|
533
|
+
data: body,
|
|
471
534
|
contextName: flags.context,
|
|
472
535
|
});
|
|
473
536
|
const id = response.data?.id;
|
|
474
|
-
|
|
537
|
+
return { status: 'created', id: id ? String(id) : undefined, identifier };
|
|
475
538
|
}
|
|
476
539
|
catch (error) {
|
|
477
540
|
if (error instanceof ApiError && error.status === 409) {
|
|
478
|
-
// Conflict - try to update existing
|
|
479
541
|
const errorData = error.data;
|
|
480
542
|
const existingId = errorData?.existingId;
|
|
481
543
|
if (existingId) {
|
|
482
544
|
try {
|
|
483
545
|
const updatePath = updateEndpoint.path.replace('{id}', existingId);
|
|
484
546
|
await apiRequest('PATCH', updatePath, {
|
|
485
|
-
data:
|
|
547
|
+
data: body,
|
|
486
548
|
contextName: flags.context,
|
|
487
549
|
});
|
|
488
|
-
|
|
550
|
+
return { status: 'updated', id: existingId, identifier };
|
|
489
551
|
}
|
|
490
552
|
catch (updateError) {
|
|
491
553
|
const msg = updateError instanceof ApiError ? updateError.message : String(updateError);
|
|
492
|
-
|
|
554
|
+
return { status: 'error', id: existingId, identifier, error: `Update failed: ${msg}` };
|
|
493
555
|
}
|
|
494
556
|
}
|
|
495
|
-
|
|
496
|
-
results.push({ status: 'error', identifier, error: 'Conflict but no existingId returned' });
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
const msg = error instanceof ApiError ? `(${error.status}) ${error.message}` : String(error);
|
|
501
|
-
results.push({ status: 'error', identifier, error: msg });
|
|
557
|
+
return { status: 'error', identifier, error: 'Conflict but no existingId returned' };
|
|
502
558
|
}
|
|
559
|
+
const msg = error instanceof ApiError ? `(${error.status}) ${error.message}` : String(error);
|
|
560
|
+
return { status: 'error', identifier, error: msg };
|
|
503
561
|
}
|
|
504
|
-
}
|
|
562
|
+
};
|
|
563
|
+
// Worker pool: keep N requests in flight at all times. Rows are emitted as
|
|
564
|
+
// each request resolves (so output order may differ from input order). The
|
|
565
|
+
// summary at the end remains accurate regardless.
|
|
566
|
+
const concurrency = 4;
|
|
567
|
+
const queue = [...items];
|
|
568
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, queue.length) }, async () => {
|
|
569
|
+
for (;;) {
|
|
570
|
+
const item = queue.shift();
|
|
571
|
+
if (!item)
|
|
572
|
+
return;
|
|
573
|
+
const r = await processItem(item);
|
|
574
|
+
results.push(r);
|
|
575
|
+
emitRow(r);
|
|
576
|
+
}
|
|
577
|
+
}));
|
|
505
578
|
// Summary counts
|
|
506
579
|
const created = results.filter(r => r.status === 'created').length;
|
|
507
580
|
const updated = results.filter(r => r.status === 'updated').length;
|
|
508
581
|
const errors = results.filter(r => r.status === 'error');
|
|
509
|
-
|
|
510
|
-
const outputFormat = flags.output || 'table';
|
|
511
|
-
if (outputFormat === 'json') {
|
|
582
|
+
if (useJson) {
|
|
512
583
|
this.log(JSON.stringify(results, null, 2));
|
|
513
584
|
}
|
|
514
|
-
else if (outputFormat === 'csv' || flags.csv) {
|
|
515
|
-
// CSV output
|
|
516
|
-
this.log('status,identifier,id,error');
|
|
517
|
-
for (const r of results) {
|
|
518
|
-
const err = (r.error || '').replace(/"/g, '""');
|
|
519
|
-
this.log(`${r.status},${r.identifier || ''},${r.id || ''},"${err}"`);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
else {
|
|
523
|
-
// Table output (default)
|
|
524
|
-
if (results.length > 0) {
|
|
525
|
-
const statusWidth = 8;
|
|
526
|
-
const identifierWidth = Math.max(10, ...results.map(r => (r.identifier || '').length));
|
|
527
|
-
this.log(`${'status'.padEnd(statusWidth)} ${'identifier'.padEnd(identifierWidth)} error`);
|
|
528
|
-
this.log(`${'-'.repeat(statusWidth)} ${'-'.repeat(identifierWidth)} ${'-'.repeat(50)}`);
|
|
529
|
-
for (const r of results) {
|
|
530
|
-
const status = r.status === 'created' ? 'created' : r.status === 'updated' ? 'updated' : 'error';
|
|
531
|
-
this.log(`${status.padEnd(statusWidth)} ${(r.identifier || '').padEnd(identifierWidth)} ${r.error || ''}`);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
585
|
// Always show summary at the end
|
|
536
586
|
this.log('');
|
|
537
587
|
this.log(`Summary: ${created} created, ${updated} updated, ${errors.length} failed`);
|
|
@@ -811,80 +861,122 @@ export default class Employees extends Command {
|
|
|
811
861
|
return '';
|
|
812
862
|
};
|
|
813
863
|
const results = [];
|
|
814
|
-
|
|
864
|
+
const stdoutHandle = process.stdout._handle;
|
|
865
|
+
if (stdoutHandle?.setBlocking)
|
|
866
|
+
stdoutHandle.setBlocking(true);
|
|
867
|
+
const outputFormat = flags.output || 'table';
|
|
868
|
+
const useCsv = outputFormat === 'csv' || Boolean(flags.csv);
|
|
869
|
+
const useJson = outputFormat === 'json';
|
|
870
|
+
const statusWidth = 8;
|
|
871
|
+
const identifierWidth = Math.max(10, ...items.map(i => getItemIdentifier(i).length));
|
|
872
|
+
if (useCsv) {
|
|
873
|
+
this.log('status,identifier,id,error');
|
|
874
|
+
}
|
|
875
|
+
else if (!useJson) {
|
|
876
|
+
this.log(`${'status'.padEnd(statusWidth)} ${'identifier'.padEnd(identifierWidth)} error`);
|
|
877
|
+
this.log(`${'-'.repeat(statusWidth)} ${'-'.repeat(identifierWidth)} ${'-'.repeat(50)}`);
|
|
878
|
+
}
|
|
879
|
+
const emitRow = (r) => {
|
|
880
|
+
if (useJson)
|
|
881
|
+
return;
|
|
882
|
+
if (useCsv) {
|
|
883
|
+
const err = (r.error || '').replace(/"/g, '""');
|
|
884
|
+
this.log(`${r.status},${r.identifier || ''},${r.id || ''},"${err}"`);
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
this.log(`${r.status.padEnd(statusWidth)} ${(r.identifier || '').padEnd(identifierWidth)} ${r.error || ''}`);
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
const STRIP_FIELDS = new Set(['id', '_type', 'tenantId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy']);
|
|
891
|
+
const stripServerFields = (item) => {
|
|
892
|
+
const out = {};
|
|
893
|
+
for (const [k, v] of Object.entries(item)) {
|
|
894
|
+
if (!STRIP_FIELDS.has(k))
|
|
895
|
+
out[k] = v;
|
|
896
|
+
}
|
|
897
|
+
return out;
|
|
898
|
+
};
|
|
899
|
+
const buildUpdatePath = (existingId) => {
|
|
900
|
+
const firstUpdateParam = updateEndpoint.pathParams[0];
|
|
901
|
+
const nestedIdParam = updateEndpoint.pathParams.find((p, i) => i > 0);
|
|
902
|
+
let updatePath = updateEndpoint.path.replace(`{${firstUpdateParam}}`, parentId);
|
|
903
|
+
if (nestedIdParam) {
|
|
904
|
+
updatePath = updatePath.replace(`{${nestedIdParam}}`, existingId);
|
|
905
|
+
}
|
|
906
|
+
return updatePath;
|
|
907
|
+
};
|
|
908
|
+
const processItem = async (item) => {
|
|
815
909
|
const identifier = getItemIdentifier(item);
|
|
910
|
+
const body = stripServerFields(item);
|
|
911
|
+
const itemId = typeof item.id === 'string' ? item.id : undefined;
|
|
912
|
+
if (itemId) {
|
|
913
|
+
try {
|
|
914
|
+
await apiRequest('PATCH', buildUpdatePath(itemId), {
|
|
915
|
+
data: body,
|
|
916
|
+
contextName: flags.context,
|
|
917
|
+
});
|
|
918
|
+
return { status: 'updated', id: itemId, identifier };
|
|
919
|
+
}
|
|
920
|
+
catch (error) {
|
|
921
|
+
if (!(error instanceof ApiError && error.status === 404)) {
|
|
922
|
+
const msg = error instanceof ApiError ? `(${error.status}) ${error.message}` : String(error);
|
|
923
|
+
return { status: 'error', id: itemId, identifier, error: msg };
|
|
924
|
+
}
|
|
925
|
+
// 404 → fall through and try create
|
|
926
|
+
}
|
|
927
|
+
}
|
|
816
928
|
try {
|
|
817
|
-
// Try to create
|
|
818
929
|
const response = await apiRequest('POST', basePath, {
|
|
819
|
-
data:
|
|
930
|
+
data: body,
|
|
820
931
|
contextName: flags.context,
|
|
821
932
|
});
|
|
822
933
|
const id = response.data?.id;
|
|
823
|
-
|
|
934
|
+
return { status: 'created', id: id ? String(id) : undefined, identifier };
|
|
824
935
|
}
|
|
825
936
|
catch (error) {
|
|
826
937
|
if (error instanceof ApiError && error.status === 409) {
|
|
827
|
-
// Conflict - try to update existing
|
|
828
938
|
const errorData = error.data;
|
|
829
939
|
const existingId = errorData?.existingId || item.id;
|
|
830
940
|
if (existingId) {
|
|
831
941
|
try {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
const nestedIdParam = updateEndpoint.pathParams.find((p, i) => i > 0);
|
|
835
|
-
let updatePath = updateEndpoint.path.replace(`{${firstUpdateParam}}`, parentId);
|
|
836
|
-
if (nestedIdParam) {
|
|
837
|
-
updatePath = updatePath.replace(`{${nestedIdParam}}`, existingId);
|
|
838
|
-
}
|
|
839
|
-
await apiRequest('PATCH', updatePath, {
|
|
840
|
-
data: item,
|
|
942
|
+
await apiRequest('PATCH', buildUpdatePath(existingId), {
|
|
943
|
+
data: body,
|
|
841
944
|
contextName: flags.context,
|
|
842
945
|
});
|
|
843
|
-
|
|
946
|
+
return { status: 'updated', id: existingId, identifier };
|
|
844
947
|
}
|
|
845
948
|
catch (updateError) {
|
|
846
949
|
const msg = updateError instanceof ApiError ? updateError.message : String(updateError);
|
|
847
|
-
|
|
950
|
+
return { status: 'error', id: existingId, identifier, error: `Update failed: ${msg}` };
|
|
848
951
|
}
|
|
849
952
|
}
|
|
850
|
-
|
|
851
|
-
results.push({ status: 'error', identifier, error: 'Conflict but no existingId returned' });
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
else {
|
|
855
|
-
const msg = error instanceof ApiError ? `(${error.status}) ${error.message}` : String(error);
|
|
856
|
-
results.push({ status: 'error', identifier, error: msg });
|
|
953
|
+
return { status: 'error', identifier, error: 'Conflict but no existingId returned' };
|
|
857
954
|
}
|
|
955
|
+
const msg = error instanceof ApiError ? `(${error.status}) ${error.message}` : String(error);
|
|
956
|
+
return { status: 'error', identifier, error: msg };
|
|
858
957
|
}
|
|
859
|
-
}
|
|
958
|
+
};
|
|
959
|
+
// Worker pool: 4 requests in flight at a time. Rows are emitted as each
|
|
960
|
+
// request resolves so output order may differ from input order.
|
|
961
|
+
const concurrency = 4;
|
|
962
|
+
const queue = [...items];
|
|
963
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, queue.length) }, async () => {
|
|
964
|
+
for (;;) {
|
|
965
|
+
const item = queue.shift();
|
|
966
|
+
if (!item)
|
|
967
|
+
return;
|
|
968
|
+
const r = await processItem(item);
|
|
969
|
+
results.push(r);
|
|
970
|
+
emitRow(r);
|
|
971
|
+
}
|
|
972
|
+
}));
|
|
860
973
|
// Summary counts
|
|
861
974
|
const created = results.filter(r => r.status === 'created').length;
|
|
862
975
|
const updated = results.filter(r => r.status === 'updated').length;
|
|
863
976
|
const errors = results.filter(r => r.status === 'error');
|
|
864
|
-
|
|
865
|
-
const outputFormat = flags.output || 'table';
|
|
866
|
-
if (outputFormat === 'json') {
|
|
977
|
+
if (useJson) {
|
|
867
978
|
this.log(JSON.stringify(results, null, 2));
|
|
868
979
|
}
|
|
869
|
-
else if (outputFormat === 'csv' || flags.csv) {
|
|
870
|
-
this.log('status,identifier,id,error');
|
|
871
|
-
for (const r of results) {
|
|
872
|
-
const err = (r.error || '').replace(/"/g, '""');
|
|
873
|
-
this.log(`${r.status},${r.identifier || ''},${r.id || ''},"${err}"`);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
else {
|
|
877
|
-
if (results.length > 0) {
|
|
878
|
-
const statusWidth = 8;
|
|
879
|
-
const identifierWidth = Math.max(10, ...results.map(r => (r.identifier || '').length));
|
|
880
|
-
this.log(`${'status'.padEnd(statusWidth)} ${'identifier'.padEnd(identifierWidth)} error`);
|
|
881
|
-
this.log(`${'-'.repeat(statusWidth)} ${'-'.repeat(identifierWidth)} ${'-'.repeat(50)}`);
|
|
882
|
-
for (const r of results) {
|
|
883
|
-
const status = r.status === 'created' ? 'created' : r.status === 'updated' ? 'updated' : 'error';
|
|
884
|
-
this.log(`${status.padEnd(statusWidth)} ${(r.identifier || '').padEnd(identifierWidth)} ${r.error || ''}`);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
980
|
this.log('');
|
|
889
981
|
this.log(`Summary: ${created} created, ${updated} updated, ${errors.length} failed`);
|
|
890
982
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class EntityConfigurations extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: never[];
|
|
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
|
+
'show-http-request': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
};
|
|
28
|
+
run(): Promise<void>;
|
|
29
|
+
private runImport;
|
|
30
|
+
private runExport;
|
|
31
|
+
private runCamt053Import;
|
|
32
|
+
private runNestedImport;
|
|
33
|
+
private parseFilterValue;
|
|
34
|
+
private filterFields;
|
|
35
|
+
private sanitizeOutput;
|
|
36
|
+
private getColumns;
|
|
37
|
+
private getValue;
|
|
38
|
+
private printTable;
|
|
39
|
+
private printCsv;
|
|
40
|
+
}
|