@bluecopa/core 0.1.17 → 0.1.19

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.
@@ -0,0 +1,15 @@
1
+ import { Form } from './getFormById';
2
+ export interface CreateOrUpdateFormRequest {
3
+ data: Form;
4
+ }
5
+ export interface CreateOrUpdateFormResponse {
6
+ data: Form;
7
+ }
8
+ /**
9
+ * Creates or updates a form
10
+ * @param params - The form creation/update parameters
11
+ * @param params.data - Required: The form data
12
+ * @returns Promise<Form> The created or updated form
13
+ * @throws Error if the request fails
14
+ */
15
+ export declare function createOrUpdateForm({ data, }: CreateOrUpdateFormRequest): Promise<Form>;
@@ -0,0 +1,14 @@
1
+ export interface GetFormByIdRequest {
2
+ formId: string;
3
+ }
4
+ export interface Form {
5
+ [key: string]: any;
6
+ }
7
+ /**
8
+ * Gets form by ID
9
+ * @param params - The form request parameters
10
+ * @param params.formId - Required: The ID of the form
11
+ * @returns Promise<Form> The form data
12
+ * @throws Error if the request fails
13
+ */
14
+ export declare function getFormById({ formId, }: GetFormByIdRequest): Promise<Form>;
@@ -1,2 +1,4 @@
1
1
  export * from './getFormSchema';
2
2
  export * from './getFormData';
3
+ export * from './getFormById';
4
+ export * from './createOrUpdateForm';
@@ -14,3 +14,5 @@ export * as task from './task';
14
14
  export * as recon from './recon';
15
15
  export * as form from './form';
16
16
  export * as audit from './audit';
17
+ export * as templatedPipeline from './templatedPipeline';
18
+ export * as process from './process';
@@ -0,0 +1,2 @@
1
+ export * from './markTaskDone';
2
+ export * from './reassignTask';
@@ -0,0 +1,22 @@
1
+ export interface CompleteTaskRequest {
2
+ [key: string]: any;
3
+ }
4
+ export interface ProcessTask {
5
+ [key: string]: any;
6
+ }
7
+ export interface MarkTaskDoneRequest {
8
+ taskId: string;
9
+ data: CompleteTaskRequest;
10
+ }
11
+ export interface MarkTaskDoneResponse {
12
+ data: ProcessTask;
13
+ }
14
+ /**
15
+ * Marks a task as done
16
+ * @param params - The task completion parameters
17
+ * @param params.taskId - Required: The ID of the task
18
+ * @param params.data - Required: The task completion data
19
+ * @returns Promise<ProcessTask> The updated task
20
+ * @throws Error if the request fails
21
+ */
22
+ export declare function markTaskDone({ taskId, data, }: MarkTaskDoneRequest): Promise<ProcessTask>;
@@ -0,0 +1,19 @@
1
+ import { ProcessTask } from './markTaskDone';
2
+ export interface ReassignTaskRequest {
3
+ taskId: string;
4
+ newAssignee: string;
5
+ assigneeType: "USER" | "TEAM";
6
+ }
7
+ export interface ReassignTaskResponse {
8
+ data: ProcessTask;
9
+ }
10
+ /**
11
+ * Reassigns a task to a new assignee
12
+ * @param params - The task reassignment parameters
13
+ * @param params.taskId - Required: The ID of the task
14
+ * @param params.newAssignee - Required: The new assignee ID
15
+ * @param params.assigneeType - Required: The type of assignee (USER or TEAM)
16
+ * @returns Promise<ProcessTask> The updated task
17
+ * @throws Error if the request fails
18
+ */
19
+ export declare function reassignTask({ taskId, newAssignee, assigneeType, }: ReassignTaskRequest): Promise<ProcessTask>;
@@ -0,0 +1,9 @@
1
+ export interface ReconWorkflow {
2
+ [key: string]: any;
3
+ }
4
+ /**
5
+ * Gets all recon workflows
6
+ * @returns Promise<ReconWorkflow[]> The list of recon workflows
7
+ * @throws Error if the request fails
8
+ */
9
+ export declare function getAllReconWorkflows(): Promise<ReconWorkflow[]>;
@@ -1 +1,2 @@
1
1
  export * from './runRecon';
