@aderis-erp/cli 1.0.2 → 1.0.3
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/{processing-logs.d.ts → access-groups.d.ts} +1 -1
- package/dist/commands/{access-groups 2.js → access-groups.js} +30 -18
- package/dist/commands/account-transactions.d.ts +41 -0
- package/dist/commands/account-transactions.js +1032 -0
- package/dist/commands/accounts.d.ts +40 -0
- package/dist/commands/accounts.js +1024 -0
- package/dist/commands/agent-runs.d.ts +39 -0
- package/dist/commands/agent-runs.js +1013 -0
- package/dist/commands/{pubsub.d.ts → async-endpoints-internal.d.ts} +1 -1
- package/dist/commands/{pubsub.js → async-endpoints-internal.js} +37 -25
- package/dist/commands/audit-log.d.ts +39 -0
- package/dist/commands/{processing-logs.js → audit-log.js} +42 -28
- package/dist/commands/auth/login.d.ts +14 -0
- package/dist/commands/auth/login.js +116 -0
- package/dist/commands/auth/logout.d.ts +10 -0
- package/dist/commands/auth/logout.js +58 -0
- package/dist/commands/auth/status.d.ts +12 -0
- package/dist/commands/auth/status.js +101 -0
- package/dist/commands/auth/tenant.d.ts +19 -0
- package/dist/commands/auth/tenant.js +184 -0
- package/dist/commands/auth.d.ts +37 -0
- package/dist/commands/auth.js +871 -0
- package/dist/commands/bank-accounts.d.ts +41 -0
- package/dist/commands/bank-accounts.js +1032 -0
- package/dist/commands/bank-integrations.js +30 -18
- package/dist/commands/business-partners---contacts.js +30 -18
- package/dist/commands/business-partners.js +30 -18
- package/dist/commands/config/add.d.ts +13 -0
- package/dist/commands/config/add.js +120 -0
- package/dist/commands/config/current.d.ts +9 -0
- package/dist/commands/config/current.js +43 -0
- package/dist/commands/config/delete.d.ts +12 -0
- package/dist/commands/config/delete.js +67 -0
- package/dist/commands/config/list.d.ts +9 -0
- package/dist/commands/config/list.js +50 -0
- package/dist/commands/config/use.d.ts +9 -0
- package/dist/commands/config/use.js +40 -0
- package/dist/commands/credit-card-accounts.js +30 -18
- package/dist/commands/documents.js +30 -18
- package/dist/commands/dunning-configs.js +30 -18
- package/dist/commands/dunning-reminders.js +30 -18
- package/dist/commands/dunning-runs.js +30 -18
- package/dist/commands/employees.js +30 -18
- package/dist/commands/event-processor-mappings.js +30 -18
- package/dist/commands/files-internal.js +30 -18
- package/dist/commands/health.js +30 -18
- package/dist/commands/inbox.js +33 -19
- package/dist/commands/integrations.js +30 -18
- package/dist/commands/item-categories.js +30 -18
- package/dist/commands/items.js +30 -18
- package/dist/commands/journal-lines.js +30 -18
- package/dist/commands/journals.js +30 -18
- package/dist/commands/ledgers.js +30 -18
- package/dist/commands/office-locations.js +30 -18
- package/dist/commands/payment-method-ledger-mappings.js +30 -18
- package/dist/commands/payment-methods.js +30 -18
- package/dist/commands/payment-runs.js +30 -18
- package/dist/commands/payment-terms.js +30 -18
- package/dist/commands/price-lists.js +30 -18
- package/dist/commands/processor-mappings.js +30 -18
- package/dist/commands/processors.js +31 -19
- package/dist/commands/reconciliation.js +30 -18
- package/dist/commands/reports.js +30 -18
- package/dist/commands/salary-types.js +1018 -0
- package/dist/commands/sales-invoices.js +30 -18
- package/dist/commands/sales-orders.js +32 -19
- package/dist/commands/switch.d.ts +1 -0
- package/dist/commands/switch.js +58 -3
- package/dist/commands/tags.js +30 -18
- package/dist/commands/tax-codes.js +30 -18
- package/dist/commands/tax-matrix.js +30 -18
- package/dist/commands/tenants.js +30 -18
- package/dist/commands/text-templates.js +30 -18
- package/dist/commands/tools.js +30 -18
- package/dist/commands/vendor-invoices.js +33 -19
- package/dist/commands/webhooks.js +30 -18
- package/dist/commands/workflows.js +30 -18
- package/dist/index 2.js +1 -0
- package/dist/index.d 2.ts +1 -0
- package/dist/lib/auth.d.ts +16 -1
- package/dist/lib/auth.js +153 -45
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.js +6 -0
- package/oclif.manifest.json +2092 -669
- package/package.json +2 -2
|
@@ -820,32 +820,44 @@ export default class Documents extends Command {
|
|
|
820
820
|
filterFields(data, fields) {
|
|
821
821
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
822
822
|
const pick = (obj, keys) => {
|
|
823
|
-
|
|
823
|
+
// Group keys by their first segment so sibling sub-paths
|
|
824
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
825
|
+
// and don't clobber each other on merge.
|
|
826
|
+
const directKeys = new Set();
|
|
827
|
+
const nestedKeys = new Map();
|
|
824
828
|
for (const key of keys) {
|
|
825
829
|
if (key.split('.').some(isUnsafeKey))
|
|
826
830
|
continue;
|
|
827
831
|
if (key.includes('.')) {
|
|
828
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
829
832
|
const [first, ...rest] = key.split('.');
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
836
|
-
result[first] = val.map((item, i) => ({
|
|
837
|
-
...(existing[i] || {}),
|
|
838
|
-
...pick(item, [restKey]),
|
|
839
|
-
}));
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
842
|
-
const nested = pick(val, [restKey]);
|
|
843
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
844
|
-
}
|
|
833
|
+
if (isUnsafeKey(first))
|
|
834
|
+
continue;
|
|
835
|
+
const list = nestedKeys.get(first);
|
|
836
|
+
if (list) {
|
|
837
|
+
list.push(rest.join('.'));
|
|
845
838
|
}
|
|
839
|
+
else {
|
|
840
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
directKeys.add(key);
|
|
846
845
|
}
|
|
847
|
-
|
|
846
|
+
}
|
|
847
|
+
const result = {};
|
|
848
|
+
for (const key of directKeys) {
|
|
849
|
+
if (key in obj)
|
|
848
850
|
result[key] = obj[key];
|
|
851
|
+
}
|
|
852
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
853
|
+
const val = obj[first];
|
|
854
|
+
if (!val || typeof val !== 'object')
|
|
855
|
+
continue;
|
|
856
|
+
if (Array.isArray(val)) {
|
|
857
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
result[first] = pick(val, restKeys);
|
|
849
861
|
}
|
|
850
862
|
}
|
|
851
863
|
return result;
|
|
@@ -819,32 +819,44 @@ export default class DunningConfigs extends Command {
|
|
|
819
819
|
filterFields(data, fields) {
|
|
820
820
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
821
821
|
const pick = (obj, keys) => {
|
|
822
|
-
|
|
822
|
+
// Group keys by their first segment so sibling sub-paths
|
|
823
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
824
|
+
// and don't clobber each other on merge.
|
|
825
|
+
const directKeys = new Set();
|
|
826
|
+
const nestedKeys = new Map();
|
|
823
827
|
for (const key of keys) {
|
|
824
828
|
if (key.split('.').some(isUnsafeKey))
|
|
825
829
|
continue;
|
|
826
830
|
if (key.includes('.')) {
|
|
827
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
828
831
|
const [first, ...rest] = key.split('.');
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
835
|
-
result[first] = val.map((item, i) => ({
|
|
836
|
-
...(existing[i] || {}),
|
|
837
|
-
...pick(item, [restKey]),
|
|
838
|
-
}));
|
|
839
|
-
}
|
|
840
|
-
else {
|
|
841
|
-
const nested = pick(val, [restKey]);
|
|
842
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
843
|
-
}
|
|
832
|
+
if (isUnsafeKey(first))
|
|
833
|
+
continue;
|
|
834
|
+
const list = nestedKeys.get(first);
|
|
835
|
+
if (list) {
|
|
836
|
+
list.push(rest.join('.'));
|
|
844
837
|
}
|
|
838
|
+
else {
|
|
839
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
directKeys.add(key);
|
|
845
844
|
}
|
|
846
|
-
|
|
845
|
+
}
|
|
846
|
+
const result = {};
|
|
847
|
+
for (const key of directKeys) {
|
|
848
|
+
if (key in obj)
|
|
847
849
|
result[key] = obj[key];
|
|
850
|
+
}
|
|
851
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
852
|
+
const val = obj[first];
|
|
853
|
+
if (!val || typeof val !== 'object')
|
|
854
|
+
continue;
|
|
855
|
+
if (Array.isArray(val)) {
|
|
856
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
result[first] = pick(val, restKeys);
|
|
848
860
|
}
|
|
849
861
|
}
|
|
850
862
|
return result;
|
|
@@ -820,32 +820,44 @@ export default class DunningReminders extends Command {
|
|
|
820
820
|
filterFields(data, fields) {
|
|
821
821
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
822
822
|
const pick = (obj, keys) => {
|
|
823
|
-
|
|
823
|
+
// Group keys by their first segment so sibling sub-paths
|
|
824
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
825
|
+
// and don't clobber each other on merge.
|
|
826
|
+
const directKeys = new Set();
|
|
827
|
+
const nestedKeys = new Map();
|
|
824
828
|
for (const key of keys) {
|
|
825
829
|
if (key.split('.').some(isUnsafeKey))
|
|
826
830
|
continue;
|
|
827
831
|
if (key.includes('.')) {
|
|
828
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
829
832
|
const [first, ...rest] = key.split('.');
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
836
|
-
result[first] = val.map((item, i) => ({
|
|
837
|
-
...(existing[i] || {}),
|
|
838
|
-
...pick(item, [restKey]),
|
|
839
|
-
}));
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
842
|
-
const nested = pick(val, [restKey]);
|
|
843
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
844
|
-
}
|
|
833
|
+
if (isUnsafeKey(first))
|
|
834
|
+
continue;
|
|
835
|
+
const list = nestedKeys.get(first);
|
|
836
|
+
if (list) {
|
|
837
|
+
list.push(rest.join('.'));
|
|
845
838
|
}
|
|
839
|
+
else {
|
|
840
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
directKeys.add(key);
|
|
846
845
|
}
|
|
847
|
-
|
|
846
|
+
}
|
|
847
|
+
const result = {};
|
|
848
|
+
for (const key of directKeys) {
|
|
849
|
+
if (key in obj)
|
|
848
850
|
result[key] = obj[key];
|
|
851
|
+
}
|
|
852
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
853
|
+
const val = obj[first];
|
|
854
|
+
if (!val || typeof val !== 'object')
|
|
855
|
+
continue;
|
|
856
|
+
if (Array.isArray(val)) {
|
|
857
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
result[first] = pick(val, restKeys);
|
|
849
861
|
}
|
|
850
862
|
}
|
|
851
863
|
return result;
|
|
@@ -808,32 +808,44 @@ export default class DunningRuns extends Command {
|
|
|
808
808
|
filterFields(data, fields) {
|
|
809
809
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
810
810
|
const pick = (obj, keys) => {
|
|
811
|
-
|
|
811
|
+
// Group keys by their first segment so sibling sub-paths
|
|
812
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
813
|
+
// and don't clobber each other on merge.
|
|
814
|
+
const directKeys = new Set();
|
|
815
|
+
const nestedKeys = new Map();
|
|
812
816
|
for (const key of keys) {
|
|
813
817
|
if (key.split('.').some(isUnsafeKey))
|
|
814
818
|
continue;
|
|
815
819
|
if (key.includes('.')) {
|
|
816
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
817
820
|
const [first, ...rest] = key.split('.');
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
824
|
-
result[first] = val.map((item, i) => ({
|
|
825
|
-
...(existing[i] || {}),
|
|
826
|
-
...pick(item, [restKey]),
|
|
827
|
-
}));
|
|
828
|
-
}
|
|
829
|
-
else {
|
|
830
|
-
const nested = pick(val, [restKey]);
|
|
831
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
832
|
-
}
|
|
821
|
+
if (isUnsafeKey(first))
|
|
822
|
+
continue;
|
|
823
|
+
const list = nestedKeys.get(first);
|
|
824
|
+
if (list) {
|
|
825
|
+
list.push(rest.join('.'));
|
|
833
826
|
}
|
|
827
|
+
else {
|
|
828
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
else {
|
|
832
|
+
directKeys.add(key);
|
|
834
833
|
}
|
|
835
|
-
|
|
834
|
+
}
|
|
835
|
+
const result = {};
|
|
836
|
+
for (const key of directKeys) {
|
|
837
|
+
if (key in obj)
|
|
836
838
|
result[key] = obj[key];
|
|
839
|
+
}
|
|
840
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
841
|
+
const val = obj[first];
|
|
842
|
+
if (!val || typeof val !== 'object')
|
|
843
|
+
continue;
|
|
844
|
+
if (Array.isArray(val)) {
|
|
845
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
result[first] = pick(val, restKeys);
|
|
837
849
|
}
|
|
838
850
|
}
|
|
839
851
|
return result;
|
|
@@ -850,32 +850,44 @@ export default class Employees extends Command {
|
|
|
850
850
|
filterFields(data, fields) {
|
|
851
851
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
852
852
|
const pick = (obj, keys) => {
|
|
853
|
-
|
|
853
|
+
// Group keys by their first segment so sibling sub-paths
|
|
854
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
855
|
+
// and don't clobber each other on merge.
|
|
856
|
+
const directKeys = new Set();
|
|
857
|
+
const nestedKeys = new Map();
|
|
854
858
|
for (const key of keys) {
|
|
855
859
|
if (key.split('.').some(isUnsafeKey))
|
|
856
860
|
continue;
|
|
857
861
|
if (key.includes('.')) {
|
|
858
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
859
862
|
const [first, ...rest] = key.split('.');
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
866
|
-
result[first] = val.map((item, i) => ({
|
|
867
|
-
...(existing[i] || {}),
|
|
868
|
-
...pick(item, [restKey]),
|
|
869
|
-
}));
|
|
870
|
-
}
|
|
871
|
-
else {
|
|
872
|
-
const nested = pick(val, [restKey]);
|
|
873
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
874
|
-
}
|
|
863
|
+
if (isUnsafeKey(first))
|
|
864
|
+
continue;
|
|
865
|
+
const list = nestedKeys.get(first);
|
|
866
|
+
if (list) {
|
|
867
|
+
list.push(rest.join('.'));
|
|
875
868
|
}
|
|
869
|
+
else {
|
|
870
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
874
|
+
directKeys.add(key);
|
|
876
875
|
}
|
|
877
|
-
|
|
876
|
+
}
|
|
877
|
+
const result = {};
|
|
878
|
+
for (const key of directKeys) {
|
|
879
|
+
if (key in obj)
|
|
878
880
|
result[key] = obj[key];
|
|
881
|
+
}
|
|
882
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
883
|
+
const val = obj[first];
|
|
884
|
+
if (!val || typeof val !== 'object')
|
|
885
|
+
continue;
|
|
886
|
+
if (Array.isArray(val)) {
|
|
887
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
result[first] = pick(val, restKeys);
|
|
879
891
|
}
|
|
880
892
|
}
|
|
881
893
|
return result;
|
|
@@ -818,32 +818,44 @@ export default class EventProcessorMappings extends Command {
|
|
|
818
818
|
filterFields(data, fields) {
|
|
819
819
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
820
820
|
const pick = (obj, keys) => {
|
|
821
|
-
|
|
821
|
+
// Group keys by their first segment so sibling sub-paths
|
|
822
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
823
|
+
// and don't clobber each other on merge.
|
|
824
|
+
const directKeys = new Set();
|
|
825
|
+
const nestedKeys = new Map();
|
|
822
826
|
for (const key of keys) {
|
|
823
827
|
if (key.split('.').some(isUnsafeKey))
|
|
824
828
|
continue;
|
|
825
829
|
if (key.includes('.')) {
|
|
826
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
827
830
|
const [first, ...rest] = key.split('.');
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
834
|
-
result[first] = val.map((item, i) => ({
|
|
835
|
-
...(existing[i] || {}),
|
|
836
|
-
...pick(item, [restKey]),
|
|
837
|
-
}));
|
|
838
|
-
}
|
|
839
|
-
else {
|
|
840
|
-
const nested = pick(val, [restKey]);
|
|
841
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
842
|
-
}
|
|
831
|
+
if (isUnsafeKey(first))
|
|
832
|
+
continue;
|
|
833
|
+
const list = nestedKeys.get(first);
|
|
834
|
+
if (list) {
|
|
835
|
+
list.push(rest.join('.'));
|
|
843
836
|
}
|
|
837
|
+
else {
|
|
838
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
directKeys.add(key);
|
|
844
843
|
}
|
|
845
|
-
|
|
844
|
+
}
|
|
845
|
+
const result = {};
|
|
846
|
+
for (const key of directKeys) {
|
|
847
|
+
if (key in obj)
|
|
846
848
|
result[key] = obj[key];
|
|
849
|
+
}
|
|
850
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
851
|
+
const val = obj[first];
|
|
852
|
+
if (!val || typeof val !== 'object')
|
|
853
|
+
continue;
|
|
854
|
+
if (Array.isArray(val)) {
|
|
855
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
result[first] = pick(val, restKeys);
|
|
847
859
|
}
|
|
848
860
|
}
|
|
849
861
|
return result;
|
|
@@ -820,32 +820,44 @@ export default class FilesInternal extends Command {
|
|
|
820
820
|
filterFields(data, fields) {
|
|
821
821
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
822
822
|
const pick = (obj, keys) => {
|
|
823
|
-
|
|
823
|
+
// Group keys by their first segment so sibling sub-paths
|
|
824
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
825
|
+
// and don't clobber each other on merge.
|
|
826
|
+
const directKeys = new Set();
|
|
827
|
+
const nestedKeys = new Map();
|
|
824
828
|
for (const key of keys) {
|
|
825
829
|
if (key.split('.').some(isUnsafeKey))
|
|
826
830
|
continue;
|
|
827
831
|
if (key.includes('.')) {
|
|
828
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
829
832
|
const [first, ...rest] = key.split('.');
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
836
|
-
result[first] = val.map((item, i) => ({
|
|
837
|
-
...(existing[i] || {}),
|
|
838
|
-
...pick(item, [restKey]),
|
|
839
|
-
}));
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
842
|
-
const nested = pick(val, [restKey]);
|
|
843
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
844
|
-
}
|
|
833
|
+
if (isUnsafeKey(first))
|
|
834
|
+
continue;
|
|
835
|
+
const list = nestedKeys.get(first);
|
|
836
|
+
if (list) {
|
|
837
|
+
list.push(rest.join('.'));
|
|
845
838
|
}
|
|
839
|
+
else {
|
|
840
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
directKeys.add(key);
|
|
846
845
|
}
|
|
847
|
-
|
|
846
|
+
}
|
|
847
|
+
const result = {};
|
|
848
|
+
for (const key of directKeys) {
|
|
849
|
+
if (key in obj)
|
|
848
850
|
result[key] = obj[key];
|
|
851
|
+
}
|
|
852
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
853
|
+
const val = obj[first];
|
|
854
|
+
if (!val || typeof val !== 'object')
|
|
855
|
+
continue;
|
|
856
|
+
if (Array.isArray(val)) {
|
|
857
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
result[first] = pick(val, restKeys);
|
|
849
861
|
}
|
|
850
862
|
}
|
|
851
863
|
return result;
|
package/dist/commands/health.js
CHANGED
|
@@ -814,32 +814,44 @@ export default class Health extends Command {
|
|
|
814
814
|
filterFields(data, fields) {
|
|
815
815
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
816
816
|
const pick = (obj, keys) => {
|
|
817
|
-
|
|
817
|
+
// Group keys by their first segment so sibling sub-paths
|
|
818
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
819
|
+
// and don't clobber each other on merge.
|
|
820
|
+
const directKeys = new Set();
|
|
821
|
+
const nestedKeys = new Map();
|
|
818
822
|
for (const key of keys) {
|
|
819
823
|
if (key.split('.').some(isUnsafeKey))
|
|
820
824
|
continue;
|
|
821
825
|
if (key.includes('.')) {
|
|
822
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
823
826
|
const [first, ...rest] = key.split('.');
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
830
|
-
result[first] = val.map((item, i) => ({
|
|
831
|
-
...(existing[i] || {}),
|
|
832
|
-
...pick(item, [restKey]),
|
|
833
|
-
}));
|
|
834
|
-
}
|
|
835
|
-
else {
|
|
836
|
-
const nested = pick(val, [restKey]);
|
|
837
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
838
|
-
}
|
|
827
|
+
if (isUnsafeKey(first))
|
|
828
|
+
continue;
|
|
829
|
+
const list = nestedKeys.get(first);
|
|
830
|
+
if (list) {
|
|
831
|
+
list.push(rest.join('.'));
|
|
839
832
|
}
|
|
833
|
+
else {
|
|
834
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
directKeys.add(key);
|
|
840
839
|
}
|
|
841
|
-
|
|
840
|
+
}
|
|
841
|
+
const result = {};
|
|
842
|
+
for (const key of directKeys) {
|
|
843
|
+
if (key in obj)
|
|
842
844
|
result[key] = obj[key];
|
|
845
|
+
}
|
|
846
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
847
|
+
const val = obj[first];
|
|
848
|
+
if (!val || typeof val !== 'object')
|
|
849
|
+
continue;
|
|
850
|
+
if (Array.isArray(val)) {
|
|
851
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
result[first] = pick(val, restKeys);
|
|
843
855
|
}
|
|
844
856
|
}
|
|
845
857
|
return result;
|
package/dist/commands/inbox.js
CHANGED
|
@@ -6,11 +6,13 @@ const HAS_IMPORT = false;
|
|
|
6
6
|
const HAS_EXPORT = false;
|
|
7
7
|
const HAS_CAMT053 = false;
|
|
8
8
|
const NESTED_IMPORTS = [];
|
|
9
|
-
const SUBCOMMANDS = [...["upload", "email-webhook", "document-types"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
9
|
+
const SUBCOMMANDS = [...["upload", "email-webhook", "document-types", "list-processing-logs", "processing-logs"], ...(HAS_IMPORT ? ['import'] : []), ...(HAS_EXPORT ? ['export'] : []), ...NESTED_IMPORTS.map(n => `import-${n}`)];
|
|
10
10
|
const ENDPOINTS = {
|
|
11
11
|
'upload': { method: 'POST', path: '/v1/inbox/upload', summary: 'Upload document(s) to inbox for processing', pathParams: [], hasBody: false, isMultipart: true },
|
|
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 },
|
|
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 },
|
|
14
|
+
'list-processing-logs': { method: 'GET', path: '/v1/inbox/processing-logs', summary: 'List recent inbox processing logs (newest first)', pathParams: [], hasBody: false, isMultipart: false },
|
|
15
|
+
'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 },
|
|
14
16
|
};
|
|
15
17
|
export default class Inbox extends Command {
|
|
16
18
|
static description = 'Manage inbox';
|
|
@@ -810,32 +812,44 @@ export default class Inbox extends Command {
|
|
|
810
812
|
filterFields(data, fields) {
|
|
811
813
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
812
814
|
const pick = (obj, keys) => {
|
|
813
|
-
|
|
815
|
+
// Group keys by their first segment so sibling sub-paths
|
|
816
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
817
|
+
// and don't clobber each other on merge.
|
|
818
|
+
const directKeys = new Set();
|
|
819
|
+
const nestedKeys = new Map();
|
|
814
820
|
for (const key of keys) {
|
|
815
821
|
if (key.split('.').some(isUnsafeKey))
|
|
816
822
|
continue;
|
|
817
823
|
if (key.includes('.')) {
|
|
818
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
819
824
|
const [first, ...rest] = key.split('.');
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
826
|
-
result[first] = val.map((item, i) => ({
|
|
827
|
-
...(existing[i] || {}),
|
|
828
|
-
...pick(item, [restKey]),
|
|
829
|
-
}));
|
|
830
|
-
}
|
|
831
|
-
else {
|
|
832
|
-
const nested = pick(val, [restKey]);
|
|
833
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
834
|
-
}
|
|
825
|
+
if (isUnsafeKey(first))
|
|
826
|
+
continue;
|
|
827
|
+
const list = nestedKeys.get(first);
|
|
828
|
+
if (list) {
|
|
829
|
+
list.push(rest.join('.'));
|
|
835
830
|
}
|
|
831
|
+
else {
|
|
832
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
directKeys.add(key);
|
|
836
837
|
}
|
|
837
|
-
|
|
838
|
+
}
|
|
839
|
+
const result = {};
|
|
840
|
+
for (const key of directKeys) {
|
|
841
|
+
if (key in obj)
|
|
838
842
|
result[key] = obj[key];
|
|
843
|
+
}
|
|
844
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
845
|
+
const val = obj[first];
|
|
846
|
+
if (!val || typeof val !== 'object')
|
|
847
|
+
continue;
|
|
848
|
+
if (Array.isArray(val)) {
|
|
849
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
result[first] = pick(val, restKeys);
|
|
839
853
|
}
|
|
840
854
|
}
|
|
841
855
|
return result;
|
|
@@ -814,32 +814,44 @@ export default class Integrations extends Command {
|
|
|
814
814
|
filterFields(data, fields) {
|
|
815
815
|
const isUnsafeKey = (k) => k === '__proto__' || k === 'constructor' || k === 'prototype';
|
|
816
816
|
const pick = (obj, keys) => {
|
|
817
|
-
|
|
817
|
+
// Group keys by their first segment so sibling sub-paths
|
|
818
|
+
// (e.g. 'items.amount' + 'items._type') resolve in one recursive pass
|
|
819
|
+
// and don't clobber each other on merge.
|
|
820
|
+
const directKeys = new Set();
|
|
821
|
+
const nestedKeys = new Map();
|
|
818
822
|
for (const key of keys) {
|
|
819
823
|
if (key.split('.').some(isUnsafeKey))
|
|
820
824
|
continue;
|
|
821
825
|
if (key.includes('.')) {
|
|
822
|
-
// Handle nested fields like 'customer.name' or 'allocations.salesInvoiceId'
|
|
823
826
|
const [first, ...rest] = key.split('.');
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const existing = Array.isArray(result[first]) ? result[first] : [];
|
|
830
|
-
result[first] = val.map((item, i) => ({
|
|
831
|
-
...(existing[i] || {}),
|
|
832
|
-
...pick(item, [restKey]),
|
|
833
|
-
}));
|
|
834
|
-
}
|
|
835
|
-
else {
|
|
836
|
-
const nested = pick(val, [restKey]);
|
|
837
|
-
result[first] = { ...(result[first] || {}), ...nested };
|
|
838
|
-
}
|
|
827
|
+
if (isUnsafeKey(first))
|
|
828
|
+
continue;
|
|
829
|
+
const list = nestedKeys.get(first);
|
|
830
|
+
if (list) {
|
|
831
|
+
list.push(rest.join('.'));
|
|
839
832
|
}
|
|
833
|
+
else {
|
|
834
|
+
nestedKeys.set(first, [rest.join('.')]);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
directKeys.add(key);
|
|
840
839
|
}
|
|
841
|
-
|
|
840
|
+
}
|
|
841
|
+
const result = {};
|
|
842
|
+
for (const key of directKeys) {
|
|
843
|
+
if (key in obj)
|
|
842
844
|
result[key] = obj[key];
|
|
845
|
+
}
|
|
846
|
+
for (const [first, restKeys] of nestedKeys) {
|
|
847
|
+
const val = obj[first];
|
|
848
|
+
if (!val || typeof val !== 'object')
|
|
849
|
+
continue;
|
|
850
|
+
if (Array.isArray(val)) {
|
|
851
|
+
result[first] = val.map(item => pick(item, restKeys));
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
result[first] = pick(val, restKeys);
|
|
843
855
|
}
|
|
844
856
|
}
|
|
845
857
|
return result;
|