@egdesk/next-api-plugin 1.4.3 → 1.4.5

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.
@@ -815,6 +815,16 @@ export async function callAICenterTool(
815
815
  return parseEgdeskMcpToolResponse(response);
816
816
  }
817
817
 
818
+ // ── Data Sources ─────────────────────────────────────────────────────────────
819
+
820
+ /**
821
+ * List all data sources available for AI processing (user data tables, finance hub accounts,
822
+ * business identity snapshots, company research records) with processing state.
823
+ */
824
+ export async function listDataSources() {
825
+ return callAICenterTool('ai_center_list_data_sources', {});
826
+ }
827
+
818
828
  // ── Workflows ────────────────────────────────────────────────────────────────
819
829
 
820
830
  /** List all AI workflows */
@@ -833,9 +843,11 @@ export async function createWorkflow(data: {
833
843
  inputTypes: string[];
834
844
  hints: string[];
835
845
  outputTables: string[];
836
- actions: Array<{ actionId: string; params?: Record<string, string> }>;
846
+ actions: Array<{ actionId: string; params?: Record<string, any>; stage?: number; position?: number }>;
837
847
  status?: 'active' | 'suggested' | 'draft';
838
848
  suggestedBy?: string;
849
+ triggerTable?: string | null;
850
+ notify?: string[];
839
851
  }) {
840
852
  return callAICenterTool('ai_center_create_workflow', data);
841
853
  }
@@ -849,6 +861,7 @@ export async function updateWorkflow(
849
861
  inputTypes?: string[];
850
862
  hints?: string[];
851
863
  outputTables?: string[];
864
+ triggerTable?: string | null;
852
865
  }
853
866
  ) {
854
867
  return callAICenterTool('ai_center_update_workflow', { id, ...data });
@@ -867,16 +880,24 @@ export async function deleteWorkflow(id: string) {
867
880
  return callAICenterTool('ai_center_delete_workflow', { id });
868
881
  }
869
882
 
883
+ // ── Workflow notify roles ─────────────────────────────────────────────────────
884
+
885
+ /** Set which roles receive notifications for all activity on a workflow's runs */
886
+ export async function setWorkflowNotifyRoles(workflowId: string, roles: string[]) {
887
+ return callAICenterTool('ai_center_set_workflow_notify', { workflowId, roles });
888
+ }
889
+
870
890
  // ── Workflow actions ──────────────────────────────────────────────────────────
871
891
 
872
892
  /** Append or insert an action step into a workflow */
873
893
  export async function addWorkflowAction(
874
894
  workflowId: string,
875
895
  actionId: string,
876
- params: Record<string, string>,
896
+ params: Record<string, any>,
897
+ stage: number = 0,
877
898
  position: number = 0
878
899
  ) {
879
- return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, position });
900
+ return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, stage, position });
880
901
  }
881
902
 
882
903
  /** Remove a single action step from a workflow by its row ID */
@@ -884,6 +905,66 @@ export async function removeWorkflowAction(rowId: string) {
884
905
  return callAICenterTool('ai_center_remove_workflow_action', { rowId });
885
906
  }
886
907
 
908
+ // ── Workflow runs ─────────────────────────────────────────────────────────────
909
+
910
+ /** Start a new run of a workflow, optionally linked to a source data row */
911
+ export async function createRun(
912
+ workflowId: string,
913
+ inputData: Record<string, any>,
914
+ sourceTable?: string | null,
915
+ sourceRowId?: string | null
916
+ ) {
917
+ return callAICenterTool('ai_center_create_run', { workflowId, inputData, sourceTable, sourceRowId });
918
+ }
919
+
920
+ /** Get a single workflow run by ID */
921
+ export async function getRun(runId: string) {
922
+ return callAICenterTool('ai_center_get_run', { runId });
923
+ }
924
+
925
+ /** Get all runs for a workflow */
926
+ export async function getRuns(workflowId: string) {
927
+ return callAICenterTool('ai_center_get_runs', { workflowId });
928
+ }
929
+
930
+ /** Update the status of a workflow run */
931
+ export async function updateRunStatus(
932
+ runId: string,
933
+ status: '정상진행중' | '반려중' | '정상완료' | '취소완료'
934
+ ) {
935
+ return callAICenterTool('ai_center_update_run_status', { runId, status });
936
+ }
937
+
938
+ /** Advance a workflow run to a new stage */
939
+ export async function advanceRunStage(runId: string, stage: number) {
940
+ return callAICenterTool('ai_center_advance_run_stage', { runId, stage });
941
+ }
942
+
943
+ // ── Workflow approvals ────────────────────────────────────────────────────────
944
+
945
+ /** Create a pending approval record for a run */
946
+ export async function createApproval(
947
+ runId: string,
948
+ stage: number,
949
+ chainPosition: number,
950
+ role: string
951
+ ) {
952
+ return callAICenterTool('ai_center_create_approval', { runId, stage, chainPosition, role });
953
+ }
954
+
955
+ /** Get all approval records for a run */
956
+ export async function getApprovals(runId: string) {
957
+ return callAICenterTool('ai_center_get_approvals', { runId });
958
+ }
959
+
960
+ /** Record an approval decision */
961
+ export async function recordApprovalDecision(
962
+ approvalId: string,
963
+ decision: 'approved' | 'rejected' | 'cancelled'
964
+ ) {
965
+ return callAICenterTool('ai_center_record_approval_decision', { approvalId, decision });
966
+ }
967
+
887
968
  // ── Entities ──────────────────────────────────────────────────────────────────
888
969
 
