@egdesk/next-api-plugin 1.5.0 → 1.5.2

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.
@@ -549,10 +549,63 @@ export async function queryBankProductTable(options: {
549
549
  orderBy?: { column: string; direction?: 'ASC' | 'DESC' };
550
550
  limit?: number;
551
551
  offset?: number;
552
+ latestOnly?: boolean;
552
553
  }) {
553
554
  return callFinanceHubTool('financehub_query_bank_product_table', options);
554
555
  }
555
556
 
557
+ /**
558
+ * Create or update a bank/card account (no credentials).
559
+ */
560
+ export async function upsertFinanceHubAccount(account: {
561
+ bankId: string;
562
+ accountNumber: string;
563
+ accountName?: string;
564
+ customerName?: string;
565
+ balance?: number;
566
+ availableBalance?: number;
567
+ currency?: string;
568
+ accountType?: string;
569
+ openDate?: string;
570
+ metadata?: Record<string, unknown>;
571
+ }) {
572
+ return callFinanceHubTool('financehub_upsert_account', account);
573
+ }
574
+
575
+ /**
576
+ * Import bank or card transactions (deduplicated). Max 1000 per call.
577
+ */
578
+ export async function importFinanceHubTransactions(options: {
579
+ bankId: string;
580
+ accountData: {
581
+ accountNumber: string;
582
+ accountName?: string;
583
+ customerName?: string;
584
+ balance?: number;
585
+ availableBalance?: number;
586
+ openDate?: string;
587
+ };
588
+ transactions: Array<Record<string, unknown>>;
589
+ syncMetadata: {
590
+ queryPeriodStart: string;
591
+ queryPeriodEnd: string;
592
+ filePath?: string;
593
+ };
594
+ isCard?: boolean;
595
+ }) {
596
+ return callFinanceHubTool('financehub_import_transactions', options);
597
+ }
598
+
599
+ /**
600
+ * Upsert rows into a bank-product table (loans, receivables, etc.). Max 500 per call.
601
+ */
602
+ export async function upsertFinanceHubBankProductRows(options: {
603
+ tableSlug: string;
604
+ rows: Array<Record<string, unknown>>;
605
+ }) {
606
+ return callFinanceHubTool('financehub_upsert_bank_product_rows', options);
607
+ }
608
+
556
609
  // ==========================================
557
610
  // INTERNAL KNOWLEDGE / BUSINESS IDENTITY / COMPANY RESEARCH (MCP)
558
611
  // ==========================================
@@ -1063,6 +1116,16 @@ export async function createTag(data: {
1063
1116
  export async function deleteTag(id: string) {
1064
1117
  return callAICenterTool('ai_center_delete_tag', { id });
1065
1118
  }
1119
+
1120
+ /** List all company-wide shared business deadlines from the company calendar (company_calendar table). */
1121
+ export async function getCalendarEventsFromAICenter() {
1122
+ return callAICenterTool('ai_center_get_calendar_events', {});
1123
+ }
1124
+
1125
+ /** Update the status of an operational task. */
1126
+ export async function completeTask(taskId: string, status: 'completed' | 'approved' | 'rejected') {
1127
+ return callAICenterTool('ai_center_complete_task', { taskId, status });
1128
+ }
1066
1129
  `;
1067
1130
  fs.writeFileSync(helperPath, helperContent.replace(/\r?\n/g, os.EOL), 'utf-8');
1068
1131
  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.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Next.js plugin for EGDesk database proxy integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -516,10 +516,63 @@ export async function queryBankProductTable(options: {
516
516
  orderBy?: { column: string; direction?: 'ASC' | 'DESC' };
517
517
  limit?: number;
518
518
  offset?: number;
519
+ latestOnly?: boolean;
519
520
  }) {
520
521
  return callFinanceHubTool('financehub_query_bank_product_table', options);
521
522
  }
522
523
 
524
+ /**
525
+ * Create or update a bank/card account (no credentials).
526
+ */
527
+ export async function upsertFinanceHubAccount(account: {
528
+ bankId: string;
529
+ accountNumber: string;
530
+ accountName?: string;
531
+ customerName?: string;
532
+ balance?: number;
533
+ availableBalance?: number;
534
+ currency?: string;
535
+ accountType?: string;
536
+ openDate?: string;
537
+ metadata?: Record<string, unknown>;
538
+ }) {
539
+ return callFinanceHubTool('financehub_upsert_account', account);
540
+ }
541
+
542
+ /**
543
+ * Import bank or card transactions (deduplicated). Max 1000 per call.
544
+ */
545
+ export async function importFinanceHubTransactions(options: {
546
+ bankId: string;
547
+ accountData: {
548
+ accountNumber: string;
549
+ accountName?: string;
550
+ customerName?: string;
551
+ balance?: number;
552
+ availableBalance?: number;
553
+ openDate?: string;
554
+ };
555
+ transactions: Array<Record<string, unknown>>;
556
+ syncMetadata: {
557
+ queryPeriodStart: string;
558
+ queryPeriodEnd: string;
559
+ filePath?: string;
560
+ };
561
+ isCard?: boolean;
562
+ }) {
563
+ return callFinanceHubTool('financehub_import_transactions', options);
564
+ }
565
+
566
+ /**
567
+ * Upsert rows into a bank-product table (loans, receivables, etc.). Max 500 per call.
568
+ */
569
+ export async function upsertFinanceHubBankProductRows(options: {
570
+ tableSlug: string;
571
+ rows: Array<Record<string, unknown>>;
572
+ }) {
573
+ return callFinanceHubTool('financehub_upsert_bank_product_rows', options);
574
+ }
575
+
523
576
  // ==========================================
524
577
  // INTERNAL KNOWLEDGE / BUSINESS IDENTITY / COMPANY RESEARCH (MCP)
525
578
  // ==========================================
@@ -1030,6 +1083,16 @@ export async function createTag(data: {
1030
1083
  export async function deleteTag(id: string) {
1031
1084
  return callAICenterTool('ai_center_delete_tag', { id });
1032
1085
  }
1086
+
1087
+ /** List all company-wide shared business deadlines from the company calendar (company_calendar table). */
1088
+ export async function getCalendarEventsFromAICenter() {
1089
+ return callAICenterTool('ai_center_get_calendar_events', {});
1090
+ }
1091
+
1092
+ /** Update the status of an operational task. */
1093
+ export async function completeTask(taskId: string, status: 'completed' | 'approved' | 'rejected') {
1094
+ return callAICenterTool('ai_center_complete_task', { taskId, status });
1095
+ }
1033
1096
  `;
1034
1097
 
1035
1098
  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