@tamu-dor/famis-db 3.0.0-beta.3 → 3.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "src/index.ts": {
3
3
  "file": "main.cjs",
4
+ "name": "index",
4
5
  "src": "src/index.ts",
5
6
  "isEntry": true
6
7
  }
package/dist/index.d.mts CHANGED
@@ -51,19 +51,19 @@ export declare interface AccountPayload {
51
51
  }
52
52
 
53
53
  export declare interface Contact {
54
- fax: string | null;
55
- city: string | null;
56
- name: string;
57
- email: string | null;
58
- phone: string | null;
59
- state: string | null;
60
- country: string | null;
61
- address1: string | null;
62
- address2: string | null;
63
- mailstop: string | null;
64
- department: string | null;
65
- postalCode: string | null;
66
- institution: string | null;
54
+ fax?: string | null;
55
+ city?: string | null;
56
+ name?: string;
57
+ email?: string | null;
58
+ phone?: string | null;
59
+ state?: string | null;
60
+ country?: string | null;
61
+ address1?: string | null;
62
+ address2?: string | null;
63
+ mailstop?: string | null;
64
+ department?: string | null;
65
+ postalCode?: string | null;
66
+ institution?: string | null;
67
67
  }
68
68
 
69
69
  export declare interface Core {
@@ -281,7 +281,7 @@ export declare interface Edge {
281
281
  declare class FAMISDb {
282
282
  private db;
283
283
  private people;
284
- constructor(config: any, people: any);
284
+ constructor(config: any, people: any, debug: boolean);
285
285
  /**
286
286
  * Initializes the database connection and sets up the Knex instance for interacting with PostgreSQL database.
287
287
  *
@@ -479,11 +479,11 @@ declare class FAMISDb {
479
479
  *
480
480
  * Updates an invoice
481
481
  * @param {string} uid
482
- * @param {object} invoice
483
- * @returns {Promise<object>} invoice object
482
+ * @param {Invoice} invoice
483
+ * @returns {Promise<Invoice>} invoice object
484
484
  * @memberof FAMISDb
485
485
  */
486
- updateInvoice(uid: string, invoice: any): Promise<any>;
486
+ updateInvoice(uid: string, invoice: Invoice): Promise<InvoicePayload>;
487
487
  /**
488
488
  *
489
489
  * Toggles an invoice as paid
@@ -1033,11 +1033,11 @@ declare class FAMISDb {
1033
1033
  }
1034
1034
 
1035
1035
  export declare interface Invoice {
1036
- uid: string;
1037
- number: string;
1038
- lab: string;
1039
- totalAmount: string;
1040
- date: string;
1036
+ uid?: string | null;
1037
+ number?: string | null;
1038
+ lab?: string | null;
1039
+ totalAmount?: string;
1040
+ date?: string;
1041
1041
  data: TransactionData;
1042
1042
  invoiced: boolean;
1043
1043
  type: string;
@@ -1048,14 +1048,14 @@ declare class FAMISDb {
1048
1048
  postedDate: string | null;
1049
1049
  emailed: boolean;
1050
1050
  replace_data?: object | null;
1051
- fingerprint: string;
1052
- core: Core;
1053
- customerAccountInfo: CustomerAccountInfo;
1054
- isIdt: boolean;
1055
- poNumber: string | null;
1056
- pi: PI;
1057
- highRiskInfo: HighRiskInfo;
1058
- comments: InvoiceComment[];
1051
+ fingerprint?: string | null;
1052
+ core?: Core | null;
1053
+ customerAccountInfo?: CustomerAccountInfo | null;
1054
+ isIdt?: boolean | null;
1055
+ poNumber?: string | null;
1056
+ pi?: PI | null;
1057
+ highRiskInfo?: HighRiskInfo | null;
1058
+ comments?: InvoiceComment[] | null;
1059
1059
  }
1060
1060
 
1061
1061
  export declare interface InvoiceComment {
package/dist/index.d.ts CHANGED
@@ -51,19 +51,19 @@ export declare interface AccountPayload {
51
51
  }
52
52
 
53
53
  export declare interface Contact {
54
- fax: string | null;
55
- city: string | null;
56
- name: string;
57
- email: string | null;
58
- phone: string | null;
59
- state: string | null;
60
- country: string | null;
61
- address1: string | null;
62
- address2: string | null;
63
- mailstop: string | null;
64
- department: string | null;
65
- postalCode: string | null;
66
- institution: string | null;
54
+ fax?: string | null;
55
+ city?: string | null;
56
+ name?: string;
57
+ email?: string | null;
58
+ phone?: string | null;
59
+ state?: string | null;
60
+ country?: string | null;
61
+ address1?: string | null;
62
+ address2?: string | null;
63
+ mailstop?: string | null;
64
+ department?: string | null;
65
+ postalCode?: string | null;
66
+ institution?: string | null;
67
67
  }
68
68
 
69
69
  export declare interface Core {
@@ -281,7 +281,7 @@ export declare interface Edge {
281
281
  declare class FAMISDb {
282
282
  private db;
283
283
  private people;
284
- constructor(config: any, people: any);
284
+ constructor(config: any, people: any, debug: boolean);
285
285
  /**
286
286
  * Initializes the database connection and sets up the Knex instance for interacting with PostgreSQL database.
287
287
  *
@@ -479,11 +479,11 @@ declare class FAMISDb {
479
479
  *
480
480
  * Updates an invoice
481
481
  * @param {string} uid
482
- * @param {object} invoice
483
- * @returns {Promise<object>} invoice object
482
+ * @param {Invoice} invoice
483
+ * @returns {Promise<Invoice>} invoice object
484
484
  * @memberof FAMISDb
485
485
  */
486
- updateInvoice(uid: string, invoice: any): Promise<any>;
486
+ updateInvoice(uid: string, invoice: Invoice): Promise<InvoicePayload>;
487
487
  /**
488
488
  *
489
489
  * Toggles an invoice as paid
@@ -1033,11 +1033,11 @@ declare class FAMISDb {
1033
1033
  }
1034
1034
 
1035
1035
  export declare interface Invoice {
1036
- uid: string;
1037
- number: string;
1038
- lab: string;
1039
- totalAmount: string;
1040
- date: string;
1036
+ uid?: string | null;
1037
+ number?: string | null;
1038
+ lab?: string | null;
1039
+ totalAmount?: string;
1040
+ date?: string;
1041
1041
  data: TransactionData;
1042
1042
  invoiced: boolean;
1043
1043
  type: string;
@@ -1048,14 +1048,14 @@ declare class FAMISDb {
1048
1048
  postedDate: string | null;
1049
1049
  emailed: boolean;
1050
1050
  replace_data?: object | null;
1051
- fingerprint: string;
1052
- core: Core;
1053
- customerAccountInfo: CustomerAccountInfo;
1054
- isIdt: boolean;
1055
- poNumber: string | null;
1056
- pi: PI;
1057
- highRiskInfo: HighRiskInfo;
1058
- comments: InvoiceComment[];
1051
+ fingerprint?: string | null;
1052
+ core?: Core | null;
1053
+ customerAccountInfo?: CustomerAccountInfo | null;
1054
+ isIdt?: boolean | null;
1055
+ poNumber?: string | null;
1056
+ pi?: PI | null;
1057
+ highRiskInfo?: HighRiskInfo | null;
1058
+ comments?: InvoiceComment[] | null;
1059
1059
  }
1060
1060
 
1061
1061
  export declare interface InvoiceComment {
package/dist/main.cjs CHANGED
@@ -190,9 +190,9 @@ class FAMISDb {
190
190
  db;
191
191
  //@ts-ignore
192
192
  people;
193
- constructor(config, people) {
193
+ constructor(config, people, debug) {
194
194
  if (config) {
195
- this.init(config, people);
195
+ this.init(config, people, debug || false);
196
196
  }
197
197
  }
198
198
  /**
@@ -691,8 +691,8 @@ class FAMISDb {
691
691
  *
692
692
  * Updates an invoice
693
693
  * @param {string} uid
694
- * @param {object} invoice
695
- * @returns {Promise<object>} invoice object
694
+ * @param {Invoice} invoice
695
+ * @returns {Promise<Invoice>} invoice object
696
696
  * @memberof FAMISDb
697
697
  */
698
698
  async updateInvoice(uid, invoice) {
@@ -729,6 +729,7 @@ class FAMISDb {
729
729
  fingerprint: fingerprint ? fingerprint : null
730
730
  };
731
731
  records = await this.db("invoices").returning(returningColumns).update(record).where("uid", uid);
732
+ records = await this.getInvoiceByUid(uid);
732
733
  } catch (e) {
733
734
  throw e;
734
735
  }
@@ -1856,8 +1857,7 @@ class FAMISDb {
1856
1857
  let retVal = null;
1857
1858
  const columns = ["id", "userId", "admin", "role", "roleName", "roleEmail", "deleted"];
1858
1859
  try {
1859
- if ("id" in user)
1860
- retVal = await this.db("users").returning(columns).update(user).where("id", user.id);
1860
+ if ("id" in user) retVal = await this.db("users").returning(columns).update(user).where("id", user.id);
1861
1861
  } catch (e) {
1862
1862
  throw e;
1863
1863
  }
@@ -1945,8 +1945,7 @@ class FAMISDb {
1945
1945
  if (objCode && objCode.srs && acct && acct.srs && isFederal && !srsApproved && invoice.isIdt) {
1946
1946
  srsHighRisk = true;
1947
1947
  let val = [detail];
1948
- if (objectCodes.has(objCode.expense))
1949
- val.push(...objectCodes.get(objCode.expense));
1948
+ if (objectCodes.has(objCode.expense)) val.push(...objectCodes.get(objCode.expense));
1950
1949
  objectCodes.set(objCode.expense, val);
1951
1950
  }
1952
1951
  }
@@ -2106,8 +2105,7 @@ class FAMISDb {
2106
2105
  let response = null;
2107
2106
  try {
2108
2107
  const records = await this.db("invoice_comment_files").where({ uid: fileUid });
2109
- if (records.length)
2110
- response = records[0];
2108
+ if (records.length) response = records[0];
2111
2109
  } catch (e) {
2112
2110
  console.log(e);
2113
2111
  throw e;