@tamu-dor/famis-db 3.0.4 → 3.0.5
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/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/main.cjs +15 -4
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +15 -4
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -659,10 +659,11 @@ declare class FAMISDb {
|
|
|
659
659
|
* @param {string} type
|
|
660
660
|
* @param {string} operator
|
|
661
661
|
* @param {string} search
|
|
662
|
+
* @param {string[]} excludeFields - fields to exclude from results
|
|
662
663
|
* @returns {Promise<Core>} core object
|
|
663
664
|
* @memberof FAMISDb
|
|
664
665
|
*/
|
|
665
|
-
getCore(type: string, operator: string | undefined, search: string): Promise<Core>;
|
|
666
|
+
getCore(type: string, operator: string | undefined, search: string, excludeFields?: string[]): Promise<Core>;
|
|
666
667
|
/**
|
|
667
668
|
*
|
|
668
669
|
* Get core by id
|
|
@@ -676,9 +677,10 @@ declare class FAMISDb {
|
|
|
676
677
|
* Get core by account number
|
|
677
678
|
* @param {string} account
|
|
678
679
|
* @returns {Promise<Core>} core object
|
|
680
|
+
* @param {string[]} excludeFields - fields to exclude from results
|
|
679
681
|
* @memberof FAMISDb
|
|
680
682
|
*/
|
|
681
|
-
getCoreByAccount(account: string): Promise<Core>;
|
|
683
|
+
getCoreByAccount(account: string, excludeFields?: string[]): Promise<Core>;
|
|
682
684
|
/**
|
|
683
685
|
*
|
|
684
686
|
* Update core
|
package/dist/index.d.ts
CHANGED
|
@@ -659,10 +659,11 @@ declare class FAMISDb {
|
|
|
659
659
|
* @param {string} type
|
|
660
660
|
* @param {string} operator
|
|
661
661
|
* @param {string} search
|
|
662
|
+
* @param {string[]} excludeFields - fields to exclude from results
|
|
662
663
|
* @returns {Promise<Core>} core object
|
|
663
664
|
* @memberof FAMISDb
|
|
664
665
|
*/
|
|
665
|
-
getCore(type: string, operator: string | undefined, search: string): Promise<Core>;
|
|
666
|
+
getCore(type: string, operator: string | undefined, search: string, excludeFields?: string[]): Promise<Core>;
|
|
666
667
|
/**
|
|
667
668
|
*
|
|
668
669
|
* Get core by id
|
|
@@ -676,9 +677,10 @@ declare class FAMISDb {
|
|
|
676
677
|
* Get core by account number
|
|
677
678
|
* @param {string} account
|
|
678
679
|
* @returns {Promise<Core>} core object
|
|
680
|
+
* @param {string[]} excludeFields - fields to exclude from results
|
|
679
681
|
* @memberof FAMISDb
|
|
680
682
|
*/
|
|
681
|
-
getCoreByAccount(account: string): Promise<Core>;
|
|
683
|
+
getCoreByAccount(account: string, excludeFields?: string[]): Promise<Core>;
|
|
682
684
|
/**
|
|
683
685
|
*
|
|
684
686
|
* Update core
|
package/dist/main.cjs
CHANGED
|
@@ -259,7 +259,7 @@ class FAMISDb {
|
|
|
259
259
|
async processInvoice(invoice, historical = false, excludeFields = []) {
|
|
260
260
|
try {
|
|
261
261
|
const account = getCoreAccountNumber(invoice.data.details[0].famis);
|
|
262
|
-
invoice.core = await this.getCoreByAccount(account);
|
|
262
|
+
invoice.core = await this.getCoreByAccount(account, excludeFields);
|
|
263
263
|
if (invoice.core) {
|
|
264
264
|
invoice.core.systemPart = await this.getSystemById(
|
|
265
265
|
invoice.core.systemId,
|
|
@@ -1496,10 +1496,11 @@ class FAMISDb {
|
|
|
1496
1496
|
* @param {string} type
|
|
1497
1497
|
* @param {string} operator
|
|
1498
1498
|
* @param {string} search
|
|
1499
|
+
* @param {string[]} excludeFields - fields to exclude from results
|
|
1499
1500
|
* @returns {Promise<Core>} core object
|
|
1500
1501
|
* @memberof FAMISDb
|
|
1501
1502
|
*/
|
|
1502
|
-
async getCore(type, operator = "=", search) {
|
|
1503
|
+
async getCore(type, operator = "=", search, excludeFields = []) {
|
|
1503
1504
|
let records;
|
|
1504
1505
|
let retVal;
|
|
1505
1506
|
try {
|
|
@@ -1516,6 +1517,14 @@ class FAMISDb {
|
|
|
1516
1517
|
...expenseAccountBalFields,
|
|
1517
1518
|
*/
|
|
1518
1519
|
];
|
|
1520
|
+
if (excludeFields.length) {
|
|
1521
|
+
excludeFields.forEach((f) => {
|
|
1522
|
+
const idx = fields.findIndex((field) => field.includes(f));
|
|
1523
|
+
if (idx > -1) {
|
|
1524
|
+
fields.splice(idx, 1);
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1519
1528
|
records = await this.db.with("coreaccounts", (qb) => {
|
|
1520
1529
|
qb.select(
|
|
1521
1530
|
"accounts.*",
|
|
@@ -1619,15 +1628,17 @@ class FAMISDb {
|
|
|
1619
1628
|
* Get core by account number
|
|
1620
1629
|
* @param {string} account
|
|
1621
1630
|
* @returns {Promise<Core>} core object
|
|
1631
|
+
* @param {string[]} excludeFields - fields to exclude from results
|
|
1622
1632
|
* @memberof FAMISDb
|
|
1623
1633
|
*/
|
|
1624
|
-
async getCoreByAccount(account) {
|
|
1634
|
+
async getCoreByAccount(account, excludeFields) {
|
|
1625
1635
|
let retVal;
|
|
1626
1636
|
try {
|
|
1627
1637
|
retVal = await this.getCore(
|
|
1628
1638
|
"core_accounts.accounts",
|
|
1629
1639
|
"@>",
|
|
1630
|
-
`[{"account_number": "${account}"}]
|
|
1640
|
+
`[{"account_number": "${account}"}]`,
|
|
1641
|
+
excludeFields
|
|
1631
1642
|
);
|
|
1632
1643
|
} catch (e) {
|
|
1633
1644
|
throw e;
|