@tamu-dor/famis-db 3.0.5 → 3.0.7

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 CHANGED
@@ -1,1185 +1,1155 @@
1
- export declare interface Account {
2
- uid: string;
3
- account_number: string;
4
- campus_code: string;
5
- fiscal_year: number;
6
- account: string;
7
- support_account: string;
8
- budget_support_account: string;
9
- budget_account_number: string;
10
- title: string | null;
11
- expiration_date: Date | null;
12
- status: string | null;
13
- uin: string;
14
- responsible_uin: string | null;
15
- department: string | null;
16
- setup_date: Date | null;
17
- budget_access: string | null;
18
- abr_rule: string;
19
- idt_allowed: boolean | null;
20
- adloc_campus_code: string | null;
21
- adloc_department: string | null;
22
- adloc_name: string | null;
23
- preferred_first_name: string | null;
24
- first_name: string | null;
25
- middle_name: string | null;
26
- last_name: string | null;
27
- email: string | null;
28
- work_phone: string | null;
29
- active: boolean | null;
30
- default_bank: string | null;
31
- bank_override: boolean | null;
32
- last_seen: Date | null;
33
- srs: boolean | null;
34
- cfda_no: string | null;
35
- sponsor_type: string | null;
36
- }
37
-
38
- export declare interface AccountBalance {
39
- account_number: string;
40
- campus_code: string;
41
- fiscal_year: number;
42
- account: string;
43
- support_account: string;
44
- description?: string | null;
45
- balance: number;
46
- }
47
-
48
- export declare interface AccountPayload {
49
- data: Account[];
50
- pagination: PageInfo;
51
- }
52
-
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;
67
- }
68
-
69
- export declare interface Core {
70
- id?: number;
71
- account?: string;
72
- effective?: string;
73
- facility?: string;
74
- contact: string;
75
- contactEmail: string;
76
- systemId: number;
77
- enabled: boolean;
78
- deleted: string | null;
79
- coreEmail?: string | null;
80
- corePhone: string | null;
81
- coreAddress: string | null;
82
- from_email: string | null;
83
- invoice_email: string | null;
84
- systemPart?: SystemPart;
85
- system_part?: string;
86
- system_name?: string;
87
- system_abbrev?: string;
88
- users?: CoreUser[];
89
- accounts?: CoreAccount[];
90
- }
91
-
92
- export declare interface CoreAccount {
93
- id?: number;
94
- account?: string;
95
- coreId: number;
96
- coreAccountId?: number;
97
- coreAccountActive?: boolean | null;
98
- effective?: Date | null;
99
- active?: boolean | null;
100
- }
101
-
102
- export declare interface CoreAccountEmail {
103
- uid?: string;
104
- core_id?: number;
105
- account_number?: string;
106
- email: string;
107
- created?: Date | null;
108
- deleted?: Date | null;
109
- }
110
-
111
- export declare interface CorePayload {
112
- data: Core[];
113
- pagination: PageInfo;
114
- }
115
-
116
- export declare interface CoreUser {
117
- id?: number;
118
- userId?: string;
119
- coreId: number;
120
- coreUserId?: number;
121
- email?: boolean | null;
122
- }
123
-
124
- export declare interface CustomerAccountInfo {
125
- uid: string;
126
- account_number: string;
127
- campus_code: string;
128
- fiscal_year: number;
129
- account: string;
130
- support_account: string;
131
- budget_support_account: string;
132
- budget_account_number: string;
133
- title: string;
134
- expiration_date: string;
135
- status: string;
136
- uin: string;
137
- responsible_uin: string;
138
- department: string;
139
- setup_date: string;
140
- budget_access: string;
141
- abr_rule: string;
142
- idt_allowed: boolean;
143
- adloc_campus_code: string;
144
- adloc_department: string;
145
- adloc_name: string;
146
- preferred_first_name: string;
147
- first_name: string;
148
- middle_name: string | null;
149
- last_name: string;
150
- email: string;
151
- work_phone: string;
152
- active: boolean;
153
- default_bank: string;
154
- bank_override: boolean;
155
- srs: boolean;
156
- cfda_no: string;
157
- sponsor_type: string;
158
- billingEmailId: string;
159
- parent_account_idt_allowed: boolean;
160
- }
161
-
162
- export declare interface Department {
163
- part: string;
164
- dept: string;
165
- sub?: string | null;
166
- dept_name: string;
167
- dept_head?: string | null;
168
- exec_level?: string | null;
169
- division?: string | null;
170
- school?: string | null;
171
- exp_date?: Date | null;
172
- idt_email?: string | null;
173
- id?: string | null;
174
- }
175
-
176
- export declare interface Details {
177
- ppu: number;
178
- date: string;
179
- famis: FamisDetails;
180
- other: string;
181
- amount: number;
182
- status: string;
183
- category: string;
184
- comments: string | null;
185
- quantity: number;
186
- pmtNumber: string | null;
187
- usageType: string;
188
- itemComment: string | null;
189
- customerName: string;
190
- purchaseDate: string;
191
- billingPeriod: string | null;
192
- customerEmail: string;
193
- customerTitle: string;
194
- itemDescription: string;
195
- sellingObjectCode: string;
196
- }
197
-
198
- export declare interface Edge {
199
- cursor: string;
200
- node: Invoice;
201
- }
202
-
203
- /**
204
- * @typedef {Object} Account@typedef {Object} Account
205
- * @property {string} uid
206
- * @property {string} account_number
207
- * @property {string} campus_code
208
- * @property {number} fiscal_year
209
- * @property {string} account
210
- * @property {string} support_account
211
- * @property {string} budget_support_account
212
- * @property {string} budget_account_number
213
- * @property {string | null} title
214
- * @property {Date | null} expiration_date
215
- * @property {string | null} status
216
- * @property {string} uin
217
- * @property {string | null} responsible_uin
218
- * @property {string | null} department
219
- * @property {Date | null} setup_date
220
- * @property {string | null} budget_access
221
- * @property {string} abr_rule
222
- * @property {boolean | null} idt_allowed
223
- * @property {string | null} adloc_campus_code
224
- * @property {string | null} adloc_department
225
- * @property {string | null} adloc_name
226
- * @property {string | null} preferred_first_name
227
- * @property {string | null} first_name
228
- * @property {string | null} middle_name
229
- * @property {string | null} last_name
230
- * @property {string | null} email
231
- * @property {string | null} work_phone
232
- * @property {boolean | null} active
233
- * @property {string | null} default_bank
234
- * @property {boolean | null} bank_override
235
- * @property {Date | null} last_seen
236
- * @property {boolean | null} srs
237
- * @property {string | null} cfda_no
238
- * @property {string | null} sponsor_type
239
- */
240
- /**
241
- * Represents the Core schema.
242
- * @typedef {Object} Core@typedef {Object} Core
243
- * @property {number} id - The ID.
244
- * @property {string} account - The account.
245
- * @property {string} effective - The effective date.
246
- * @property {string} facility - The facility.
247
- * @property {string} contact - The contact.
248
- * @property {string} contactEmail - The contact email.
249
- * @property {number} systemId - The system ID.
250
- * @property {boolean} enabled - Indicates if it's enabled.
251
- * @property {string | null} deleted - The deletion status.
252
- * @property {string} coreEmail - The core email.
253
- * @property {string | null} corePhone - The core phone.
254
- * @property {string | null} coreAddress - The core address.
255
- * @property {string | null} from_email - The from email.
256
- * @property {string | null} invoice_email - The invoice email.
257
- * @property {Object} systemPart - The system part.
258
- */
259
- /**
260
- * @typedef {Object} Edge@typedef {Object} Edge
261
- * @property {string} cursor - Description of the property.
262
- * @property {InvoiceSchema} node - Description of the property.
263
- */
264
- /**
265
- * @typedef {Object} PageInfo@typedef {Object} PageInfo
266
- * @property {boolean} hasNextPage - Description of the property.
267
- * @property {boolean} hasPreviousPage - Description of the property.
268
- * @property {string|null} [startCursor] - Description of the property.
269
- * @property {string|null} [endCursor] - Description of the property.
270
- */
271
- /**
272
- * @typedef {Object} InvoicePayload@typedef {Object} InvoicePayload
273
- * @property {Edge[]} edges - Description of the property.
274
- * @property {PageInfo} pageInfo - Description of the property.
275
- */
276
- /**
277
- * @typedef {Object} CorePayload@typedef {Object} CorePayload
278
- * @property {Edge[]} edges - Description of the property.
279
- * @property {PageInfo} pageInfo - Description of the property.
280
- */
281
- declare class FAMISDb {
282
- private db;
283
- private people;
284
- constructor(config: any, people: any, debug: boolean);
285
- /**
286
- * Initializes the database connection and sets up the Knex instance for interacting with PostgreSQL database.
287
- *
288
- * @param {any} config - The configuration object that includes details about how to connect to a PostgreSQL database. This should include properties such as `host`, `user`, `password`, etc.
289
- * @param {any} people - The data related to the 'people' entity. It could be an array of person objects or any other format depending on your application requirements.
290
- * @param {boolean} debug - A flag indicating whether to enable debugging for Knex queries. Defaults to `false`. If set to `true`, it will log all SQL queries that are executed against the database in the console.
291
- */
292
- init(config: any, people?: any, debug?: boolean): void;
293
- /**
294
- *
295
- * Extract customer account and po number
296
- * @param {object} famis
297
- * @param {object} replace_data
298
- * @returns {object} account number object
299
- * @memberof FAMISDb
300
- */
301
- getAccountNumber(famis: {
302
- customerAccountNumber: string;
303
- customerPONumber: string;
304
- }, replace_data?: {
305
- customerAccountNumber?: string;
306
- customerPONumber?: string;
307
- }): {
308
- accountNumber: string;
309
- poNumber: string | null;
310
- };
311
- /**
312
- *
313
- * Process an invoice to have all necessary relationships
314
- * @param {object} invoice - the invoice object sent by iLab
315
- * @param {boolean} [historical=false] - if true use historical accounts too
316
- * @param {string[]} excludeFields - fields to exclude from results
317
- * @returns {Promise<object>} invoice object
318
- * @memberof FAMISDb
319
- */
320
- processInvoice(invoice: any, historical?: boolean, excludeFields?: string[]): Promise<any>;
321
- /**
322
- *
323
- * Get invoice by uid
324
- * @param {string} uid
325
- * @param {string} [sortColumn='date']
326
- * @param {string} [sortDirection='desc']
327
- * @param {boolean} [deleted=false]
328
- * @param {integer} page - page of results to return
329
- * @param {string} perPage - number of results per page to return
330
- * @returns {Promise<InvoicePayload>} invoice object
331
- * @memberof FAMISDb
332
- */
333
- getInvoiceByUid(uid: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
334
- /**
335
- *
336
- * Get invoice by originating system assigned number
337
- * @param {string} number
338
- * @param {string} [sortColumn='date']
339
- * @param {string} [sortDirection='desc']
340
- * @param {boolean} [deleted=false]
341
- * @param {integer} page - page of results to return
342
- * @param {string} perPage - number of results per page to return
343
- * @returns {Promise<InvoicePayload>} invoice object
344
- * @memberof FAMISDb
345
- */
346
- getInvoiceByNumber(number: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
347
- /**
348
- *
349
- * Get invoice by fingerprint
350
- * @param {string} fingerPrint
351
- * @returns {Promise<object>} invoice object
352
- * @memberof FAMISDb
353
- */
354
- getInvoiceByFingerPrint(fingerPrint: string): Promise<any>;
355
- /**
356
- *
357
- * Get all invoices associated with a specified account number
358
- * @param {string} accountNumber
359
- * @param {string} [sortColumn='date']
360
- * @param {string} [sortDirection='desc']
361
- * @param {boolean} [deleted=false]
362
- * @param {integer} page - page of results to return
363
- * @param {string} perPage - number of results per page to return
364
- * @returns {Promise<InvoicePayload>} invoice objects
365
- * @memberof FAMISDb
366
- */
367
- getInvoicesByAccount(accountNumber: string | string[], sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
368
- /**
369
- *
370
- * Get all invoice ordered by and sorted by parameters passed
371
- * @param {string} [sortColumn='date']
372
- * @param {string} [sortDirection='desc']
373
- * @param {boolean} [deleted=false]
374
- * @param {integer} page - page of results to return
375
- * @param {string} perPage - number of results per page to return
376
- * @returns {Promise<InvoicePayload>} invoice objects
377
- * @memberof FAMISDb
378
- */
379
- getAllInvoices(sortColumn?: string, sortDirection?: SortDirection | string, deleted?: boolean, page?: number, perPage?: number): Promise<InvoicePayload>;
380
- /**
381
- *
382
- * Retrieves invoices from the latest date
383
- * @param {string} [sortColumn='date']
384
- * @param {string} [sortDirection='desc']
385
- * @param {integer} first - corresponds to the first param of the Relay spec
386
- * @param {string} after - corresponds to the after param of the Relay spec
387
- * @param {integer} last - corresponds to the last param of the Relay spec
388
- * @param {string} before - corresponds to the before param of the Relay spec
389
- * @returns {Promise<InvoicePayload>} invoice objects
390
- * @memberof FAMISDb
391
- */
392
- getLatestInvoices(sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
393
- /**
394
- *
395
- * Returns all held invoices
396
- * @param {string} [sortColumn='date']
397
- * @param {string} [sortDirection='desc']
398
- * @param {integer} page - corresponds to the first param of the Relay spec
399
- * @param {integer} perPage - corresponds to the last param of the Relay spec
400
- * @returns {Promise<InvoicePayload>} held invoice objects
401
- * @memberof FAMISDb
402
- */
403
- getHeldInvoices(sortColumn?: string, sortDirection?: string, page?: number, perPage?: number): Promise<InvoicePayload>;
404
- /**
405
- *
406
- * Returns all awaiting email invoices
407
- * @param {string} [sortColumn='date']
408
- * @param {string} [sortDirection='desc']
409
- * @param {integer} first - corresponds to the first param of the Relay spec
410
- * @param {string} after - corresponds to the after param of the Relay spec
411
- * @param {integer} last - corresponds to the last param of the Relay spec
412
- * @param {string} before - corresponds to the before param of the Relay spec
413
- * @returns {Promise<InvoicePayload>} awaiting email invoice objects
414
- * @memberof FAMISDb
415
- */
416
- getInvoicesAwaitingEmail(sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
417
- /**
418
- *
419
- * Search invoices by originating system generated invoice number
420
- * @param {string} number
421
- * @param {string} [sortColumn='date']
422
- * @param {string} [sortDirection='desc']
423
- * @param {integer} first - corresponds to the first param of the Relay spec
424
- * @param {string} after - corresponds to the after param of the Relay spec
425
- * @param {integer} last - corresponds to the last param of the Relay spec
426
- * @param {string} before - corresponds to the before param of the Relay spec
427
- * @returns {Promise<InvoicePayload>} invoice objects
428
- * @memberof FAMISDb
429
- */
430
- searchInvoicesByNumber(number: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
431
- /**
432
- *
433
- * Search invoices by famis account number
434
- * @param {string} account
435
- * @param {string} [sortColumn='date']
436
- * @param {string} [sortDirection='desc']
437
- * @param {integer} first - corresponds to the first param of the Relay spec
438
- * @param {string} after - corresponds to the after param of the Relay spec
439
- * @param {integer} last - corresponds to the last param of the Relay spec
440
- * @param {string} before - corresponds to the before param of the Relay spec
441
- * @returns {Promise<InvoicePayload>} invoice objects
442
- * @memberof FAMISDb
443
- */
444
- searchInvoicesByAccountNumber(account: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
445
- /**
446
- *
447
- * Search invoices by FAMIS invoice number
448
- * @param {string} famis
449
- * @param {string} [sortColumn='date']
450
- * @param {string} [sortDirection='desc']
451
- * @param {integer} page - page of results to return
452
- * @param {integer} perPage - number of results per page to return
453
- * @returns {Promise<InvoicePayload>} invoice objects
454
- * @memberof FAMISDb
455
- */
456
- searchInvoicesByFamis(famis: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
457
- /**
458
- *
459
- * Queries invoices
460
- * @param {string} query
461
- * @param {string} [sortColumn='date']
462
- * @param {string} [sortDirection='desc']
463
- * @param {integer} page - page of results to return
464
- * @param {integer} perPage - number of results per page to return
465
- * @param {string[]} excludeFields - fields to exclude from results
466
- * @returns {Promise<InvoicePayload>} invoice objects
467
- * @memberof FAMISDb
468
- */
469
- queryInvoices(query: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number, excludeFields?: string[]): Promise<InvoicePayload>;
470
- /**
471
- *
472
- * Adds an invoice
473
- * @param {object} invoice
474
- * @param {string} type
475
- * @param {string} famisInvoiceNumber
476
- * @returns {Promise<object>} invoice
477
- * @memberof FAMISDb
478
- */
479
- addInvoice(invoice: any, type: string, famisInvoiceNumber?: string): Promise<any>;
480
- /**
481
- *
482
- * Updates an invoice
483
- * @param {string} uid
484
- * @param {Invoice} invoice
485
- * @returns {Promise<Invoice>} invoice object
486
- * @memberof FAMISDb
487
- */
488
- updateInvoice(uid: string, invoice: Invoice): Promise<InvoicePayload>;
489
- /**
490
- *
491
- * Toggles an invoice as paid
492
- * @param {string} uid
493
- * @param {boolean} invoiced
494
- * @returns {Promise<object>} invoice object
495
- * @memberof FAMISDb
496
- */
497
- markInvoiced(uid: string, invoiced: boolean): Promise<any>;
498
- /**
499
- *
500
- * Toggles an invoice as emailed
501
- * @param {string} uid
502
- * @param {boolean} emailed
503
- * @returns {Promise<object>} invoice object
504
- * @memberof FAMISDb
505
- */
506
- markEmailed(uid: string, emailed: boolean): Promise<any>;
507
- /**
508
- *
509
- * Sets an invoice's deletion date
510
- * @param {string} uid
511
- * @param {date} deleted
512
- * @returns {Promise<object>} invoice object
513
- * @memberof FAMISDb
514
- */
515
- setDeleted(uid: string, deleted: Date): Promise<any>;
516
- /**
517
- *
518
- * Sets an invoice's posted date
519
- * @param {string} uid
520
- * @param {date} postedDate
521
- * @returns {Promise<object>} invoice object
522
- * @memberof FAMISDb
523
- */
524
- setInvoicePostedDate(uid: string, postedDate: Date | null): Promise<any>;
525
- /**
526
- *
527
- * Sets an invoice's fingerprint
528
- * @param {string} uid
529
- * @param {string} fingerprint
530
- * @returns {Promise<object>} invoice object
531
- * @memberof FAMISDb
532
- */
533
- setInvoiceFingerPrint(uid: string, fingerprint: string): Promise<any>;
534
- /**
535
- *
536
- * Get PI accounts by account number
537
- * @param {string} number
538
- * @param {string} campus
539
- * @param {boolean} [historical=false]
540
- * @returns {Promise<Account>} account object
541
- * @memberof FAMISDb
542
- */
543
- getByAccountNumber(number: string, campus?: string, historical?: boolean): Promise<any>;
544
- /**
545
- *
546
- * Search PI accounts by partial account number
547
- * @param {string|string[]} number
548
- * @returns {Promise<AccountPayload>} account object(s)
549
- * @memberof FAMISDb
550
- */
551
- searchByAccountNumber(number: string | string[], sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<AccountPayload>;
552
- /**
553
- *
554
- * Get PI Accounts by UIN
555
- * @param {string|string[]} uin
556
- * @returns {Promise<Account[]>} account object array
557
- * @memberof FAMISDb
558
- */
559
- getAccountsByUin(uin: string | string[], responsible?: boolean, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<AccountPayload>;
560
- /**
561
- *
562
- * Get PI accounts by responsible UIN
563
- * @param {string} uin
564
- * @returns {Promise<Account[]>} account object array
565
- * @memberof FAMISDb
566
- */
567
- getAccountsByResponsibleUin(uin: string | string[]): Promise<Account[]>;
568
- /**
569
- *
570
- * Queries accounts
571
- * @param {string} query
572
- * @param {string} [sortColumn='date']
573
- * @param {string} [sortDirection='desc']
574
- * @param {integer} page - page of results to return
575
- * @param {integer} perPage - number of results per page to return
576
- * @returns {Promise<AccountPayload>} invoice objects
577
- * @memberof FAMISDb
578
- */
579
- queryAccounts(query: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<AccountPayload>;
580
- /**
581
- *
582
- * Get next FAMIS invoice number in sequence for specified invoice type
583
- * @param {string} invoice
584
- * @returns {Promise<string>} next invoice number in sequence
585
- * @memberof FAMISDb
586
- */
587
- getNextFAMISInvoiceNumber(type: string): Promise<string>;
588
- /**
589
- *
590
- * Get matching expense code for specified revenue code
591
- * @param {string} revenue
592
- * @returns {Promise<string>} expense code
593
- * @memberof FAMISDb
594
- */
595
- getExpenseCodeByRevenue(revenue: string): Promise<string>;
596
- /**
597
- * Represents a row in the 'codes' table.
598
- * @typedef {Object} Code@typedef {Object} Code
599
- * @property {number} id - The unique identifier for the code.
600
- * @property {string|null} revenue - The revenue code (nullable).
601
- * @property {string|null} expense - The expense code (nullable).
602
- * @property {boolean} sales - Indicates if the code is associated with sales.
603
- * @property {boolean} srs - Indicates if the code is associated with SRS.
604
- */
605
- /**
606
- *
607
- * Get revenue code object
608
- * @param {string} revenue
609
- * @returns {Promise<Code>} revenue code object
610
- * @memberof FAMISDb
611
- */
612
- getRevenueCode(revenue: string): Promise<FAMISObjectCode>;
613
- /**
614
- *
615
- * Get expense code object
616
- * @param {string} code
617
- * @returns {Promise<Code>} expense code object
618
- * @memberof FAMISDb
619
- */
620
- getExpenseCode(code: string): Promise<FAMISObjectCode>;
621
- /**
622
- *
623
- * Check if expense code is within the allowable range for specified account and the specified fiscal year (defaults to the current)
624
- * @param {string} accountNumber
625
- * @param {string} code
626
- * @param {integer} fiscal
627
- * @returns {Promise<boolean>} truthy value
628
- * @memberof FAMISDb
629
- */
630
- allowableExpenseCode(accountNumber: string, code: string, fiscal?: number): Promise<boolean>;
631
- /**
632
- *
633
- * Get allowable expense code ranges for the specified account
634
- * @param {string} accountNumber
635
- * @param {integer} fiscal
636
- * @returns {Promise<boolean>} expense code range object(s)
637
- * @memberof FAMISDb
638
- */
639
- getAllowableExpenseCodes(accountNumber: string, fiscal?: number): Promise<{
640
- allowed: object[];
641
- disallowed: object[];
642
- }>;
643
- /**
644
- *
645
- * Query cores
646
- * @param {string} query
647
- * @param {string} [sortColumn='facility']
648
- * @param {string} [sortDirection='asc']
649
- * @param {integer} page - page of results to return
650
- * @param {integer} perPage - number of results per page to return
651
- * @param {string[]} excludeFields - fields to exclude from results
652
- * @returns {Promise<CorePayload>} core objects
653
- * @memberof FAMISDb
654
- */
655
- queryCores(query: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number, excludeFields?: string[]): Promise<CorePayload>;
656
- /**
657
- *
658
- * Get core by specified attribute and search term
659
- * @param {string} type
660
- * @param {string} operator
661
- * @param {string} search
662
- * @param {string[]} excludeFields - fields to exclude from results
663
- * @returns {Promise<Core>} core object
664
- * @memberof FAMISDb
665
- */
666
- getCore(type: string, operator: string | undefined, search: string, excludeFields?: string[]): Promise<Core>;
667
- /**
668
- *
669
- * Get core by id
670
- * @param {string} id
671
- * @returns {Promise<Core>} core object
672
- * @memberof FAMISDb
673
- */
674
- getCoreById(id: string): Promise<Core>;
675
- /**
676
- *
677
- * Get core by account number
678
- * @param {string} account
679
- * @returns {Promise<Core>} core object
680
- * @param {string[]} excludeFields - fields to exclude from results
681
- * @memberof FAMISDb
682
- */
683
- getCoreByAccount(account: string, excludeFields?: string[]): Promise<Core>;
684
- /**
685
- *
686
- * Update core
687
- * @param {Core} core object
688
- * @returns {Promise<Core>} core object
689
- * @memberof FAMISDb
690
- */
691
- updateCore(core: Core): Promise<Core | undefined>;
692
- /**
693
- *
694
- * Add core
695
- * @param {Core} core object
696
- * @returns {Promise<Core>} core object
697
- * @memberof FAMISDb
698
- */
699
- addCore(core: Core): Promise<Core>;
700
- /**
701
- *
702
- * Update core account
703
- * @param {CoreAccount} account object
704
- * @returns {Promise<CoreAccount>} core_account object
705
- * @memberof FAMISDb
706
- */
707
- updateCoreAccount(account: CoreAccount): Promise<CoreAccount>;
708
- /**
709
- *
710
- * Add core_account
711
- * @param {CoreAccount} account object
712
- * @returns {Promise<CoreAccount>} core_account object
713
- * @memberof FAMISDb
714
- */
715
- addCoreAccount(account: CoreAccount): Promise<CoreAccount>;
716
- /**
717
- *
718
- * Delete core account
719
- * @param {coreAccountId} string core account id
720
- * @returns {Promise<CoreAccount>} core account object
721
- * @memberof FAMISDb
722
- */
723
- deleteCoreAccount(coreAccountId: string): Promise<CoreAccount>;
724
- /**
725
- *
726
- * Get system part by ID
727
- * @param {number} id
728
- * @param {string[]} excludeFields - fields to exclude from results
729
- * @returns {Promise<SystemPart>} system part object
730
- * @memberof FAMISDb
731
- */
732
- getSystemById(id: number, excludeFields?: string[]): Promise<SystemPart>;
733
- /**
734
- *
735
- * Get system part by two-digit part number
736
- * @param {string} number
737
- * @returns {Promise<SystemPart>} system part object
738
- * @memberof FAMISDb
739
- */
740
- getSystemByPartNumber(number: string): Promise<SystemPart>;
741
- /**
742
- *
743
- * Get all enabled cores
744
- * @returns {Promise<Core[]>} core objects
745
- * @memberof FAMISDb
746
- */
747
- getEnabledCores(): Promise<Core[]>;
748
- /**
749
- *
750
- * Get all cores
751
- * @param {string} [sortColumn='facility']
752
- * @param {string} [sortDirection='asc']
753
- * @param {boolean} [deleted=false]
754
- * @param {integer} page - page of results to return
755
- * @param {string} perPage - number of results per page to return
756
- * @returns {Promise<CorePayload>} core objects
757
- * @memberof FAMISDb
758
- */
759
- getAllCores(sortColumn?: string, sortDirection?: SortDirection | string, deleted?: boolean, page?: number, perPage?: number): Promise<CorePayload>;
760
- /**
761
- *
762
- * Get a core's users by core ID
763
- * @param {number} coreId
764
- * @returns {Promise<Core[]>} user objects
765
- * @memberof FAMISDb
766
- */
767
- getCoreUsers(coreId: number): Promise<Core[]>;
768
- /**
769
- *
770
- * Update core user
771
- * @param {CoreUser} user object
772
- * @returns {Promise<CoreUser>} user_core object
773
- * @memberof FAMISDb
774
- */
775
- updateCoreUser(user: CoreUser): Promise<CoreUser>;
776
- /**
777
- * This function adds a new CoreUser to the database. If the user already exists, it updates the existing record.
778
- * @param {CoreUser} coreUser - The CoreUser object containing details about the user.
779
- * @return {Promise<CoreUser>} A Promise that resolves to the newly added or updated CoreUser, if successfully added and returned from the database; otherwise it rejects with an error.
780
- */
781
- addCoreUser(coreUser: CoreUser): Promise<CoreUser>;
782
- /**
783
- *
784
- * Delete core user
785
- * @param {coreUserId} string core user object
786
- * @returns {Promise<CoreUser>} core user object
787
- * @memberof FAMISDb
788
- */
789
- deleteCoreUser(coreUserId: string): Promise<CoreUser>;
790
- /**
791
- *
792
- * Get a user's cores they manage
793
- * @param {string} userId
794
- * @param {string} [sortColumn='facility']
795
- * @param {string} [sortDirection='asc']
796
- * @param {boolean} [deleted=false]
797
- * @param {integer} page - page of results to return
798
- * @param {string} perPage - number of results per page to return
799
- * @returns {Promise<CorePayload]>} core objects
800
- * @memberof FAMISDb
801
- */
802
- getUserCores(userId: string, sortColumn?: string, sortDirection?: SortDirection | string, deleted?: boolean, page?: number, perPage?: number): Promise<CorePayload>;
803
- /**
804
- *
805
- * Get a system part's users by system ID
806
- * @param {number} systemId
807
- * @returns {Promise<object[]>} user objects
808
- * @memberof FAMISDb
809
- */
810
- getSystemUsers(systemId: number): Promise<User[]>;
811
- /**
812
- *
813
- * Get a user's system parts they manage
814
- * @param {string} userId
815
- * @returns {Promise<SystemPart[]>} system objects
816
- * @memberof FAMISDb
817
- */
818
- getUserSystemParts(userId: string): Promise<SystemPart[]>;
819
- /**
820
- * Represents the "system" table in the public schema.
821
- * @typedef {Object} System@typedef {Object} System
822
- * @property {number} id - The ID (auto-generated).
823
- * @property {string | null} name - The name.
824
- * @property {string | null} due - The due text.
825
- * @property {string | null} fein - The FEIN (Federal Employer Identification Number).
826
- * @property {string | null} agency - The agency.
827
- * @property {string | null} checkAddress - The check address.
828
- * @property {boolean} credit - Indicates if credit is allowed.
829
- * @property {string | null} creditUrl - The credit URL.
830
- * @property {string | null} creditFee - The credit fee.
831
- * @property {string | null} part - The part.
832
- * @property {string | null} abbrev - The abbreviation.
833
- * @property {string | null} aggiebuy - The AggieBuy information.
834
- * @property {string | null} image - The image URL.
835
- */
836
- /**
837
- * Get all system parts.
838
- * @returns {Promise<SystemPart[]>} System objects.
839
- * @memberof FAMISDb
840
- */
841
- getAllSystemParts(): Promise<SystemPart[]>;
842
- /**
843
- * Get all admin users.
844
- * @returns {Promise<object[]>} Array of user objects.
845
- * @memberof FAMISDb
846
- */
847
- getAdminUsers(): Promise<User[] | []>;
848
- /**
849
- * Get user.
850
- * @param {string} userId - User ID.
851
- * @returns {Promise<object>} User object.
852
- * @memberof FAMISDb
853
- */
854
- getUser(userId: string): Promise<User | null>;
855
- /**
856
- * Update user.
857
- * @param {object} user - User object.
858
- * @returns {Promise<object>} Updated user object.
859
- * @memberof FAMISDb
860
- */
861
- updateUser(user: object): Promise<object | null>;
862
- /**
863
- * Get customer by customer account number.
864
- * @param {string} accountNumber - Customer account number.
865
- * @param {string} campusCode - Campus code.
866
- * @returns {Promise<object>} Customer account object.
867
- * @memberof FAMISDb
868
- */
869
- getCustomerNumber(accountNumber: string, campusCode: string): Promise<object | null>;
870
- /**
871
- * Get current fiscal year.
872
- * @returns {number} Fiscal year.
873
- * @memberof FAMISDb
874
- */
875
- getCurrentFiscalYear(): number;
876
- /**
877
- * Return fingerprint of invoice.
878
- * @param {object} invoice - JSON object.
879
- * @returns {string} Fingerprint.
880
- * @memberof FAMISDb
881
- */
882
- getInvoiceFingerPrint(invoice: object): string;
883
- /**
884
- * Return formatted account number.
885
- * @param {string} accountNumber - Unformatted 13-digit FAMIS account number.
886
- * @returns {string} Formatted 13-digit FAMIS account number.
887
- * @memberof FAMISDb
888
- */
889
- formatAccountNumber(accountNumber: string): string;
890
- /**
891
- * Is invoice flagged by SRS high-risk policies.
892
- * @param {object} invoice - JSON object.
893
- * @returns {Promise<HighRisk>} High-risk object.
894
- * @memberof FAMISDb
895
- */
896
- isSrsHighRisk(invoice: Invoice): Promise<HighRiskInfo>;
897
- /**
898
- * @typedef {Object} Comment@typedef {Object} Comment
899
- * @property {integer} id - db generated id
900
- * @property {string} uid - uid
901
- * @property {string} invoice_id - invoice id
902
- * @property {string} user_id - user uid
903
- * @property {string} comment - text of comment
904
- * @property {string} type - type of comment
905
- * @property {date} created - created date
906
- * @property {date} deleted - deleted date
907
- */
908
- /**
909
- * Create or update an invoice comment.
910
- * @param {Comment} comment - JSON object representing the comment
911
- * @returns {Promise<Comment>} - Promise that resolves to the comment object
912
- * @memberof FAMISDb
913
- */
914
- saveComment(comment: InvoiceComment): Promise<InvoiceComment | null>;
915
- /**
916
- * Get comments associated with an invoice.
917
- * @param {string} invoiceUid - Invoice UID
918
- * @returns {Promise<Comment[]>} - Promise that resolves to an array of comment objects
919
- * @memberof FAMISDb
920
- */
921
- getInvoiceComments(invoiceUid: string): Promise<InvoiceComment[]>;
922
- /**
923
- * @typedef {Object} CommentFile@typedef {Object} CommentFile
924
- * @property {integer} id - db generated id
925
- * @property {string} uid - uid
926
- * @property {string} invoice_id - invoice uid
927
- * @property {string} comment_id - comment uid
928
- * @property {string} original_filename - original file name
929
- * @property {string} filename - generate unique filename on filesystem
930
- * @property {date} created - created date
931
- * @property {date} deleted - deleted date
932
- */
933
- /**
934
- * Create an invoice comment file.
935
- * @param {InvoiceCommentFile} file - JSON object representing the comment file
936
- * @returns {Promise<InvoiceCommentFile>} - Promise that resolves to the comment file object
937
- * @memberof FAMISDb
938
- */
939
- saveCommentFile(file: InvoiceCommentFile): Promise<InvoiceCommentFile | null>;
940
- /**
941
- * Get invoice comment files.
942
- * @param {string} commentUid - Comment UID
943
- * @returns {Promise<CommentFile[]>} - Promise that resolves to an array of comment file objects
944
- * @memberof FAMISDb
945
- */
946
- getCommentFiles(commentUid: string): Promise<InvoiceCommentFile[] | []>;
947
- /**
948
- * Get invoice comment file.
949
- * @param {string} fileUid - File UID
950
- * @returns {Promise<CommentFile>} - Promise that resolves to a comment file object
951
- * @memberof FAMISDb
952
- */
953
- getCommentFile(fileUid: string): Promise<InvoiceCommentFile | null>;
954
- /**
955
- * Represents a row in the public.core_account_emails table.
956
- *
957
- * @interface CoreAccountEmail
958
- * @property {string} uid - The unique identifier for the account email.
959
- * @property {number} core_id - The core ID associated with the account email.
960
- * @property {string} account_number - The account number associated with the email.
961
- * @property {string} email - The email address associated with the account.
962
- * @property {Date | null} [created] - The timestamp when the account email was created. Nullable.
963
- * @property {Date | null} [deleted] - The timestamp when the account email was deleted. Nullable.
964
- */
965
- /**
966
- * Get additional delivery email to an expense accounts by uid
967
- * @param {string} uid - additional delivery email record uid
968
- * @returns {Promise<CoreAccountEmail|null>} - Promise that resolves to an account object
969
- * @memberof FAMISDb
970
- */
971
- getCoreAccountAdditionalEmailByUid(uid: string): Promise<CoreAccountEmail | null>;
972
- /**
973
- * Get additional delivery emails to expense accounts for a core by core id
974
- * @param {number} coreId - Core ID
975
- * @returns {Promise<CoreAccountEmail[]|[]>} - Promise that resolves to an account object
976
- * @memberof FAMISDb
977
- */
978
- getCoreAccountAdditionalEmailsByCoreId(coreId: number): Promise<CoreAccountEmail[] | []>;
979
- /**
980
- * Get additional delivery emails to expense accounts for a core by account number
981
- * @param {string} accountNumber - 13 digit famis account or customernumber
982
- * @returns {Promise<CoreAccountEmail[]|[]>} - Promise that resolves to an account object
983
- * @memberof FAMISDb
984
- */
985
- getCoreAccountAdditionalEmailsByAccount(accountNumber: string): Promise<CoreAccountEmail[] | []>;
986
- /**
987
- * Get additional delivery emails to expense accounts for a core by core id
988
- * and account number
989
- * @param {number} coreId - Core ID
990
- * @param {string} account - account number
991
- * @returns {Promise<CoreAccountEmail[]|[]>} - Promise that resolves to an account object
992
- * @memberof FAMISDb
993
- */
994
- getCoreAccountAdditionalEmailsByCoreIdAccount(coreId: number, account: string): Promise<CoreAccountEmail[] | []>;
995
- /**
996
- * Add an additional delivery email to an expense account for a core
997
- * @param {CoreAccountEmail} record - core account email delivery record
998
- * @returns {Promise<CoreAccountEmail>} - Promise that resolves to an account object
999
- * @memberof FAMISDb
1000
- */
1001
- addCoreAccountAdditionalEmail(record: CoreAccountEmail): Promise<CoreAccountEmail | null>;
1002
- /**
1003
- * Remove an additional delivery email to an expense account for a core
1004
- * @param {string} uid - uid for core account email record
1005
- * @returns {Promise<CoreAccountEmail>} - Promise that resolves to an account object
1006
- * @memberof FAMISDb
1007
- */
1008
- removeCoreAccountAdditionalEmail(uid: string): Promise<CoreAccountEmail | null>;
1009
- }
1010
- export default FAMISDb;
1011
-
1012
- export declare interface FamisDetails {
1013
- invoiceType: string;
1014
- invoiceNumber: string;
1015
- customerPONumber: string;
1016
- invoiceDepartment: string;
1017
- sellingCampusCode: string;
1018
- sellingAccountNumber: string;
1019
- customerAccountNumber: string;
1020
- sellingSupportAccount: string;
1021
- }
1022
-
1023
- export declare type FAMISObjectCode = {
1024
- id: number;
1025
- revenue: string | null;
1026
- expense: string | null;
1027
- sales: boolean;
1028
- srs: boolean;
1029
- };
1030
-
1031
- export declare interface HighRiskInfo {
1032
- isHighRisk: boolean;
1033
- flaggedTransactions: Details[];
1034
- }
1035
-
1036
- export declare interface HighRiskTransaction {
1037
- [key: number]: Details[];
1038
- }
1039
-
1040
- export declare interface Invoice {
1041
- uid?: string | null;
1042
- number?: string | null;
1043
- lab?: string | null;
1044
- totalAmount?: string;
1045
- date?: string;
1046
- data: TransactionData;
1047
- invoiced: boolean;
1048
- type: string;
1049
- famisInvoiceNumber: string;
1050
- deleted: string | null;
1051
- customerAccount: string;
1052
- sellingAccount: string;
1053
- postedDate: string | null;
1054
- emailed: boolean;
1055
- replace_data?: object | null;
1056
- fingerprint?: string | null;
1057
- core?: Core | null;
1058
- customerAccountInfo?: CustomerAccountInfo | null;
1059
- isIdt?: boolean | null;
1060
- poNumber?: string | null;
1061
- pi?: PI | null;
1062
- highRiskInfo?: HighRiskInfo | null;
1063
- comments?: InvoiceComment[] | null;
1064
- }
1065
-
1066
- export declare interface InvoiceComment {
1067
- id?: number;
1068
- uid?: string;
1069
- invoice_id: string;
1070
- user_id?: string | null;
1071
- comment: string | null;
1072
- type: string | null;
1073
- created: string | null;
1074
- deleted: string | null;
1075
- }
1076
-
1077
- export declare type InvoiceCommentFile = {
1078
- id?: number;
1079
- uid: string;
1080
- invoice_id: string;
1081
- comment_id: string;
1082
- original_filename: string | null;
1083
- filename: string | null;
1084
- created: Date | null;
1085
- deleted: Date | null;
1086
- };
1087
-
1088
- export declare interface InvoicePayload {
1089
- data: Invoice[];
1090
- pagination: PageInfo;
1091
- }
1092
-
1093
- export declare interface IsHighRisk {
1094
- isHighRisk: boolean;
1095
- flaggedTransactions: Details[];
1096
- }
1097
-
1098
- export declare interface PageInfo {
1099
- total?: number;
1100
- lastPage?: number;
1101
- currentPage: number;
1102
- perPage: number;
1103
- from: number;
1104
- to: number;
1105
- }
1106
-
1107
- export declare interface PI {
1108
- tamuEduPersonUIN: string;
1109
- tamuEduPersonNetID: string | null;
1110
- uid: string;
1111
- sn: string;
1112
- givenName: string;
1113
- cn: string[];
1114
- displayName: string;
1115
- tamuEduPersonOfficialName: string;
1116
- mail: string;
1117
- postalAddress: string;
1118
- mailStop: string;
1119
- localityName: string;
1120
- stateOrProvinceName: string;
1121
- postalCode: string;
1122
- telephoneNumber: string;
1123
- title: string;
1124
- tamuEduPersonTitleCode: string;
1125
- tamuEduPersonDepartmentName: string;
1126
- tamuEduPersonPrimaryMember: string;
1127
- tamuEduPersonMember: string[];
1128
- tamuEduPersonPrimaryMemberName: string | null;
1129
- tamuEduPersonAffiliation: string[];
1130
- eduPersonOrcid: string | null;
1131
- tamuEduPersonAdLoc: string;
1132
- tamuEduPersonEmpLoc: string;
1133
- tamuEduDataFeed: string[];
1134
- tamuLastSeenTimestamp: string | null;
1135
- tamuEduPersonSupervisorUIN: string;
1136
- tamuManualAddRDN: string | null;
1137
- }
1138
-
1139
- export declare type SortDirection = "asc" | "desc";
1140
-
1141
- export declare interface SystemPart {
1142
- id: number;
1143
- name: string;
1144
- due: string;
1145
- fein: string;
1146
- agency: string;
1147
- checkAddress: string;
1148
- credit?: boolean | null;
1149
- creditUrl?: string | null;
1150
- creditFee?: string | null;
1151
- part: string;
1152
- abbrev: string;
1153
- aggiebuy: string;
1154
- image: string;
1155
- }
1156
-
1157
- export declare interface TransactionData {
1158
- to: Contact;
1159
- lab: string;
1160
- date: string;
1161
- from: Contact;
1162
- number: string;
1163
- details: Details[];
1164
- fingerprint: string;
1165
- totalAmount: string;
1166
- }
1167
-
1168
- export declare type User = {
1169
- id?: number;
1170
- userId: string;
1171
- admin?: boolean;
1172
- role?: boolean;
1173
- roleName?: string | null;
1174
- roleEmail?: string | null;
1175
- email?: string | null;
1176
- usersSystemId?: number | null;
1177
- systemId?: number | null;
1178
- coreId?: number | null;
1179
- coreUserId?: number | null;
1180
- cores?: CorePayload | null;
1181
- systems?: SystemPart[] | [] | null;
1182
- deleted?: Date | null;
1183
- };
1184
-
1185
- export { }
1
+ export type SortDirection = "asc" | "desc";
2
+ export interface PI {
3
+ tamuEduPersonUIN: string;
4
+ tamuEduPersonNetID: string | null;
5
+ uid: string;
6
+ sn: string;
7
+ givenName: string;
8
+ cn: string[];
9
+ displayName: string;
10
+ tamuEduPersonOfficialName: string;
11
+ mail: string;
12
+ postalAddress: string;
13
+ mailStop: string;
14
+ localityName: string;
15
+ stateOrProvinceName: string;
16
+ postalCode: string;
17
+ telephoneNumber: string;
18
+ title: string;
19
+ tamuEduPersonTitleCode: string;
20
+ tamuEduPersonDepartmentName: string;
21
+ tamuEduPersonPrimaryMember: string;
22
+ tamuEduPersonMember: string[];
23
+ tamuEduPersonPrimaryMemberName: string | null;
24
+ tamuEduPersonAffiliation: string[];
25
+ eduPersonOrcid: string | null;
26
+ tamuEduPersonAdLoc: string;
27
+ tamuEduPersonEmpLoc: string;
28
+ tamuEduDataFeed: string[];
29
+ tamuLastSeenTimestamp: string | null;
30
+ tamuEduPersonSupervisorUIN: string;
31
+ tamuManualAddRDN: string | null;
32
+ }
33
+ export interface AccountBalance {
34
+ account_number: string;
35
+ campus_code: string;
36
+ fiscal_year: number;
37
+ account: string;
38
+ support_account: string;
39
+ description?: string | null;
40
+ balance: number;
41
+ }
42
+ export interface Department {
43
+ part: string;
44
+ dept: string;
45
+ sub?: string | null;
46
+ dept_name: string;
47
+ dept_head?: string | null;
48
+ exec_level?: string | null;
49
+ division?: string | null;
50
+ school?: string | null;
51
+ exp_date?: Date | null;
52
+ idt_email?: string | null;
53
+ id?: string | null;
54
+ }
55
+ export interface CoreAccountEmail {
56
+ uid?: string;
57
+ core_id?: number;
58
+ account_number?: string;
59
+ email: string;
60
+ created?: Date | null;
61
+ deleted?: Date | null;
62
+ }
63
+ export type FAMISObjectCode = {
64
+ id: number;
65
+ revenue: string | null;
66
+ expense: string | null;
67
+ sales: boolean;
68
+ srs: boolean;
69
+ };
70
+ export type User = {
71
+ id?: number;
72
+ userId: string;
73
+ admin?: boolean;
74
+ role?: boolean;
75
+ roleName?: string | null;
76
+ roleEmail?: string | null;
77
+ email?: string | null;
78
+ usersSystemId?: number | null;
79
+ systemId?: number | null;
80
+ coreId?: number | null;
81
+ coreUserId?: number | null;
82
+ cores?: CorePayload | null;
83
+ systems?: SystemPart[] | [] | null;
84
+ deleted?: Date | null;
85
+ };
86
+ export interface SystemPart {
87
+ id: number;
88
+ name: string;
89
+ due: string;
90
+ fein: string;
91
+ agency: string;
92
+ checkAddress: string;
93
+ credit?: boolean | null;
94
+ creditUrl?: string | null;
95
+ creditFee?: string | null;
96
+ part: string;
97
+ abbrev: string;
98
+ aggiebuy: string;
99
+ image: string;
100
+ }
101
+ export interface Account {
102
+ uid: string;
103
+ account_number: string;
104
+ campus_code: string;
105
+ fiscal_year: number;
106
+ account: string;
107
+ support_account: string;
108
+ budget_support_account: string;
109
+ budget_account_number: string;
110
+ title: string | null;
111
+ expiration_date: Date | null;
112
+ status: string | null;
113
+ uin: string;
114
+ responsible_uin: string | null;
115
+ department: string | null;
116
+ setup_date: Date | null;
117
+ budget_access: string | null;
118
+ abr_rule: string;
119
+ idt_allowed: boolean | null;
120
+ adloc_campus_code: string | null;
121
+ adloc_department: string | null;
122
+ adloc_name: string | null;
123
+ preferred_first_name: string | null;
124
+ first_name: string | null;
125
+ middle_name: string | null;
126
+ last_name: string | null;
127
+ email: string | null;
128
+ work_phone: string | null;
129
+ active: boolean | null;
130
+ default_bank: string | null;
131
+ bank_override: boolean | null;
132
+ last_seen: Date | null;
133
+ srs: boolean | null;
134
+ cfda_no: string | null;
135
+ sponsor_type: string | null;
136
+ }
137
+ export interface CoreAccount {
138
+ id?: number;
139
+ account?: string;
140
+ coreId: number;
141
+ coreAccountId?: number;
142
+ coreAccountActive?: boolean | null;
143
+ effective?: Date | null;
144
+ active?: boolean | null;
145
+ }
146
+ export interface CoreUser {
147
+ id?: number;
148
+ userId?: string;
149
+ coreId: number;
150
+ coreUserId?: number;
151
+ email?: boolean | null;
152
+ }
153
+ export interface Core {
154
+ id?: number;
155
+ account?: string;
156
+ effective?: string;
157
+ facility?: string;
158
+ contact: string;
159
+ contactEmail: string;
160
+ systemId: number;
161
+ enabled: boolean;
162
+ deleted: string | null;
163
+ coreEmail?: string | null;
164
+ corePhone: string | null;
165
+ coreAddress: string | null;
166
+ from_email: string | null;
167
+ invoice_email: string | null;
168
+ systemPart?: SystemPart;
169
+ system_part?: string;
170
+ system_name?: string;
171
+ system_abbrev?: string;
172
+ users?: CoreUser[];
173
+ accounts?: CoreAccount[];
174
+ }
175
+ export interface FamisDetails {
176
+ invoiceType: string;
177
+ invoiceNumber: string;
178
+ customerPONumber: string;
179
+ invoiceDepartment: string;
180
+ sellingCampusCode: string;
181
+ sellingAccountNumber: string;
182
+ customerAccountNumber: string;
183
+ sellingSupportAccount: string;
184
+ }
185
+ export interface Details {
186
+ ppu: number;
187
+ date: string;
188
+ famis: FamisDetails;
189
+ other: string;
190
+ amount: number;
191
+ status: string;
192
+ category: string;
193
+ comments: string | null;
194
+ quantity: number;
195
+ pmtNumber: string | null;
196
+ usageType: string;
197
+ itemComment: string | null;
198
+ customerName: string;
199
+ purchaseDate: string;
200
+ billingPeriod: string | null;
201
+ customerEmail: string;
202
+ customerTitle: string;
203
+ itemDescription: string;
204
+ sellingObjectCode: string;
205
+ }
206
+ export interface HighRiskTransaction {
207
+ [key: number]: Details[];
208
+ }
209
+ export interface IsHighRisk {
210
+ isHighRisk: boolean;
211
+ flaggedTransactions: Details[];
212
+ }
213
+ export interface CustomerAccountInfo {
214
+ uid: string;
215
+ account_number: string;
216
+ campus_code: string;
217
+ fiscal_year: number;
218
+ account: string;
219
+ support_account: string;
220
+ budget_support_account: string;
221
+ budget_account_number: string;
222
+ title: string;
223
+ expiration_date: string;
224
+ status: string;
225
+ uin: string;
226
+ responsible_uin: string;
227
+ department: string;
228
+ setup_date: string;
229
+ budget_access: string;
230
+ abr_rule: string;
231
+ idt_allowed: boolean;
232
+ adloc_campus_code: string;
233
+ adloc_department: string;
234
+ adloc_name: string;
235
+ preferred_first_name: string;
236
+ first_name: string;
237
+ middle_name: string | null;
238
+ last_name: string;
239
+ email: string;
240
+ work_phone: string;
241
+ active: boolean;
242
+ default_bank: string;
243
+ bank_override: boolean;
244
+ srs: boolean;
245
+ cfda_no: string;
246
+ sponsor_type: string;
247
+ billingEmailId: string;
248
+ parent_account_idt_allowed: boolean;
249
+ }
250
+ export interface HighRiskInfo {
251
+ isHighRisk: boolean;
252
+ flaggedTransactions: Details[];
253
+ }
254
+ export interface Contact {
255
+ fax?: string | null;
256
+ city?: string | null;
257
+ name?: string;
258
+ email?: string | null;
259
+ phone?: string | null;
260
+ state?: string | null;
261
+ country?: string | null;
262
+ address1?: string | null;
263
+ address2?: string | null;
264
+ mailstop?: string | null;
265
+ department?: string | null;
266
+ postalCode?: string | null;
267
+ institution?: string | null;
268
+ }
269
+ export interface TransactionData {
270
+ to: Contact;
271
+ lab: string;
272
+ date: string;
273
+ from: Contact;
274
+ number: string;
275
+ details: Details[];
276
+ fingerprint: string;
277
+ totalAmount: string;
278
+ }
279
+ export interface InvoiceComment {
280
+ id?: number;
281
+ uid?: string;
282
+ invoice_id: string;
283
+ user_id?: string | null;
284
+ comment: string | null;
285
+ type: string | null;
286
+ created: string | null;
287
+ deleted: string | null;
288
+ }
289
+ export type InvoiceCommentFile = {
290
+ id?: number;
291
+ uid: string;
292
+ invoice_id: string;
293
+ comment_id: string;
294
+ original_filename: string | null;
295
+ filename: string | null;
296
+ created: Date | null;
297
+ deleted: Date | null;
298
+ };
299
+ export interface Invoice {
300
+ uid?: string | null;
301
+ number?: string | null;
302
+ lab?: string | null;
303
+ totalAmount?: string;
304
+ date?: string;
305
+ data: TransactionData;
306
+ invoiced: boolean;
307
+ type: string;
308
+ famisInvoiceNumber: string;
309
+ deleted: string | null;
310
+ customerAccount: string;
311
+ sellingAccount: string;
312
+ postedDate: string | null;
313
+ emailed: boolean;
314
+ replace_data?: object | null;
315
+ fingerprint?: string | null;
316
+ core?: Core | null;
317
+ customerAccountInfo?: CustomerAccountInfo | null;
318
+ isIdt?: boolean | null;
319
+ poNumber?: string | null;
320
+ pi?: PI | null;
321
+ highRiskInfo?: HighRiskInfo | null;
322
+ comments?: InvoiceComment[] | null;
323
+ }
324
+ export interface Edge {
325
+ cursor: string;
326
+ node: Invoice;
327
+ }
328
+ export interface PageInfo {
329
+ total?: number;
330
+ lastPage?: number;
331
+ currentPage: number;
332
+ perPage: number;
333
+ from: number;
334
+ to: number;
335
+ }
336
+ export interface InvoicePayload {
337
+ data: Invoice[];
338
+ pagination: PageInfo;
339
+ }
340
+ export interface AccountPayload {
341
+ data: Account[];
342
+ pagination: PageInfo;
343
+ }
344
+ export interface CorePayload {
345
+ data: Core[];
346
+ pagination: PageInfo;
347
+ }
348
+ /**
349
+ * @typedef {Object} Account
350
+ * @property {string} uid
351
+ * @property {string} account_number
352
+ * @property {string} campus_code
353
+ * @property {number} fiscal_year
354
+ * @property {string} account
355
+ * @property {string} support_account
356
+ * @property {string} budget_support_account
357
+ * @property {string} budget_account_number
358
+ * @property {string | null} title
359
+ * @property {Date | null} expiration_date
360
+ * @property {string | null} status
361
+ * @property {string} uin
362
+ * @property {string | null} responsible_uin
363
+ * @property {string | null} department
364
+ * @property {Date | null} setup_date
365
+ * @property {string | null} budget_access
366
+ * @property {string} abr_rule
367
+ * @property {boolean | null} idt_allowed
368
+ * @property {string | null} adloc_campus_code
369
+ * @property {string | null} adloc_department
370
+ * @property {string | null} adloc_name
371
+ * @property {string | null} preferred_first_name
372
+ * @property {string | null} first_name
373
+ * @property {string | null} middle_name
374
+ * @property {string | null} last_name
375
+ * @property {string | null} email
376
+ * @property {string | null} work_phone
377
+ * @property {boolean | null} active
378
+ * @property {string | null} default_bank
379
+ * @property {boolean | null} bank_override
380
+ * @property {Date | null} last_seen
381
+ * @property {boolean | null} srs
382
+ * @property {string | null} cfda_no
383
+ * @property {string | null} sponsor_type
384
+ */
385
+ /**
386
+ * Represents the Core schema.
387
+ * @typedef {Object} Core
388
+ * @property {number} id - The ID.
389
+ * @property {string} account - The account.
390
+ * @property {string} effective - The effective date.
391
+ * @property {string} facility - The facility.
392
+ * @property {string} contact - The contact.
393
+ * @property {string} contactEmail - The contact email.
394
+ * @property {number} systemId - The system ID.
395
+ * @property {boolean} enabled - Indicates if it's enabled.
396
+ * @property {string | null} deleted - The deletion status.
397
+ * @property {string} coreEmail - The core email.
398
+ * @property {string | null} corePhone - The core phone.
399
+ * @property {string | null} coreAddress - The core address.
400
+ * @property {string | null} from_email - The from email.
401
+ * @property {string | null} invoice_email - The invoice email.
402
+ * @property {Object} systemPart - The system part.
403
+ */
404
+ /**
405
+ * @typedef {Object} Edge
406
+ * @property {string} cursor - Description of the property.
407
+ * @property {InvoiceSchema} node - Description of the property.
408
+ */
409
+ /**
410
+ * @typedef {Object} PageInfo
411
+ * @property {boolean} hasNextPage - Description of the property.
412
+ * @property {boolean} hasPreviousPage - Description of the property.
413
+ * @property {string|null} [startCursor] - Description of the property.
414
+ * @property {string|null} [endCursor] - Description of the property.
415
+ */
416
+ /**
417
+ * @typedef {Object} InvoicePayload
418
+ * @property {Edge[]} edges - Description of the property.
419
+ * @property {PageInfo} pageInfo - Description of the property.
420
+ */
421
+ /**
422
+ * @typedef {Object} CorePayload
423
+ * @property {Edge[]} edges - Description of the property.
424
+ * @property {PageInfo} pageInfo - Description of the property.
425
+ */
426
+ declare class FAMISDb {
427
+ private db;
428
+ private people;
429
+ constructor(config: any, people: any, debug: boolean);
430
+ /**
431
+ * Initializes the database connection and sets up the Knex instance for interacting with PostgreSQL database.
432
+ *
433
+ * @param {any} config - The configuration object that includes details about how to connect to a PostgreSQL database. This should include properties such as `host`, `user`, `password`, etc.
434
+ * @param {any} people - The data related to the 'people' entity. It could be an array of person objects or any other format depending on your application requirements.
435
+ * @param {boolean} debug - A flag indicating whether to enable debugging for Knex queries. Defaults to `false`. If set to `true`, it will log all SQL queries that are executed against the database in the console.
436
+ */
437
+ init(config: any, people?: any, debug?: boolean): void;
438
+ /**
439
+ *
440
+ * Extract customer account and po number
441
+ * @param {object} famis
442
+ * @param {object} replace_data
443
+ * @returns {object} account number object
444
+ * @memberof FAMISDb
445
+ */
446
+ getAccountNumber(famis: {
447
+ customerAccountNumber: string;
448
+ customerPONumber: string;
449
+ }, replace_data?: {
450
+ customerAccountNumber?: string;
451
+ customerPONumber?: string;
452
+ }): {
453
+ accountNumber: string;
454
+ poNumber: string | null;
455
+ };
456
+ /**
457
+ *
458
+ * Process an invoice to have all necessary relationships
459
+ * @param {object} invoice - the invoice object sent by iLab
460
+ * @param {boolean} [historical=false] - if true use historical accounts too
461
+ * @param {string[]} excludeFields - fields to exclude from results
462
+ * @returns {Promise<object>} invoice object
463
+ * @memberof FAMISDb
464
+ */
465
+ processInvoice(invoice: any, historical?: boolean, excludeFields?: string[]): Promise<any>;
466
+ /**
467
+ *
468
+ * Get invoice by uid
469
+ * @param {string} uid
470
+ * @param {string} [sortColumn='date']
471
+ * @param {string} [sortDirection='desc']
472
+ * @param {boolean} [deleted=false]
473
+ * @param {integer} page - page of results to return
474
+ * @param {string} perPage - number of results per page to return
475
+ * @returns {Promise<InvoicePayload>} invoice object
476
+ * @memberof FAMISDb
477
+ */
478
+ getInvoiceByUid(uid: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
479
+ /**
480
+ *
481
+ * Get invoice by originating system assigned number
482
+ * @param {string} number
483
+ * @param {string} [sortColumn='date']
484
+ * @param {string} [sortDirection='desc']
485
+ * @param {boolean} [deleted=false]
486
+ * @param {integer} page - page of results to return
487
+ * @param {string} perPage - number of results per page to return
488
+ * @returns {Promise<InvoicePayload>} invoice object
489
+ * @memberof FAMISDb
490
+ */
491
+ getInvoiceByNumber(number: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
492
+ /**
493
+ *
494
+ * Get invoice by fingerprint
495
+ * @param {string} fingerPrint
496
+ * @returns {Promise<object>} invoice object
497
+ * @memberof FAMISDb
498
+ */
499
+ getInvoiceByFingerPrint(fingerPrint: string): Promise<any>;
500
+ /**
501
+ *
502
+ * Get all invoices associated with a specified account number
503
+ * @param {string} accountNumber
504
+ * @param {string} [sortColumn='date']
505
+ * @param {string} [sortDirection='desc']
506
+ * @param {boolean} [deleted=false]
507
+ * @param {integer} page - page of results to return
508
+ * @param {string} perPage - number of results per page to return
509
+ * @returns {Promise<InvoicePayload>} invoice objects
510
+ * @memberof FAMISDb
511
+ */
512
+ getInvoicesByAccount(accountNumber: string | string[], sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
513
+ /**
514
+ *
515
+ * Get all invoice ordered by and sorted by parameters passed
516
+ * @param {string} [sortColumn='date']
517
+ * @param {string} [sortDirection='desc']
518
+ * @param {boolean} [deleted=false]
519
+ * @param {integer} page - page of results to return
520
+ * @param {string} perPage - number of results per page to return
521
+ * @returns {Promise<InvoicePayload>} invoice objects
522
+ * @memberof FAMISDb
523
+ */
524
+ getAllInvoices(sortColumn?: string, sortDirection?: SortDirection | string, deleted?: boolean, page?: number, perPage?: number): Promise<InvoicePayload>;
525
+ /**
526
+ *
527
+ * Retrieves invoices from the latest date
528
+ * @param {string} [sortColumn='date']
529
+ * @param {string} [sortDirection='desc']
530
+ * @param {integer} first - corresponds to the first param of the Relay spec
531
+ * @param {string} after - corresponds to the after param of the Relay spec
532
+ * @param {integer} last - corresponds to the last param of the Relay spec
533
+ * @param {string} before - corresponds to the before param of the Relay spec
534
+ * @returns {Promise<InvoicePayload>} invoice objects
535
+ * @memberof FAMISDb
536
+ */
537
+ getLatestInvoices(sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
538
+ /**
539
+ *
540
+ * Returns all held invoices
541
+ * @param {string} [sortColumn='date']
542
+ * @param {string} [sortDirection='desc']
543
+ * @param {integer} page - corresponds to the first param of the Relay spec
544
+ * @param {integer} perPage - corresponds to the last param of the Relay spec
545
+ * @returns {Promise<InvoicePayload>} held invoice objects
546
+ * @memberof FAMISDb
547
+ */
548
+ getHeldInvoices(sortColumn?: string, sortDirection?: string, page?: number, perPage?: number): Promise<InvoicePayload>;
549
+ /**
550
+ *
551
+ * Returns all awaiting email invoices
552
+ * @param {string} [sortColumn='date']
553
+ * @param {string} [sortDirection='desc']
554
+ * @param {integer} first - corresponds to the first param of the Relay spec
555
+ * @param {string} after - corresponds to the after param of the Relay spec
556
+ * @param {integer} last - corresponds to the last param of the Relay spec
557
+ * @param {string} before - corresponds to the before param of the Relay spec
558
+ * @returns {Promise<InvoicePayload>} awaiting email invoice objects
559
+ * @memberof FAMISDb
560
+ */
561
+ getInvoicesAwaitingEmail(sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
562
+ /**
563
+ *
564
+ * Search invoices by originating system generated invoice number
565
+ * @param {string} number
566
+ * @param {string} [sortColumn='date']
567
+ * @param {string} [sortDirection='desc']
568
+ * @param {integer} first - corresponds to the first param of the Relay spec
569
+ * @param {string} after - corresponds to the after param of the Relay spec
570
+ * @param {integer} last - corresponds to the last param of the Relay spec
571
+ * @param {string} before - corresponds to the before param of the Relay spec
572
+ * @returns {Promise<InvoicePayload>} invoice objects
573
+ * @memberof FAMISDb
574
+ */
575
+ searchInvoicesByNumber(number: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
576
+ /**
577
+ *
578
+ * Search invoices by famis account number
579
+ * @param {string} account
580
+ * @param {string} [sortColumn='date']
581
+ * @param {string} [sortDirection='desc']
582
+ * @param {integer} first - corresponds to the first param of the Relay spec
583
+ * @param {string} after - corresponds to the after param of the Relay spec
584
+ * @param {integer} last - corresponds to the last param of the Relay spec
585
+ * @param {string} before - corresponds to the before param of the Relay spec
586
+ * @returns {Promise<InvoicePayload>} invoice objects
587
+ * @memberof FAMISDb
588
+ */
589
+ searchInvoicesByAccountNumber(account: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
590
+ /**
591
+ *
592
+ * Search invoices by FAMIS invoice number
593
+ * @param {string} famis
594
+ * @param {string} [sortColumn='date']
595
+ * @param {string} [sortDirection='desc']
596
+ * @param {integer} page - page of results to return
597
+ * @param {integer} perPage - number of results per page to return
598
+ * @returns {Promise<InvoicePayload>} invoice objects
599
+ * @memberof FAMISDb
600
+ */
601
+ searchInvoicesByFamis(famis: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<InvoicePayload>;
602
+ /**
603
+ *
604
+ * Queries invoices
605
+ * @param {string} query
606
+ * @param {string} [sortColumn='date']
607
+ * @param {string} [sortDirection='desc']
608
+ * @param {integer} page - page of results to return
609
+ * @param {integer} perPage - number of results per page to return
610
+ * @param {string[]} excludeFields - fields to exclude from results
611
+ * @returns {Promise<InvoicePayload>} invoice objects
612
+ * @memberof FAMISDb
613
+ */
614
+ queryInvoices(query: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number, excludeFields?: string[]): Promise<InvoicePayload>;
615
+ /**
616
+ *
617
+ * Adds an invoice
618
+ * @param {object} invoice
619
+ * @param {string} type
620
+ * @param {string} famisInvoiceNumber
621
+ * @returns {Promise<object>} invoice
622
+ * @memberof FAMISDb
623
+ */
624
+ addInvoice(invoice: any, type: string, famisInvoiceNumber?: string): Promise<any>;
625
+ /**
626
+ *
627
+ * Updates an invoice
628
+ * @param {string} uid
629
+ * @param {Invoice} invoice
630
+ * @returns {Promise<Invoice>} invoice object
631
+ * @memberof FAMISDb
632
+ */
633
+ updateInvoice(uid: string, invoice: Invoice): Promise<InvoicePayload>;
634
+ /**
635
+ *
636
+ * Toggles an invoice as paid
637
+ * @param {string} uid
638
+ * @param {boolean} invoiced
639
+ * @returns {Promise<object>} invoice object
640
+ * @memberof FAMISDb
641
+ */
642
+ markInvoiced(uid: string, invoiced: boolean): Promise<any>;
643
+ /**
644
+ *
645
+ * Toggles an invoice as emailed
646
+ * @param {string} uid
647
+ * @param {boolean} emailed
648
+ * @returns {Promise<object>} invoice object
649
+ * @memberof FAMISDb
650
+ */
651
+ markEmailed(uid: string, emailed: boolean): Promise<any>;
652
+ /**
653
+ *
654
+ * Sets an invoice's deletion date
655
+ * @param {string} uid
656
+ * @param {date} deleted
657
+ * @returns {Promise<object>} invoice object
658
+ * @memberof FAMISDb
659
+ */
660
+ setDeleted(uid: string, deleted: Date): Promise<any>;
661
+ /**
662
+ *
663
+ * Sets an invoice's posted date
664
+ * @param {string} uid
665
+ * @param {date} postedDate
666
+ * @returns {Promise<object>} invoice object
667
+ * @memberof FAMISDb
668
+ */
669
+ setInvoicePostedDate(uid: string, postedDate: Date | null): Promise<any>;
670
+ /**
671
+ *
672
+ * Sets an invoice's fingerprint
673
+ * @param {string} uid
674
+ * @param {string} fingerprint
675
+ * @returns {Promise<object>} invoice object
676
+ * @memberof FAMISDb
677
+ */
678
+ setInvoiceFingerPrint(uid: string, fingerprint: string): Promise<any>;
679
+ /**
680
+ *
681
+ * Get PI accounts by account number
682
+ * @param {string} number
683
+ * @param {string} campus
684
+ * @param {boolean} [historical=false]
685
+ * @returns {Promise<Account>} account object
686
+ * @memberof FAMISDb
687
+ */
688
+ getByAccountNumber(number: string, campus?: string, historical?: boolean): Promise<any>;
689
+ /**
690
+ *
691
+ * Search PI accounts by partial account number
692
+ * @param {string|string[]} number
693
+ * @returns {Promise<AccountPayload>} account object(s)
694
+ * @memberof FAMISDb
695
+ */
696
+ searchByAccountNumber(number: string | string[], sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<AccountPayload>;
697
+ /**
698
+ *
699
+ * Get PI Accounts by UIN
700
+ * @param {string|string[]} uin
701
+ * @returns {Promise<Account[]>} account object array
702
+ * @memberof FAMISDb
703
+ */
704
+ getAccountsByUin(uin: string | string[], responsible?: boolean, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<AccountPayload>;
705
+ /**
706
+ *
707
+ * Get PI accounts by responsible UIN
708
+ * @param {string} uin
709
+ * @returns {Promise<Account[]>} account object array
710
+ * @memberof FAMISDb
711
+ */
712
+ getAccountsByResponsibleUin(uin: string | string[]): Promise<Account[]>;
713
+ /**
714
+ *
715
+ * Queries accounts
716
+ * @param {string} query
717
+ * @param {string} [sortColumn='date']
718
+ * @param {string} [sortDirection='desc']
719
+ * @param {integer} page - page of results to return
720
+ * @param {integer} perPage - number of results per page to return
721
+ * @returns {Promise<AccountPayload>} invoice objects
722
+ * @memberof FAMISDb
723
+ */
724
+ queryAccounts(query: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number): Promise<AccountPayload>;
725
+ /**
726
+ *
727
+ * Get next FAMIS invoice number in sequence for specified invoice type
728
+ * @param {string} invoice
729
+ * @returns {Promise<string>} next invoice number in sequence
730
+ * @memberof FAMISDb
731
+ */
732
+ getNextFAMISInvoiceNumber(type: string): Promise<string>;
733
+ /**
734
+ *
735
+ * Get matching expense code for specified revenue code
736
+ * @param {string} revenue
737
+ * @returns {Promise<string>} expense code
738
+ * @memberof FAMISDb
739
+ */
740
+ getExpenseCodeByRevenue(revenue: string): Promise<string>;
741
+ /**
742
+ * Represents a row in the 'codes' table.
743
+ * @typedef {Object} Code
744
+ * @property {number} id - The unique identifier for the code.
745
+ * @property {string|null} revenue - The revenue code (nullable).
746
+ * @property {string|null} expense - The expense code (nullable).
747
+ * @property {boolean} sales - Indicates if the code is associated with sales.
748
+ * @property {boolean} srs - Indicates if the code is associated with SRS.
749
+ */
750
+ /**
751
+ *
752
+ * Get revenue code object
753
+ * @param {string} revenue
754
+ * @returns {Promise<Code>} revenue code object
755
+ * @memberof FAMISDb
756
+ */
757
+ getRevenueCode(revenue: string): Promise<FAMISObjectCode>;
758
+ /**
759
+ *
760
+ * Get expense code object
761
+ * @param {string} code
762
+ * @returns {Promise<Code>} expense code object
763
+ * @memberof FAMISDb
764
+ */
765
+ getExpenseCode(code: string): Promise<FAMISObjectCode>;
766
+ /**
767
+ *
768
+ * Check if expense code is within the allowable range for specified account and the specified fiscal year (defaults to the current)
769
+ * @param {string} accountNumber
770
+ * @param {string} code
771
+ * @param {integer} fiscal
772
+ * @returns {Promise<boolean>} truthy value
773
+ * @memberof FAMISDb
774
+ */
775
+ allowableExpenseCode(accountNumber: string, code: string, fiscal?: number): Promise<boolean>;
776
+ /**
777
+ *
778
+ * Get allowable expense code ranges for the specified account
779
+ * @param {string} accountNumber
780
+ * @param {integer} fiscal
781
+ * @returns {Promise<boolean>} expense code range object(s)
782
+ * @memberof FAMISDb
783
+ */
784
+ getAllowableExpenseCodes(accountNumber: string, fiscal?: number): Promise<{
785
+ allowed: object[];
786
+ disallowed: object[];
787
+ }>;
788
+ /**
789
+ *
790
+ * Query cores
791
+ * @param {string} query
792
+ * @param {string} [sortColumn='facility']
793
+ * @param {string} [sortDirection='asc']
794
+ * @param {integer} page - page of results to return
795
+ * @param {integer} perPage - number of results per page to return
796
+ * @param {string[]} excludeFields - fields to exclude from results
797
+ * @returns {Promise<CorePayload>} core objects
798
+ * @memberof FAMISDb
799
+ */
800
+ queryCores(query: string, sortColumn?: string, sortDirection?: SortDirection | string, page?: number, perPage?: number, excludeFields?: string[]): Promise<CorePayload>;
801
+ /**
802
+ *
803
+ * Get core by specified attribute and search term
804
+ * @param {string} type
805
+ * @param {string} operator
806
+ * @param {string} search
807
+ * @param {string[]} excludeFields - fields to exclude from results
808
+ * @returns {Promise<Core>} core object
809
+ * @memberof FAMISDb
810
+ */
811
+ getCore(type: string, operator: string | undefined, search: string, excludeFields?: string[]): Promise<Core>;
812
+ /**
813
+ *
814
+ * Get core by id
815
+ * @param {string} id
816
+ * @returns {Promise<Core>} core object
817
+ * @memberof FAMISDb
818
+ */
819
+ getCoreById(id: string): Promise<Core>;
820
+ /**
821
+ *
822
+ * Get core by account number
823
+ * @param {string} account
824
+ * @returns {Promise<Core>} core object
825
+ * @param {string[]} excludeFields - fields to exclude from results
826
+ * @memberof FAMISDb
827
+ */
828
+ getCoreByAccount(account: string, excludeFields?: string[]): Promise<Core>;
829
+ /**
830
+ *
831
+ * Update core
832
+ * @param {Core} core object
833
+ * @returns {Promise<Core>} core object
834
+ * @memberof FAMISDb
835
+ */
836
+ updateCore(core: Core): Promise<Core | undefined>;
837
+ /**
838
+ *
839
+ * Add core
840
+ * @param {Core} core object
841
+ * @returns {Promise<Core>} core object
842
+ * @memberof FAMISDb
843
+ */
844
+ addCore(core: Core): Promise<Core>;
845
+ /**
846
+ *
847
+ * Update core account
848
+ * @param {CoreAccount} account object
849
+ * @returns {Promise<CoreAccount>} core_account object
850
+ * @memberof FAMISDb
851
+ */
852
+ updateCoreAccount(account: CoreAccount): Promise<CoreAccount>;
853
+ /**
854
+ *
855
+ * Add core_account
856
+ * @param {CoreAccount} account object
857
+ * @returns {Promise<CoreAccount>} core_account object
858
+ * @memberof FAMISDb
859
+ */
860
+ addCoreAccount(account: CoreAccount): Promise<CoreAccount>;
861
+ /**
862
+ *
863
+ * Delete core account
864
+ * @param {coreAccountId} string core account id
865
+ * @returns {Promise<CoreAccount>} core account object
866
+ * @memberof FAMISDb
867
+ */
868
+ deleteCoreAccount(coreAccountId: string): Promise<CoreAccount>;
869
+ /**
870
+ *
871
+ * Get system part by ID
872
+ * @param {number} id
873
+ * @param {string[]} excludeFields - fields to exclude from results
874
+ * @returns {Promise<SystemPart>} system part object
875
+ * @memberof FAMISDb
876
+ */
877
+ getSystemById(id: number, excludeFields?: string[]): Promise<SystemPart>;
878
+ /**
879
+ *
880
+ * Get system part by two-digit part number
881
+ * @param {string} number
882
+ * @returns {Promise<SystemPart>} system part object
883
+ * @memberof FAMISDb
884
+ */
885
+ getSystemByPartNumber(number: string): Promise<SystemPart>;
886
+ /**
887
+ *
888
+ * Get all enabled cores
889
+ * @returns {Promise<Core[]>} core objects
890
+ * @memberof FAMISDb
891
+ */
892
+ getEnabledCores(): Promise<Core[]>;
893
+ /**
894
+ *
895
+ * Get all cores
896
+ * @param {string} [sortColumn='facility']
897
+ * @param {string} [sortDirection='asc']
898
+ * @param {boolean} [deleted=false]
899
+ * @param {integer} page - page of results to return
900
+ * @param {string} perPage - number of results per page to return
901
+ * @returns {Promise<CorePayload>} core objects
902
+ * @memberof FAMISDb
903
+ */
904
+ getAllCores(sortColumn?: string, sortDirection?: SortDirection | string, deleted?: boolean, page?: number, perPage?: number): Promise<CorePayload>;
905
+ /**
906
+ *
907
+ * Get a core's users by core ID
908
+ * @param {number} coreId
909
+ * @returns {Promise<Core[]>} user objects
910
+ * @memberof FAMISDb
911
+ */
912
+ getCoreUsers(coreId: number): Promise<Core[]>;
913
+ /**
914
+ *
915
+ * Update core user
916
+ * @param {CoreUser} user object
917
+ * @returns {Promise<CoreUser>} user_core object
918
+ * @memberof FAMISDb
919
+ */
920
+ updateCoreUser(user: CoreUser): Promise<CoreUser>;
921
+ /**
922
+ * This function adds a new CoreUser to the database. If the user already exists, it updates the existing record.
923
+ * @param {CoreUser} coreUser - The CoreUser object containing details about the user.
924
+ * @return {Promise<CoreUser>} A Promise that resolves to the newly added or updated CoreUser, if successfully added and returned from the database; otherwise it rejects with an error.
925
+ */
926
+ addCoreUser(coreUser: CoreUser): Promise<CoreUser>;
927
+ /**
928
+ *
929
+ * Delete core user
930
+ * @param {coreUserId} string core user object
931
+ * @returns {Promise<CoreUser>} core user object
932
+ * @memberof FAMISDb
933
+ */
934
+ deleteCoreUser(coreUserId: string): Promise<CoreUser>;
935
+ /**
936
+ *
937
+ * Get a user's cores they manage
938
+ * @param {string} userId
939
+ * @param {string} [sortColumn='facility']
940
+ * @param {string} [sortDirection='asc']
941
+ * @param {boolean} [deleted=false]
942
+ * @param {integer} page - page of results to return
943
+ * @param {string} perPage - number of results per page to return
944
+ * @returns {Promise<CorePayload]>} core objects
945
+ * @memberof FAMISDb
946
+ */
947
+ getUserCores(userId: string, sortColumn?: string, sortDirection?: SortDirection | string, deleted?: boolean, page?: number, perPage?: number): Promise<CorePayload>;
948
+ /**
949
+ *
950
+ * Get a system part's users by system ID
951
+ * @param {number} systemId
952
+ * @returns {Promise<object[]>} user objects
953
+ * @memberof FAMISDb
954
+ */
955
+ getSystemUsers(systemId: number): Promise<User[]>;
956
+ /**
957
+ *
958
+ * Get a user's system parts they manage
959
+ * @param {string} userId
960
+ * @returns {Promise<SystemPart[]>} system objects
961
+ * @memberof FAMISDb
962
+ */
963
+ getUserSystemParts(userId: string): Promise<SystemPart[]>;
964
+ /**
965
+ * Represents the "system" table in the public schema.
966
+ * @typedef {Object} System
967
+ * @property {number} id - The ID (auto-generated).
968
+ * @property {string | null} name - The name.
969
+ * @property {string | null} due - The due text.
970
+ * @property {string | null} fein - The FEIN (Federal Employer Identification Number).
971
+ * @property {string | null} agency - The agency.
972
+ * @property {string | null} checkAddress - The check address.
973
+ * @property {boolean} credit - Indicates if credit is allowed.
974
+ * @property {string | null} creditUrl - The credit URL.
975
+ * @property {string | null} creditFee - The credit fee.
976
+ * @property {string | null} part - The part.
977
+ * @property {string | null} abbrev - The abbreviation.
978
+ * @property {string | null} aggiebuy - The AggieBuy information.
979
+ * @property {string | null} image - The image URL.
980
+ */
981
+ /**
982
+ * Get all system parts.
983
+ * @returns {Promise<SystemPart[]>} System objects.
984
+ * @memberof FAMISDb
985
+ */
986
+ getAllSystemParts(): Promise<SystemPart[]>;
987
+ /**
988
+ * Get all admin users.
989
+ * @returns {Promise<object[]>} Array of user objects.
990
+ * @memberof FAMISDb
991
+ */
992
+ getAdminUsers(): Promise<User[] | []>;
993
+ /**
994
+ * Get user.
995
+ * @param {string} userId - User ID.
996
+ * @returns {Promise<object>} User object.
997
+ * @memberof FAMISDb
998
+ */
999
+ getUser(userId: string): Promise<User | null>;
1000
+ /**
1001
+ * Update user.
1002
+ * @param {object} user - User object.
1003
+ * @returns {Promise<object>} Updated user object.
1004
+ * @memberof FAMISDb
1005
+ */
1006
+ updateUser(user: object): Promise<object | null>;
1007
+ /**
1008
+ * Get customer by customer account number.
1009
+ * @param {string} accountNumber - Customer account number.
1010
+ * @param {string} campusCode - Campus code.
1011
+ * @returns {Promise<object>} Customer account object.
1012
+ * @memberof FAMISDb
1013
+ */
1014
+ getCustomerNumber(accountNumber: string, campusCode: string): Promise<object | null>;
1015
+ /**
1016
+ * Get current fiscal year.
1017
+ * @returns {number} Fiscal year.
1018
+ * @memberof FAMISDb
1019
+ */
1020
+ getCurrentFiscalYear(): number;
1021
+ /**
1022
+ * Return fingerprint of invoice.
1023
+ * @param {object} invoice - JSON object.
1024
+ * @returns {string} Fingerprint.
1025
+ * @memberof FAMISDb
1026
+ */
1027
+ getInvoiceFingerPrint(invoice: object): string;
1028
+ /**
1029
+ * Return formatted account number.
1030
+ * @param {string} accountNumber - Unformatted 13-digit FAMIS account number.
1031
+ * @returns {string} Formatted 13-digit FAMIS account number.
1032
+ * @memberof FAMISDb
1033
+ */
1034
+ formatAccountNumber(accountNumber: string): string;
1035
+ /**
1036
+ * Is invoice flagged by SRS high-risk policies.
1037
+ * @param {object} invoice - JSON object.
1038
+ * @returns {Promise<HighRisk>} High-risk object.
1039
+ * @memberof FAMISDb
1040
+ */
1041
+ isSrsHighRisk(invoice: Invoice): Promise<HighRiskInfo>;
1042
+ /**
1043
+ * @typedef {Object} Comment
1044
+ * @property {integer} id - db generated id
1045
+ * @property {string} uid - uid
1046
+ * @property {string} invoice_id - invoice id
1047
+ * @property {string} user_id - user uid
1048
+ * @property {string} comment - text of comment
1049
+ * @property {string} type - type of comment
1050
+ * @property {date} created - created date
1051
+ * @property {date} deleted - deleted date
1052
+ */
1053
+ /**
1054
+ * Create or update an invoice comment.
1055
+ * @param {Comment} comment - JSON object representing the comment
1056
+ * @returns {Promise<Comment>} - Promise that resolves to the comment object
1057
+ * @memberof FAMISDb
1058
+ */
1059
+ saveComment(comment: InvoiceComment): Promise<InvoiceComment | null>;
1060
+ /**
1061
+ * Get comments associated with an invoice.
1062
+ * @param {string} invoiceUid - Invoice UID
1063
+ * @returns {Promise<Comment[]>} - Promise that resolves to an array of comment objects
1064
+ * @memberof FAMISDb
1065
+ */
1066
+ getInvoiceComments(invoiceUid: string): Promise<InvoiceComment[]>;
1067
+ /**
1068
+ * @typedef {Object} CommentFile
1069
+ * @property {integer} id - db generated id
1070
+ * @property {string} uid - uid
1071
+ * @property {string} invoice_id - invoice uid
1072
+ * @property {string} comment_id - comment uid
1073
+ * @property {string} original_filename - original file name
1074
+ * @property {string} filename - generate unique filename on filesystem
1075
+ * @property {date} created - created date
1076
+ * @property {date} deleted - deleted date
1077
+ */
1078
+ /**
1079
+ * Create an invoice comment file.
1080
+ * @param {InvoiceCommentFile} file - JSON object representing the comment file
1081
+ * @returns {Promise<InvoiceCommentFile>} - Promise that resolves to the comment file object
1082
+ * @memberof FAMISDb
1083
+ */
1084
+ saveCommentFile(file: InvoiceCommentFile): Promise<InvoiceCommentFile | null>;
1085
+ /**
1086
+ * Get invoice comment files.
1087
+ * @param {string} commentUid - Comment UID
1088
+ * @returns {Promise<CommentFile[]>} - Promise that resolves to an array of comment file objects
1089
+ * @memberof FAMISDb
1090
+ */
1091
+ getCommentFiles(commentUid: string): Promise<InvoiceCommentFile[] | []>;
1092
+ /**
1093
+ * Get invoice comment file.
1094
+ * @param {string} fileUid - File UID
1095
+ * @returns {Promise<CommentFile>} - Promise that resolves to a comment file object
1096
+ * @memberof FAMISDb
1097
+ */
1098
+ getCommentFile(fileUid: string): Promise<InvoiceCommentFile | null>;
1099
+ /**
1100
+ * Represents a row in the public.core_account_emails table.
1101
+ *
1102
+ * @interface CoreAccountEmail
1103
+ * @property {string} uid - The unique identifier for the account email.
1104
+ * @property {number} core_id - The core ID associated with the account email.
1105
+ * @property {string} account_number - The account number associated with the email.
1106
+ * @property {string} email - The email address associated with the account.
1107
+ * @property {Date | null} [created] - The timestamp when the account email was created. Nullable.
1108
+ * @property {Date | null} [deleted] - The timestamp when the account email was deleted. Nullable.
1109
+ */
1110
+ /**
1111
+ * Get additional delivery email to an expense accounts by uid
1112
+ * @param {string} uid - additional delivery email record uid
1113
+ * @returns {Promise<CoreAccountEmail|null>} - Promise that resolves to an account object
1114
+ * @memberof FAMISDb
1115
+ */
1116
+ getCoreAccountAdditionalEmailByUid(uid: string): Promise<CoreAccountEmail | null>;
1117
+ /**
1118
+ * Get additional delivery emails to expense accounts for a core by core id
1119
+ * @param {number} coreId - Core ID
1120
+ * @returns {Promise<CoreAccountEmail[]|[]>} - Promise that resolves to an account object
1121
+ * @memberof FAMISDb
1122
+ */
1123
+ getCoreAccountAdditionalEmailsByCoreId(coreId: number): Promise<CoreAccountEmail[] | []>;
1124
+ /**
1125
+ * Get additional delivery emails to expense accounts for a core by account number
1126
+ * @param {string} accountNumber - 13 digit famis account or customernumber
1127
+ * @returns {Promise<CoreAccountEmail[]|[]>} - Promise that resolves to an account object
1128
+ * @memberof FAMISDb
1129
+ */
1130
+ getCoreAccountAdditionalEmailsByAccount(accountNumber: string): Promise<CoreAccountEmail[] | []>;
1131
+ /**
1132
+ * Get additional delivery emails to expense accounts for a core by core id
1133
+ * and account number
1134
+ * @param {number} coreId - Core ID
1135
+ * @param {string} account - account number
1136
+ * @returns {Promise<CoreAccountEmail[]|[]>} - Promise that resolves to an account object
1137
+ * @memberof FAMISDb
1138
+ */
1139
+ getCoreAccountAdditionalEmailsByCoreIdAccount(coreId: number, account: string): Promise<CoreAccountEmail[] | []>;
1140
+ /**
1141
+ * Add an additional delivery email to an expense account for a core
1142
+ * @param {CoreAccountEmail} record - core account email delivery record
1143
+ * @returns {Promise<CoreAccountEmail>} - Promise that resolves to an account object
1144
+ * @memberof FAMISDb
1145
+ */
1146
+ addCoreAccountAdditionalEmail(record: CoreAccountEmail): Promise<CoreAccountEmail | null>;
1147
+ /**
1148
+ * Remove an additional delivery email to an expense account for a core
1149
+ * @param {string} uid - uid for core account email record
1150
+ * @returns {Promise<CoreAccountEmail>} - Promise that resolves to an account object
1151
+ * @memberof FAMISDb
1152
+ */
1153
+ removeCoreAccountAdditionalEmail(uid: string): Promise<CoreAccountEmail | null>;
1154
+ }
1155
+ export default FAMISDb;