889
970
  /** 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.3",
3
+ "version": "1.4.5",
4
4
  "description": "Next.js plugin for EGDesk database proxy integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -782,6 +782,16 @@ export async function callAICenterTool(
782
782
  return parseEgdeskMcpToolResponse(response);
783
783
  }
784
784
 
785
+ // ── Data Sources ─────────────────────────────────────────────────────────────
786
+
787
+ /**
788
+ * List all data sources available for AI processing (user data tables, finance hub accounts,
789
+ * business identity snapshots, company research records) with processing state.
790
+ */
791
+ export async function listDataSources() {
792
+ return callAICenterTool('ai_center_list_data_sources', {});
793
+ }
794
+
785
795
  // ── Workflows ────────────────────────────────────────────────────────────────
786
796
 
787
797
  /** List all AI workflows */
@@ -800,9 +810,11 @@ export async function createWorkflow(data: {
800
810
  inputTypes: string[];
801
811
  hints: string[];
802
812
  outputTables: string[];
803
- actions: Array<{ actionId: string; params?: Record<string, string> }>;
813
+ actions: Array<{ actionId: string; params?: Record<string, any>; stage?: number; position?: number }>;
804
814
  status?: 'active' | 'suggested' | 'draft';
805
815
  suggestedBy?: string;
816
+ triggerTable?: string | null;
817
+ notify?: string[];
806
818
  }) {
807
819
  return callAICenterTool('ai_center_create_workflow', data);
808
820
  }
@@ -816,6 +828,7 @@ export async function updateWorkflow(
816
828
  inputTypes?: string[];
817
829
  hints?: string[];
818
830
  outputTables?: string[];
831
+ triggerTable?: string | null;
819
832
  }
820
833
  ) {
821
834
  return callAICenterTool('ai_center_update_workflow', { id, ...data });
@@ -834,16 +847,24 @@ export async function deleteWorkflow(id: string) {
834
847
  return callAICenterTool('ai_center_delete_workflow', { id });
835
848
  }
836
849
 
850
+ // ── Workflow notify roles ─────────────────────────────────────────────────────
851
+
852
+ /** Set which roles receive notifications for all activity on a workflow's runs */
853
+ export async function setWorkflowNotifyRoles(workflowId: string, roles: string[]) {
854
+ return callAICenterTool('ai_center_set_workflow_notify', { workflowId, roles });
855
+ }
856
+
837
857
  // ── Workflow actions ──────────────────────────────────────────────────────────
838
858
 
839
859
  /** Append or insert an action step into a workflow */
840
860
  export async function addWorkflowAction(
841
861
  workflowId: string,
842
862
  actionId: string,
843
- params: Record<string, string>,
863
+ params: Record<string, any>,
864
+ stage: number = 0,
844
865
  position: number = 0
845
866
  ) {
846
- return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, position });
867
+ return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, stage, position });
847
868
  }
848
869
 
849
870
  /** Remove a single action step from a workflow by its row ID */
@@ -851,6 +872,66 @@ export async function removeWorkflowAction(rowId: string) {
851
872
  return callAICenterTool('ai_center_remove_workflow_action', { rowId });
852
873
  }
853
874
 
875
+ // ── Workflow runs ─────────────────────────────────────────────────────────────
876
+
877
+ /** Start a new run of a workflow, optionally linked to a source data row */
878
+ export async function createRun(
879
+ workflowId: string,
880
+ inputData: Record<string, any>,
881
+ sourceTable?: string | null,
882
+ sourceRowId?: string | null
883
+ ) {
884
+ return callAICenterTool('ai_center_create_run', { workflowId, inputData, sourceTable, sourceRowId });
885
+ }
886
+
887
+ /** Get a single workflow run by ID */
888
+ export async function getRun(runId: string) {
889
+ return callAICenterTool('ai_center_get_run', { runId });
890
+ }
891
+
892
+ /** Get all runs for a workflow */
893
+ export async function getRuns(workflowId: string) {
894
+ return callAICenterTool('ai_center_get_runs', { workflowId });
895
+ }
896
+
897
+ /** Update the status of a workflow run */
898
+ export async function updateRunStatus(
899
+ runId: string,
900
+ status: '정상진행중' | '반려중' | '정상완료' | '취소완료'
901
+ ) {
902
+ return callAICenterTool('ai_center_update_run_status', { runId, status });
903
+ }
904
+
905
+ /** Advance a workflow run to a new stage */
906
+ export async function advanceRunStage(runId: string, stage: number) {
907
+ return callAICenterTool('ai_center_advance_run_stage', { runId, stage });
908
+ }
909
+
910
+ // ── Workflow approvals ────────────────────────────────────────────────────────
911
+
912
+ /** Create a pending approval record for a run */
913
+ export async function createApproval(
914
+ runId: string,
915
+ stage: number,
916
+ chainPosition: number,
917
+ role: string
918
+ ) {
919
+ return callAICenterTool('ai_center_create_approval', { runId, stage, chainPosition, role });
920
+ }
921
+
922
+ /** Get all approval records for a run */
923
+ export async function getApprovals(runId: string) {
924
+ return callAICenterTool('ai_center_get_approvals', { runId });
925
+ }
926
+
927
+ /** Record an approval decision */
928
+ export async function recordApprovalDecision(
929
+ approvalId: string,
930
+ decision: 'approved' | 'rejected' | 'cancelled'
931
+ ) {
932
+ return callAICenterTool('ai_center_record_approval_decision', { approvalId, decision });
933
+ }
934
+
854
935
  // ── Entities ──────────────────────────────────────────────────────────────────
855
936
 
856
937
  /** List all Neuron Layer entities, optionally filtered by type */