2
+ export * from './getAllReconWorkflows';
@@ -0,0 +1,12 @@
1
+ export interface TemplatedPipelineWorkflow {
2
+ [key: string]: any;
3
+ }
4
+ export interface GetAllTemplatedPipelinesResponse {
5
+ data: TemplatedPipelineWorkflow[];
6
+ }
7
+ /**
8
+ * Gets all templated pipeline workflows
9
+ * @returns Promise<GetAllTemplatedPipelinesResponse> The list of templated pipeline workflows
10
+ * @throws Error if the request fails
11
+ */
12
+ export declare function getAllTemplatedPipelines(): Promise<TemplatedPipelineWorkflow[]>;
@@ -0,0 +1 @@
1
+ export * from './getAllTemplatedPipelines';
package/dist/index.d.ts CHANGED
@@ -4,3 +4,15 @@ export * as copaUtils from './utils';
4
4
  export { default as copaTailwindConfig } from './tailwind/bluecopa.config';
5
5
  export type { GetAuditLogsRequest, AuditLogResponse } from './api/audit/getAuditLogs';
6
6
  export type { AuditRecord, CreateAuditLogRequest } from './api/audit/createAuditLog';
7
+ export type { TemplatedPipelineWorkflow, GetAllTemplatedPipelinesResponse } from './api/templatedPipeline/getAllTemplatedPipelines';
8
+ export type { ReconWorkflow } from './api/recon/getAllReconWorkflows';
9
+ export type { RunReconRequest, RunReconResponse } from './api/recon/runRecon';
10
+ export type { GetFormByIdRequest, Form } from './api/form/getFormById';
11
+ export type { CreateOrUpdateFormRequest, CreateOrUpdateFormResponse } from './api/form/createOrUpdateForm';
12
+ export type { GetFormSchemaRequest } from './api/form/getFormSchema';
13
+ export type { GetFormDataRequest } from './api/form/getFormData';
14
+ export type { MarkTaskDoneRequest, MarkTaskDoneResponse, ProcessTask, CompleteTaskRequest } from './api/process/markTaskDone';
15
+ export type { ReassignTaskRequest, ReassignTaskResponse } from './api/process/reassignTask';
16
+ export type { FileUploadRequest, FileUploadResponse } from './api/file/fileUpload';
17
+ export type { FileDownloadRequest } from './api/file/fileDownload';
18
+ export type { GetFileUrlRequest, GetFileUrlResponse } from './api/file/getFileUrlByFileId';
package/dist/index.es.js CHANGED
@@ -100,7 +100,7 @@ async function getLoggedInUserDetails() {
100
100
  throw { message, status };
101
101
  }
102
102
  }
103
- const index$g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
103
+ const index$i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
104
104
  __proto__: null,
105
105
  getLoggedInUserDetails
106
106
  }, Symbol.toStringTag, { value: "Module" }));
@@ -159,7 +159,7 @@ const getWorkflowInstanceStatusById = async (request) => {
159
159
  throw { message, status };
160
160
  }
161
161
  };
162
- const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
162
+ const index$h = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
163
163
  __proto__: null,
164
164
  WorkflowStatus,
165
165
  getWorkflowInstanceStatusById,
