@egdesk/next-api-plugin 1.4.4 → 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.
@@ -843,9 +843,11 @@ export async function createWorkflow(data: {
843
843
  inputTypes: string[];
844
844
  hints: string[];
845
845
  outputTables: string[];
846
- actions: Array<{ actionId: string; params?: Record<string, string> }>;
846
+ actions: Array<{ actionId: string; params?: Record<string, any>; stage?: number; position?: number }>;
847
847
  status?: 'active' | 'suggested' | 'draft';
848
848
  suggestedBy?: string;
849
+ triggerTable?: string | null;
850
+ notify?: string[];
849
851
  }) {
850
852
  return callAICenterTool('ai_center_create_workflow', data);
851
853
  }
@@ -859,6 +861,7 @@ export async function updateWorkflow(
859
861
  inputTypes?: string[];
860
862
  hints?: string[];
861
863
  outputTables?: string[];
864
+ triggerTable?: string | null;
862
865
  }
863
866
  ) {
864
867
  return callAICenterTool('ai_center_update_workflow', { id, ...data });
@@ -877,16 +880,24 @@ export async function deleteWorkflow(id: string) {
877
880
  return callAICenterTool('ai_center_delete_workflow', { id });
878
881
  }
879
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
+
880
890
  // ── Workflow actions ──────────────────────────────────────────────────────────
881
891
 
882
892
  /** Append or insert an action step into a workflow */
883
893
  export async function addWorkflowAction(
884
894
  workflowId: string,
885
895
  actionId: string,
886
- params: Record<string, string>,
896
+ params: Record<string, any>,
897
+ stage: number = 0,
887
898
  position: number = 0
888
899
  ) {
889
- return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, position });
900
+ return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, stage, position });
890
901
  }
891
902
 
892
903
  /** Remove a single action step from a workflow by its row ID */
@@ -894,6 +905,66 @@ export async function removeWorkflowAction(rowId: string) {
894
905
  return callAICenterTool('ai_center_remove_workflow_action', { rowId });
895
906
  }
896
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
+
897
968
  // ── Entities ──────────────────────────────────────────────────────────────────
898
969
 
899
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.4",
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",
@@ -810,9 +810,11 @@ export async function createWorkflow(data: {
810
810
  inputTypes: string[];
811
811
  hints: string[];
812
812
  outputTables: string[];
813
- actions: Array<{ actionId: string; params?: Record<string, string> }>;
813
+ actions: Array<{ actionId: string; params?: Record<string, any>; stage?: number; position?: number }>;
814
814
  status?: 'active' | 'suggested' | 'draft';
815
815
  suggestedBy?: string;
816
+ triggerTable?: string | null;
817
+ notify?: string[];
816
818
  }) {
817
819
  return callAICenterTool('ai_center_create_workflow', data);
818
820
  }
@@ -826,6 +828,7 @@ export async function updateWorkflow(
826
828
  inputTypes?: string[];
827
829
  hints?: string[];
828
830
  outputTables?: string[];
831
+ triggerTable?: string | null;
829
832
  }
830
833
  ) {
831
834
  return callAICenterTool('ai_center_update_workflow', { id, ...data });
@@ -844,16 +847,24 @@ export async function deleteWorkflow(id: string) {
844
847
  return callAICenterTool('ai_center_delete_workflow', { id });
845
848
  }
846
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
+
847
857
  // ── Workflow actions ──────────────────────────────────────────────────────────
848
858
 
849
859
  /** Append or insert an action step into a workflow */
850
860
  export async function addWorkflowAction(
851
861
  workflowId: string,
852
862
  actionId: string,
853
- params: Record<string, string>,
863
+ params: Record<string, any>,
864
+ stage: number = 0,
854
865
  position: number = 0
855
866
  ) {
856
- return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, position });
867
+ return callAICenterTool('ai_center_add_workflow_action', { workflowId, actionId, params, stage, position });
857
868
  }
858
869
 
859
870
  /** Remove a single action step from a workflow by its row ID */
@@ -861,6 +872,66 @@ export async function removeWorkflowAction(rowId: string) {
861
872
  return callAICenterTool('ai_center_remove_workflow_action', { rowId });
862
873
  }
863
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
+
864
935
  // ── Entities ──────────────────────────────────────────────────────────────────
865
936
 
866
937
  /** List all Neuron Layer entities, optionally filtered by type */