@egdesk/next-api-plugin 1.4.4 → 1.5.0

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,44 @@ 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
+ }) {
553
+ return callFinanceHubTool('financehub_query_bank_product_table', options);
532
554
  }
533
555
 
534
556
  // ==========================================
@@ -843,9 +865,11 @@ export async function createWorkflow(data: {
843
865
  inputTypes: string[];
844
866
  hints: string[];
845
867
  outputTables: string[];
846
- actions: Array<{ actionId: string; params?: Record<string, string> }>;
868
+ actions: Array<{ actionId: string; params?: Record<string, any>; stage?: number; position?: number }>;
847
869
  status?: 'active' | 'suggested' | 'draft';
848
870
  suggestedBy?: string;
871
+ triggerTable?: string | null;
872
+ notify?: string[];
849
873
  }) {
850
874
  return callAICenterTool('ai_center_create_workflow', data);
851
875
  }
@@ -859,6 +883,7 @@ export async function updateWorkflow(
859
883
  inputTypes?: string[];
860
884
  hints?: string[];
861
885
  outputTables?: string[];
886
+ triggerTable?: string | null;
862
887
  }
863
888
  ) {
864
889
  return callAICenterTool('ai_center_update_workflow', { id, ...data });
@@ -877,16 +902,24 @@ export async function deleteWorkflow(id: string) {
877
902
  return callAICenterTool('ai_center_delete_workflow', { id });
878
903
  }
879
904
 
905
+ // ── Workflow notify roles ─────────────────────────────────────────────────────
906
+
907
+ /** Set which roles receive notifications for all activity on a workflow's runs */
908
+ export async function setWorkflowNotifyRoles(workflowId: string, roles: string[]) {
909
+ return callAICenterTool('ai_center_set_workflow_notify', { workflowId, roles });
910
+ }
911
+
880
912
  // ── Workflow actions ──────────────────────────────────────────────────────────
881
913
 
882
914
  /** Append or insert an action step into a workflow */
883
915
  export async function addWorkflowAction(
884
916
  workflowId: string,
885
917
  actionId: string,
886
- params: Record<string, string>,
918
+ params: Record<string, any>,
919
+ stage: number = 0,
887
920
  position: number = 0
888
921
  ) {
889
- return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, position });
922
+ return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, stage, position });
890
923
  }
891
924
 
892
925
  /** Remove a single action step from a workflow by its row ID */
@@ -894,6 +927,66 @@ export async function removeWorkflowAction(rowId: string) {
894
927
  return callAICenterTool('ai_center_remove_workflow_action', { rowId });
895
928
  }
896
929
 
930
+ // ── Workflow runs ─────────────────────────────────────────────────────────────
931
+
932
+ /** Start a new run of a workflow, optionally linked to a source data row */
933
+ export async function createRun(
934
+ workflowId: string,
935
+ inputData: Record<string, any>,
936
+ sourceTable?: string | null,
937
+ sourceRowId?: string | null
938
+ ) {
939
+ return callAICenterTool('ai_center_create_run', { workflowId, inputData, sourceTable, sourceRowId });
940
+ }
941
+
942
+ /** Get a single workflow run by ID */
943
+ export async function getRun(runId: string) {
944
+ return callAICenterTool('ai_center_get_run', { runId });
945
+ }
946
+
947
+ /** Get all runs for a workflow */
948
+ export async function getRuns(workflowId: string) {
949
+ return callAICenterTool('ai_center_get_runs', { workflowId });
950
+ }
951
+
952
+ /** Update the status of a workflow run */
953
+ export async function updateRunStatus(
954
+ runId: string,
955
+ status: '정상진행중' | '반려중' | '정상완료' | '취소완료'
956
+ ) {
957
+ return callAICenterTool('ai_center_update_run_status', { runId, status });
958
+ }
959
+
960
+ /** Advance a workflow run to a new stage */
961
+ export async function advanceRunStage(runId: string, stage: number) {
962
+ return callAICenterTool('ai_center_advance_run_stage', { runId, stage });
963
+ }
964
+
965
+ // ── Workflow approvals ────────────────────────────────────────────────────────
966
+
967
+ /** Create a pending approval record for a run */
968
+ export async function createApproval(
969
+ runId: string,
970
+ stage: number,
971
+ chainPosition: number,
972
+ role: string
973
+ ) {
974
+ return callAICenterTool('ai_center_create_approval', { runId, stage, chainPosition, role });
975
+ }
976
+
977
+ /** Get all approval records for a run */
978
+ export async function getApprovals(runId: string) {
979
+ return callAICenterTool('ai_center_get_approvals', { runId });
980
+ }
981
+
982
+ /** Record an approval decision */
983
+ export async function recordApprovalDecision(
984
+ approvalId: string,
985
+ decision: 'approved' | 'rejected' | 'cancelled'
986
+ ) {
987
+ return callAICenterTool('ai_center_record_approval_decision', { approvalId, decision });
988
+ }
989
+
897
990
  // ── Entities ──────────────────────────────────────────────────────────────────
898
991
 
899
992
  /** List all Neuron Layer entities, optionally filtered by type */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egdesk/next-api-plugin",