@@ -196,17 +196,17 @@ async function fileUpload({
196
196
  if (!data) {
197
197
  throw { message: "Data is required", status: 400 };
198
198
  }
199
- const response = await apiClient.post("/api/v1/file/fileUpload", {
199
+ const response = await apiClient.post("/api/v1/file/file-upload", {
200
200
  path,
201
201
  contentType,
202
202
  method,
203
203
  data,
204
204
  uploadType
205
205
  });
206
- if (!response.data) {
206
+ if (!response.data || !response.data.data) {
207
207
  throw { message: "Failed to upload file", status: 500 };
208
208
  }
209
- return response.data;
209
+ return response.data.data;
210
210
  } catch (error) {
211
211
  const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while uploading file";
212
212
  const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
@@ -222,19 +222,19 @@ async function fileDownload({
222
222
  throw { message: "File ID is required", status: 400 };
223
223
  }
224
224
  const response = await apiClient.get(
225
- `/api/v1/file/fileDownload?fileId=${encodeURIComponent(fileId)}`
225
+ `/api/v1/file/file-download?fileId=${encodeURIComponent(fileId)}`
226
226
  );
227
- if (!response.data) {
227
+ if (!response.data || !response.data.data) {
228
228
  throw { message: "Failed to download file", status: 500 };
229
229
  }
230
- return response.data;
230
+ return response.data.data;
231
231
  } catch (error) {
232
232
  const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while downloading file";
233
233
  const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
234
234
  throw { message, status };
235
235
  }
236
236
  }
237
- const index$e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
237
+ const index$g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
238
238
  __proto__: null,
239
239
  fileDownload,
240
240
  fileUpload,
@@ -308,7 +308,7 @@ const runDefinition = async (props) => {
308
308
  };
309
309
  }
310
310
  };
311
- const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
311
+ const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
312
312
  __proto__: null,
313
313
  runDefinition,
314
314
  runPublishedDefinition,
@@ -346,7 +346,7 @@ const getWorksheetsByType = async (type) => {
346
346
  throw { message, status };
347
347
  }
348
348
  };
349
- const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
349
+ const index$e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
350
350
  __proto__: null,
351
351
  getWorksheets,
352
352
  getWorksheetsByType
@@ -5488,7 +5488,7 @@ const getUniqueDuplicateName = (name, collectionToCheckIn, suffix = "Copy", conc
5488
5488
  }
5489
5489
  return newName.trim();
5490
5490
  };
5491
- const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5491
+ const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5492
5492
  __proto__: null,
5493
5493
  formatDate,
5494
5494
  generatePushID,
@@ -5653,7 +5653,7 @@ const getData$3 = async (metricSheetId, options) => {
5653
5653
  resultData = _.flatten(resultData);
5654
5654
  return { data: resultData };
5655
5655
  };
5656
- const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5656
+ const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5657
5657
  __proto__: null,
5658
5658
  getData: getData$3
5659
5659
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5804,7 +5804,7 @@ async function checkSubscriptionStatus(userId, threadId) {
5804
5804
  throw { message, status };
5805
5805
  }
5806
5806
  }
5807
- const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5807
+ const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5808
5808
  __proto__: null,
5809
5809
  checkSubscriptionStatus,
5810
5810
  createThread,
@@ -6008,7 +6008,7 @@ const getAllDatasets = async () => {
6008
6008
  throw { message, status };
6009
6009
  }
6010
6010
  };
6011
- const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6011
+ const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6012
6012
  __proto__: null,
6013
6013
  getAllDatasets,
6014
6014
  getData: getData$2,
@@ -6195,7 +6195,7 @@ const getInputTables = async () => {
6195
6195
  throw { message, status };
6196
6196
  }
6197
6197
  };
6198
- const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6198
+ const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6199
6199
  __proto__: null,
6200
6200
  getData: getData$1,
6201
6201
  getInputTables,
@@ -6283,7 +6283,7 @@ async function publishWorkbook({
6283
6283
  throw { message, status };
6284
6284
  }
6285
6285
  }
6286
- const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6286
+ const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6287
6287
  __proto__: null,
6288
6288
  getPublishedWorkbookById,
6289
6289
  getWorkbookDetails,
@@ -6551,7 +6551,7 @@ const getRunResultById = async (runId) => {
6551
6551
  throw { message, status };
6552
6552
  }
6553
6553
  };
6554
- const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6554
+ const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6555
6555
  __proto__: null,
6556
6556
  createNewRun,
