@egdesk/next-api-plugin 1.4.5 → 1.5.1

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.
@@ -513,22 +513,45 @@ export async function getHometaxSyncHistory(limit: number = 50) {
513
513
  }
514
514
 
515
515
  /**
516
- * Query promissory notes (promissory_notes: 어음, issued/received)
516
+ * List per-(bank, product) bank-product tables — bank-side product data
517
+ * downloaded from bank portals that isn't core deposit/card transactions
518
+ * (loans, receivables, e-bills, etc.). Returns table slugs, displayName,
519
+ * column schemas, and row counts. ALWAYS call this first to discover
520
+ * what tables exist before calling queryBankProductTable.
517
521
  */
518
- export async function queryPromissoryNotes(options: {
519
- bankId?: string;
520
- accountId?: string;
521
- status?: string;
522
- noteType?: 'issued' | 'received';
523
- maturityStart?: string;
524
- maturityEnd?: string;
525
- issueStart?: string;
526
- issueEnd?: string;
527
- searchText?: string;
522
+ export async function listBankProductTables() {
523
+ return callFinanceHubTool('financehub_list_bank_product_tables', {});
524
+ }
525
+
526
+ /**
527
+ * Generic safe query against any per-(bank, product) table from
528
+ * listBankProductTables. Filters use the table's exact column names
529
+ * (snake_case). Returns rows with totalMatching, limit, offset.
530
+ *
531
+ * @example
532
+ * queryBankProductTable({
533
+ * tableSlug: 'ibk_loan_transactions',
534
+ * filters: [
535
+ * { column: 'account_number', op: '=', value: '306-063568-04-036' },
536
+ * { column: 'transaction_amount', op: '>', value: 1000000 },
537
+ * ],
538
+ * orderBy: { column: 'transaction_date', direction: 'DESC' },
539
+ * limit: 50,
540
+ * });
541
+ */
542
+ export async function queryBankProductTable(options: {
543
+ tableSlug: string;
544
+ filters?: Array<{
545
+ column: string;
546
+ op: '=' | '!=' | '>' | '<' | '>=' | '<=' | 'like' | 'in';
547
+ value: string | number | Array<string | number>;
548
+ }>;
549
+ orderBy?: { column: string; direction?: 'ASC' | 'DESC' };
528
550
  limit?: number;
529
551
  offset?: number;
530
- } = {}) {
531
- return callFinanceHubTool('financehub_query_promissory_notes', options);
552
+ latestOnly?: boolean;
553
+ }) {
554
+ return callFinanceHubTool('financehub_query_bank_product_table', options);
532
555
  }
533
556
 
534
557
  // ==========================================
@@ -1041,6 +1064,16 @@ export async function createTag(data: {
1041
1064
  export async function deleteTag(id: string) {
1042
1065
  return callAICenterTool('ai_center_delete_tag', { id });
1043
1066
  }
1067
+
1068
+ /** List all company-wide shared business deadlines from the company calendar (company_calendar table). */
1069
+ export async function getCalendarEventsFromAICenter() {
1070
+ return callAICenterTool('ai_center_get_calendar_events', {});
1071
+ }
1072
+
1073
+ /** Update the status of an operational task. */
1074
+ export async function completeTask(taskId: string, status: 'completed' | 'approved' | 'rejected') {
1075
+ return callAICenterTool('ai_center_complete_task', { taskId, status });
1076
+ }
1044
1077
  `;
1045
1078
  fs.writeFileSync(helperPath, helperContent.replace(/\r?\n/g, os.EOL), 'utf-8');
1046
1079
  console.log(`✅ Generated ${helperPath}`);
@@ -66,7 +66,7 @@ async function discoverTables(egdeskUrl = 'http://localhost:8080', apiKey) {
66
66
  arguments: {}
67
67
  })
68
68
  });
69
- const listResult = await listResponse.json().catch(() => null);
69
+ const listResult = (await listResponse.json().catch(() => null));
70
70
  if (listResult && typeof listResult === 'object' && listResult.success === false) {
71
71
  throw new Error(listResult.error || 'Failed to list tables');
72
72
  }
@@ -100,7 +100,7 @@ async function discoverTables(egdeskUrl = 'http://localhost:8080', apiKey) {
100
100
  })
101
101
  });
102
102
  if (schemaResponse.ok) {
103
- const schemaResult = await schemaResponse.json();
103
+ const schemaResult = (await schemaResponse.json());
104
104
  const schemaContent = schemaResult.result?.content?.[0]?.text;
105
105
  const schemaData = schemaContent ? JSON.parse(schemaContent) : null;
106
106
  tablesWithColumns.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egdesk/next-api-plugin",
3
- "version": "1.4.5",
3
+ "version": "1.5.1",
4
4
  "description": "Next.js plugin for EGDesk database proxy integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -480,22 +480,45 @@ export async function getHometaxSyncHistory(limit: number = 50) {
480
480
  }
481
481
 
482
482
  /**
483
- * Query promissory notes (promissory_notes: 어음, issued/received)
483
+ * List per-(bank, product) bank-product tables — bank-side product data
484
+ * downloaded from bank portals that isn't core deposit/card transactions
485
+ * (loans, receivables, e-bills, etc.). Returns table slugs, displayName,
486
+ * column schemas, and row counts. ALWAYS call this first to discover
487
+ * what tables exist before calling queryBankProductTable.
484
488
  */
485
- export async function queryPromissoryNotes(options: {
486
- bankId?: string;
487
- accountId?: string;
488
- status?: string;
489
- noteType?: 'issued' | 'received';
490
- maturityStart?: string;
491
- maturityEnd?: string;
492
- issueStart?: string;
493
- issueEnd?: string;
494
- searchText?: string;
489
+ export async function listBankProductTables() {
490
+ return callFinanceHubTool('financehub_list_bank_product_tables', {});
491
+ }
492
+
493
+ /**
494
+ * Generic safe query against any per-(bank, product) table from
495
+ * listBankProductTables. Filters use the table's exact column names
496
+ * (snake_case). Returns rows with totalMatching, limit, offset.
497
+ *
498
+ * @example
499
+ * queryBankProductTable({
500
+ * tableSlug: 'ibk_loan_transactions',
501
+ * filters: [
502
+ * { column: 'account_number', op: '=', value: '306-063568-04-036' },
503
+ * { column: 'transaction_amount', op: '>', value: 1000000 },
504
+ * ],
505
+ * orderBy: { column: 'transaction_date', direction: 'DESC' },
506
+ * limit: 50,
507
+ * });
508
+ */
509
+ export async function queryBankProductTable(options: {
510
+ tableSlug: string;
511
+ filters?: Array<{
512
+ column: string;
513
+ op: '=' | '!=' | '>' | '<' | '>=' | '<=' | 'like' | 'in';
514
+ value: string | number | Array<string | number>;
515
+ }>;
516
+ orderBy?: { column: string; direction?: 'ASC' | 'DESC' };
495
517
  limit?: number;
496
518
  offset?: number;
497
- } = {}) {
498
- return callFinanceHubTool('financehub_query_promissory_notes', options);
519
+ latestOnly?: boolean;
520
+ }) {
521
+ return callFinanceHubTool('financehub_query_bank_product_table', options);
499
522
  }
500
523
 
501
524
  // ==========================================
@@ -1008,6 +1031,16 @@ export async function createTag(data: {
1008
1031
  export async function deleteTag(id: string) {
1009
1032
  return callAICenterTool('ai_center_delete_tag', { id });
1010
1033
  }
1034
+
1035
+ /** List all company-wide shared business deadlines from the company calendar (company_calendar table). */
1036
+ export async function getCalendarEventsFromAICenter() {
1037
+ return callAICenterTool('ai_center_get_calendar_events', {});
1038
+ }
1039
+
1040
+ /** Update the status of an operational task. */
1041
+ export async function completeTask(taskId: string, status: 'completed' | 'approved' | 'rejected') {
1042
+ return callAICenterTool('ai_center_complete_task', { taskId, status });
1043
+ }
1011
1044
  `;
1012
1045
 
1013
1046
  fs.writeFileSync(helperPath, helperContent.replace(/\r?\n/g, os.EOL), 'utf-8');
@@ -53,7 +53,7 @@ export async function discoverTables(
53
53
  })
54
54
  });
55
55
 
56
- const listResult = await listResponse.json().catch(() => null);
56
+ const listResult = (await listResponse.json().catch(() => null)) as any;
57
57
 
58
58
  if (listResult && typeof listResult === 'object' && listResult.success === false) {
59
59
  throw new Error(listResult.error || 'Failed to list tables');
@@ -98,7 +98,7 @@ export async function discoverTables(
98
98
  });
99
99
 
100
100
  if (schemaResponse.ok) {
101
- const schemaResult = await schemaResponse.json();
101
+ const schemaResult = (await schemaResponse.json()) as any;
102
102
  const schemaContent = schemaResult.result?.content?.[0]?.text;
103
103
  const schemaData = schemaContent ? JSON.parse(schemaContent) : null;
104
104