3
- "version": "1.4.4",
3
+ "version": "1.5.0",
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,44 @@ 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
+ }) {
520
+ return callFinanceHubTool('financehub_query_bank_product_table', options);
499
521
  }
500
522
 
501
523
  // ==========================================
@@ -810,9 +832,11 @@ export async function createWorkflow(data: {
810
832
  inputTypes: string[];
811
833
  hints: string[];
812
834
  outputTables: string[];
813
- actions: Array<{ actionId: string; params?: Record<string, string> }>;
835
+ actions: Array<{ actionId: string; params?: Record<string, any>; stage?: number; position?: number }>;
814
836
  status?: 'active' | 'suggested' | 'draft';
815
837
  suggestedBy?: string;
838
+ triggerTable?: string | null;
839
+ notify?: string[];
816
840
  }) {
817
841
  return callAICenterTool('ai_center_create_workflow', data);
818
842
  }
@@ -826,6 +850,7 @@ export async function updateWorkflow(
826
850
  inputTypes?: string[];
827
851
  hints?: string[];
828
852
  outputTables?: string[];
853
+ triggerTable?: string | null;
829
854
  }
830
855
  ) {
831
856
  return callAICenterTool('ai_center_update_workflow', { id, ...data });
@@ -844,16 +869,24 @@ export async function deleteWorkflow(id: string) {
844
869
  return callAICenterTool('ai_center_delete_workflow', { id });
845
870
  }
846
871
 
872
+ // ── Workflow notify roles ─────────────────────────────────────────────────────
873
+
874
+ /** Set which roles receive notifications for all activity on a workflow's runs */
875
+ export async function setWorkflowNotifyRoles(workflowId: string, roles: string[]) {
876
+ return callAICenterTool('ai_center_set_workflow_notify', { workflowId, roles });
877
+ }
878
+
847
879
  // ── Workflow actions ──────────────────────────────────────────────────────────
848
880
 
849
881
  /** Append or insert an action step into a workflow */
850
882
  export async function addWorkflowAction(
851
883
  workflowId: string,
852
884
  actionId: string,
853
- params: Record<string, string>,
885
+ params: Record<string, any>,
886
+ stage: number = 0,
854
887
  position: number = 0
855
888
  ) {
856
- return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, position });
889
+ return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, stage, position });
857
890
  }
858
891
 
859
892
  /** Remove a single action step from a workflow by its row ID */
@@ -861,6 +894,66 @@ export async function removeWorkflowAction(rowId: string) {
861
894
  return callAICenterTool('ai_center_remove_workflow_action', { rowId });
862
895
  }
863
896
 
897
+ // ── Workflow runs ─────────────────────────────────────────────────────────────
898
+
899
+ /** Start a new run of a workflow, optionally linked to a source data row */
900
+ export async function createRun(
901
+ workflowId: string,
902
+ inputData: Record<string, any>,
903
+ sourceTable?: string | null,
904
+ sourceRowId?: string | null
905
+ ) {
906
+ return callAICenterTool('ai_center_create_run', { workflowId, inputData, sourceTable, sourceRowId });
907
+ }
908
+
909
+ /** Get a single workflow run by ID */
910
+ export async function getRun(runId: string) {
911
+ return callAICenterTool('ai_center_get_run', { runId });
912
+ }
913
+
914
+ /** Get all runs for a workflow */
915
+ export async function getRuns(workflowId: string) {
916
+ return callAICenterTool('ai_center_get_runs', { workflowId });
917
+ }
918
+
919
+ /** Update the status of a workflow run */
920
+ export async function updateRunStatus(
921
+ runId: string,
922
+ status: '정상진행중' | '반려중' | '정상완료' | '취소완료'
923
+ ) {
924
+ return callAICenterTool('ai_center_update_run_status', { runId, status });
925
+ }
926
+
927
+ /** Advance a workflow run to a new stage */
928
+ export async function advanceRunStage(runId: string, stage: number) {
929
+ return callAICenterTool('ai_center_advance_run_stage', { runId, stage });
930
+ }
931
+
932
+ // ── Workflow approvals ────────────────────────────────────────────────────────
933
+
934
+ /** Create a pending approval record for a run */
935
+ export async function createApproval(
936
+ runId: string,
937
+ stage: number,
938
+ chainPosition: number,
939
+ role: string
940
+ ) {
941
+ return callAICenterTool('ai_center_create_approval', { runId, stage, chainPosition, role });
942
+ }
943
+
944
+ /** Get all approval records for a run */
945
+ export async function getApprovals(runId: string) {
946
+ return callAICenterTool('ai_center_get_approvals', { runId });
947
+ }
948
+
949
+ /** Record an approval decision */
950
+ export async function recordApprovalDecision(
951
+ approvalId: string,
952
+ decision: 'approved' | 'rejected' | 'cancelled'
953
+ ) {
954
+ return callAICenterTool('ai_center_record_approval_decision', { approvalId, decision });
955
+ }
956
+
864
957
  // ── Entities ──────────────────────────────────────────────────────────────────
865
958
 
866
959
  /** List all Neuron Layer entities, optionally filtered by type */