6557
6557
  getData,
@@ -6581,7 +6581,7 @@ async function getTaskDetails({
6581
6581
  throw { message, status };
6582
6582
  }
6583
6583
  }
6584
- const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6584
+ const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6585
6585
  __proto__: null,
6586
6586
  getTaskDetails
6587
6587
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6613,8 +6613,23 @@ async function runRecon({
6613
6613
  throw { message, status };
6614
6614
  }
6615
6615
  }
6616
- const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6616
+ async function getAllReconWorkflows() {
6617
+ var _a, _b, _c;
6618
+ try {
6619
+ const response = await apiClient.get("/api/v1/recon/get-all");
6620
+ if (!response.data || !response.data.data) {
6621
+ throw { message: "Failed to fetch recon workflows", status: 500 };
6622
+ }
6623
+ return response.data.data;
6624
+ } catch (error) {
6625
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching recon workflows";
6626
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6627
+ throw { message, status };
6628
+ }
6629
+ }
6630
+ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6617
6631
  __proto__: null,
6632
+ getAllReconWorkflows,
6618
6633
  runRecon
6619
6634
  }, Symbol.toStringTag, { value: "Module" }));
6620
6635
  async function getFormSchema({
@@ -6660,8 +6675,52 @@ async function getFormData({
6660
6675
  throw { message, status };
6661
6676
  }
6662
6677
  }
6663
- const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6678
+ async function getFormById({
6679
+ formId
6680
+ }) {
6681
+ var _a, _b, _c;
6682
+ try {
6683
+ if (!formId) {
6684
+ throw { message: "Form ID is required", status: 400 };
6685
+ }
6686
+ const response = await apiClient.get(
6687
+ `/api/v1/form/get-form-by-id?formId=${encodeURIComponent(formId)}`
6688
+ );
6689
+ if (!response.data || !response.data.data) {
6690
+ throw { message: "Failed to fetch form", status: 500 };
6691
+ }
6692
+ return response.data.data;
6693
+ } catch (error) {
6694
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching form";
6695
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6696
+ throw { message, status };
6697
+ }
6698
+ }
6699
+ async function createOrUpdateForm({
6700
+ data
6701
+ }) {
6702
+ var _a, _b, _c;
6703
+ try {
6704
+ if (!data) {
6705
+ throw { message: "Form data is required", status: 400 };
6706
+ }
6707
+ const response = await apiClient.post("/api/v1/form/create-or-update-form", {
6708
+ data
6709
+ });
6710
+ if (!response.data || !response.data.data) {
6711
+ throw { message: "Failed to create or update form", status: 500 };
6712
+ }
6713
+ return response.data.data;
6714
+ } catch (error) {
6715
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while creating or updating form";
6716
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6717
+ throw { message, status };
6718
+ }
6719
+ }
6720
+ const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6664
6721
  __proto__: null,
6722
+ createOrUpdateForm,
6723
+ getFormById,
6665
6724
  getFormData,
6666
6725
  getFormSchema
6667
6726
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6702,29 +6761,111 @@ async function createAuditLog(params) {
6702
6761
  throw { message, status };
6703
6762
  }
6704
6763
  }
6705
- const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6764
+ const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6706
6765
  __proto__: null,
6707
6766
  createAuditLog,
6708
6767
  getAuditLogs
6709
6768
  }, Symbol.toStringTag, { value: "Module" }));
6769
+ async function getAllTemplatedPipelines() {
6770
+ var _a, _b, _c;
6771
+ try {
6772
+ const response = await apiClient.get("/api/v1/templated-pipeline/get-all");
6773
+ if (!response.data || !response.data.data) {
6774
+ throw { message: "Failed to fetch templated pipelines", status: 500 };
6775
+ }
6776
+ return response.data.data;
6777
+ } catch (error) {
6778
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching templated pipelines";
6779
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6780
+ throw { message, status };
6781
+ }
6782
+ }
6783
+ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6784
+ __proto__: null,
6785
+ getAllTemplatedPipelines
6786
+ }, Symbol.toStringTag, { value: "Module" }));
6787
+ async function markTaskDone({
6788
+ taskId,
6789
+ data
6790
+ }) {
6791
+ var _a, _b, _c;
6792
+ try {
6793
+ if (!taskId) {
6794
+ throw { message: "Task ID is required", status: 400 };
6795
+ }
6796
+ if (!data) {
6797
+ throw { message: "Task completion data is required", status: 400 };
6798
+ }
6799
+ const response = await apiClient.post("/api/v1/process/mark-task-done", {
6800
+ taskId,
6801
+ data
6802
+ });
6803
+ if (!response.data || !response.data.data) {
6804
+ throw { message: "Failed to mark task as done", status: 500 };
6805
+ }
6806
+ return response.data.data;
6807
+ } catch (error) {
6808
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while marking task as done";
6809
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6810
+ throw { message, status };
6811
+ }
6812
+ }
6813
+ async function reassignTask({
6814
+ taskId,
6815
+ newAssignee,
6816
+ assigneeType
6817
+ }) {
6818
+ var _a, _b, _c;
6819
+ try {
6820
+ if (!taskId) {
6821
+ throw { message: "Task ID is required", status: 400 };
6822
+ }
6823
+ if (!newAssignee) {
6824
+ throw { message: "New assignee is required", status: 400 };
6825
+ }
6826
+ if (!assigneeType || !["USER", "TEAM"].includes(assigneeType)) {
6827
+ throw { message: "Assignee type must be USER or TEAM", status: 400 };
6828
+ }
6829
+ const response = await apiClient.post("/api/v1/process/reassign-task", {
6830
+ taskId,
6831
+ newAssignee,
6832
+ assigneeType
6833
+ });
6834
+ if (!response.data || !response.data.data) {
6835
+ throw { message: "Failed to reassign task", status: 500 };
6836
+ }
6837
+ return response.data.data;
6838
+ } catch (error) {
6839
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while reassigning task";
6840
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6841
+ throw { message, status };
6842
+ }
6843
+ }
6844
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6845
+ __proto__: null,
6846
+ markTaskDone,
6847
+ reassignTask
6848
+ }, Symbol.toStringTag, { value: "Module" }));
6710
6849
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6711
6850
  __proto__: null,
6712
6851
  apiClient,
6713
- audit: index$1,
6714
- chat: index$9,
6715
- dataset: index$8,
6716
- definition: index$d,
6717
- files: index$e,
6718
- form: index$2,
6719
- inputTable: index$7,
6720
- metric: index$a,
6721
- recon: index$3,
6722
- statement: index$5,
6723
- task: index$4,
6724
- user: index$g,
6725
- workbook: index$6,
6726
- workflow: index$f,
6727
- worksheet: index$c
6852
+ audit: index$3,
6853
+ chat: index$b,
6854
+ dataset: index$a,
6855
+ definition: index$f,
6856
+ files: index$g,
6857
+ form: index$4,
6858
+ inputTable: index$9,
6859
+ metric: index$c,
6860
+ process: index$1,
6861
+ recon: index$5,
6862
+ statement: index$7,
6863
+ task: index$6,
6864
+ templatedPipeline: index$2,
6865
+ user: index$i,
6866
+ workbook: index$8,
6867
+ workflow: index$h,
6868
+ worksheet: index$e
6728
6869
  }, Symbol.toStringTag, { value: "Module" }));
6729
6870
  const bluecopaTailwindConfig = {
6730
6871
  darkMode: "class",
@@ -6888,6 +7029,6 @@ export {
6888
7029
  getConfig as copaGetConfig,
6889
7030
  setConfig as copaSetConfig,
6890
7031
  bluecopaTailwindConfig as copaTailwindConfig,
6891
- index$b as copaUtils
7032
+ index$d as copaUtils
6892
7033
  };
6893
7034
  //# sourceMappingURL=index.es.js.map