@bluecopa/core 0.1.15 → 0.1.17

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,27 @@
1
+ export interface AuditRecord {
2
+ source: "UI" | "BACKEND";
3
+ userId: string;
4
+ entityId: string;
5
+ entityType: string;
6
+ entitySubType?: string;
7
+ action: "CREATE" | "UPDATE" | "DELETE";
8
+ oldValue?: string;
9
+ newValue?: string;
10
+ additionalDetails?: any;
11
+ eventType: "WORKFLOW" | "API" | "PROCESS" | "DELEGATED_TASK";
12
+ eventId: string;
13
+ eventTimestamp: string;
14
+ }
15
+ export interface CreateAuditLogRequest {
16
+ auditRecords: AuditRecord[];
17
+ }
18
+ /**
19
+ * Creates audit log records
20
+ * @param params - The create audit log request parameters
21
+ * @param params.auditRecords - Required: Array of audit records to create
22
+ * @returns Promise<void> Success response
23
+ * @throws Error if the request fails
24
+ */
25
+ export declare function createAuditLog(params: CreateAuditLogRequest): Promise<{
26
+ success: boolean;
27
+ }>;
@@ -0,0 +1,32 @@
1
+ export interface GetAuditLogsRequest {
2
+ entityType?: string;
3
+ entitySubType?: string;
4
+ entityId?: string;
5
+ source?: 'UI' | 'BACKEND';
6
+ userId?: string;
7
+ limit: number;
8
+ startDate?: string;
9
+ endDate?: string;
10
+ pageToken?: string;
11
+ }
12
+ export interface AuditLogResponse {
13
+ logs: any[];
14
+ count: number;
15
+ nextPageToken?: string;
16
+ }
17
+ /**
18
+ * Gets audit logs based on filter criteria
19
+ * @param params - The audit logs request parameters
20
+ * @param params.entityType - Optional: Entity type to filter by
21
+ * @param params.entitySubType - Optional: Entity sub type to filter by
22
+ * @param params.entityId - Optional: Entity ID to filter by
23
+ * @param params.source - Optional: Source filter (UI or BACKEND)
24
+ * @param params.userId - Optional: User ID to filter by
25
+ * @param params.limit - Required: Maximum number of logs to return
26
+ * @param params.startDate - Optional: Start date filter (YYYY-MM-DD)
27
+ * @param params.endDate - Optional: End date filter (YYYY-MM-DD)
28
+ * @param params.pageToken - Optional: Token for pagination
29
+ * @returns Promise<AuditLogResponse> The audit logs response
30
+ * @throws Error if the request fails
31
+ */
32
+ export declare function getAuditLogs(params: GetAuditLogsRequest): Promise<AuditLogResponse>;
@@ -0,0 +1,2 @@
1
+ export * from './getAuditLogs';
2
+ export * from './createAuditLog';
@@ -0,0 +1,11 @@
1
+ export interface FileDownloadRequest {
2
+ fileId: string;
3
+ }
4
+ /**
5
+ * Downloads a file from S3 using presigned URL
6
+ * @param params - The file download parameters
7
+ * @param params.fileId - Required: The S3 path/key of the file to download
8
+ * @returns Promise<any> The file data
9
+ * @throws Error if the request fails
10
+ */
11
+ export declare function fileDownload({ fileId, }: FileDownloadRequest): Promise<any>;
@@ -0,0 +1,22 @@
1
+ export interface FileUploadRequest {
2
+ path?: string;
3
+ contentType?: string;
4
+ method?: string;
5
+ data: any;
6
+ uploadType?: string;
7
+ }
8
+ export interface FileUploadResponse {
9
+ fileId: string;
10
+ }
11
+ /**
12
+ * Uploads a file to S3 using presigned URL
13
+ * @param params - The file upload parameters
14
+ * @param params.path - Optional: The S3 path/key (defaults to auto-generated)
15
+ * @param params.contentType - Optional: Content type (defaults to 'application/json')
16
+ * @param params.method - Optional: HTTP method (defaults to 'PUT')
17
+ * @param params.data - Required: The data to upload
18
+ * @param params.uploadType - Optional: Upload type for path generation (defaults to 'DEFINITION')
19
+ * @returns Promise<FileUploadResponse> The file ID/path
20
+ * @throws Error if the request fails
21
+ */
22
+ export declare function fileUpload({ path, contentType, method, data, uploadType, }: FileUploadRequest): Promise<FileUploadResponse>;
@@ -1 +1,3 @@
1
1
  export * from './getFileUrlByFileId';
2
+ export * from './fileUpload';
3
+ export * from './fileDownload';
@@ -0,0 +1,11 @@
1
+ export interface GetFormDataRequest {
2
+ formId: string;
3
+ }
4
+ /**
5
+ * Gets form data by form ID
6
+ * @param params - The form data request parameters
7
+ * @param params.formId - Required: The ID of the form
8
+ * @returns Promise<any> The form data
9
+ * @throws Error if the request fails
10
+ */
11
+ export declare function getFormData({ formId, }: GetFormDataRequest): Promise<any>;
@@ -0,0 +1,13 @@
1
+ export interface GetFormSchemaRequest {
2
+ formInstanceId: string;
3
+ formRevision: string | number;
4
+ }
5
+ /**
6
+ * Gets form schema by form instance ID and revision
7
+ * @param params - The form schema request parameters
8
+ * @param params.formInstanceId - Required: The ID of the form instance
9
+ * @param params.formRevision - Required: The revision of the form
10
+ * @returns Promise<any> The form schema
11
+ * @throws Error if the request fails
12
+ */
13
+ export declare function getFormSchema({ formInstanceId, formRevision, }: GetFormSchemaRequest): Promise<any>;
@@ -0,0 +1,2 @@
1
+ export * from './getFormSchema';
2
+ export * from './getFormData';
@@ -10,3 +10,7 @@ export * as inputTable from './inputTable';
10
10
  export * as workbook from './workbook';
11
11
  export * as worksheet from './worksheet';
12
12
  export * as statement from './statement';
13
+ export * as task from './task';
14
+ export * as recon from './recon';
15
+ export * as form from './form';
16
+ export * as audit from './audit';
@@ -0,0 +1 @@
1
+ export * from './runRecon';
@@ -0,0 +1,20 @@
1
+ export interface RunReconRequest {
2
+ workflowId: string;
3
+ runId?: string;
4
+ fullRefresh?: boolean;
5
+ }
6
+ export interface RunReconResponse {
7
+ success: boolean;
8
+ data?: any;
9
+ message?: string;
10
+ }
11
+ /**
12
+ * Runs a reconciliation workflow
13
+ * @param params - The recon run parameters
14
+ * @param params.workflowId - Required: The ID of the reconciliation workflow
15
+ * @param params.runId - Optional: Custom run ID
16
+ * @param params.fullRefresh - Optional: Whether to do a full refresh
17
+ * @returns Promise<RunReconResponse> The run response
18
+ * @throws Error if the request fails
19
+ */
20
+ export declare function runRecon({ workflowId, runId, fullRefresh, }: RunReconRequest): Promise<RunReconResponse>;
@@ -0,0 +1,12 @@
1
+ import { ProcessTask } from '../../../../models/src/lib/gen/Api';
2
+ export interface GetTaskDetailsRequest {
3
+ taskId: string;
4
+ }
5
+ /**
6
+ * Gets task details by task ID
7
+ * @param params - The task request parameters
8
+ * @param params.taskId - Required: The ID of the task
9
+ * @returns Promise<ProcessTask> The task details
10
+ * @throws Error if the request fails
11
+ */
12
+ export declare function getTaskDetails({ taskId, }: GetTaskDetailsRequest): Promise<ProcessTask>;
@@ -0,0 +1 @@
1
+ export * from './getTaskDetails';
@@ -0,0 +1,12 @@
1
+ import { Workbook } from '../../../../models/src/lib/gen/Api';
2
+ export interface GetWorkbookDetailsRequest {
3
+ workbookId: string;
4
+ }
5
+ /**
6
+ * Gets workbook details by workbook ID
7
+ * @param params - The workbook request parameters
8
+ * @param params.workbookId - Required: The ID of the workbook
9
+ * @returns Promise<Workbook> The workbook details
10
+ * @throws Error if the request fails
11
+ */
12
+ export declare function getWorkbookDetails({ workbookId, }: GetWorkbookDetailsRequest): Promise<Workbook>;
@@ -1,2 +1,5 @@
1
1
  export * from './getWorkbooksByType';
2
2
  export * from './getPublishedWorkbookById';
3
+ export * from './getWorkbookDetails';
4
+ export * from './saveWorkbook';
5
+ export * from './publishWorkbook';
@@ -0,0 +1,12 @@
1
+ import { Workbook } from '../../../../models/src/lib/gen/Api';
2
+ export interface PublishWorkbookRequest {
3
+ workbookId: string;
4
+ }
5
+ /**
6
+ * Publishes a workbook
7
+ * @param params - The workbook publish parameters
8
+ * @param params.workbookId - Required: The ID of the workbook to publish
9
+ * @returns Promise<Workbook> The published workbook
10
+ * @throws Error if the request fails
11
+ */
12
+ export declare function publishWorkbook({ workbookId, }: PublishWorkbookRequest): Promise<Workbook>;
@@ -0,0 +1,14 @@
1
+ import { Workbook, WorksheetInputs } from '../../../../models/src/lib/gen/Api';
2
+ export interface SaveWorkbookRequest {
3
+ workbook: Workbook;
4
+ sheetInputs?: WorksheetInputs[];
5
+ }
6
+ /**
7
+ * Saves or updates a workbook
8
+ * @param params - The workbook save parameters
9
+ * @param params.workbook - Required: The workbook object to save
10
+ * @param params.sheetInputs - Optional: Array of worksheet inputs
11
+ * @returns Promise<Workbook> The saved workbook
12
+ * @throws Error if the request fails
13
+ */
14
+ export declare function saveWorkbook({ workbook, sheetInputs, }: SaveWorkbookRequest): Promise<Workbook>;
package/dist/index.d.ts CHANGED
@@ -2,3 +2,5 @@ export { setConfig as copaSetConfig, getConfig as copaGetConfig } from './config
2
2
  export * as copaApi from './api';
3
3
  export * as copaUtils from './utils';
4
4
  export { default as copaTailwindConfig } from './tailwind/bluecopa.config';
5
+ export type { GetAuditLogsRequest, AuditLogResponse } from './api/audit/getAuditLogs';
6
+ export type { AuditRecord, CreateAuditLogRequest } from './api/audit/createAuditLog';
package/dist/index.es.js CHANGED
@@ -42,7 +42,8 @@ function getConfig() {
42
42
  }
43
43
  const createApiClient = () => {
44
44
  const client = axios.create({
45
- timeout: 1e4,
45
+ timeout: 12e4,
46
+ // Increased to 120 seconds for audit log queries
46
47
  headers: {
47
48
  "Content-Type": "application/json"
48
49
  }
@@ -99,7 +100,7 @@ async function getLoggedInUserDetails() {
99
100
  throw { message, status };
100
101
  }
101
102
  }
102
- const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
103
+ const index$g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
103
104
  __proto__: null,
104
105
  getLoggedInUserDetails
105
106
  }, Symbol.toStringTag, { value: "Module" }));
@@ -158,7 +159,7 @@ const getWorkflowInstanceStatusById = async (request) => {
158
159
  throw { message, status };
159
160
  }
160
161
  };
161
- const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
162
+ const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
162
163
  __proto__: null,
163
164
  WorkflowStatus,
164
165
  getWorkflowInstanceStatusById,
@@ -183,8 +184,60 @@ async function getFileUrlByFileId({
183
184
  throw { message, status };
184
185
  }
185
186
  }
186
- const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
187
+ async function fileUpload({
188
+ path,
189
+ contentType,
190
+ method,
191
+ data,
192
+ uploadType
193
+ }) {
194
+ var _a, _b, _c;
195
+ try {
196
+ if (!data) {
197
+ throw { message: "Data is required", status: 400 };
198
+ }
199
+ const response = await apiClient.post("/api/v1/file/fileUpload", {
200
+ path,
201
+ contentType,
202
+ method,
203
+ data,
204
+ uploadType
205
+ });
206
+ if (!response.data) {
207
+ throw { message: "Failed to upload file", status: 500 };
208
+ }
209
+ return response.data;
210
+ } catch (error) {
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
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
213
+ throw { message, status };
214
+ }
215
+ }
216
+ async function fileDownload({
217
+ fileId
218
+ }) {
219
+ var _a, _b, _c;
220
+ try {
221
+ if (!fileId) {
222
+ throw { message: "File ID is required", status: 400 };
223
+ }
224
+ const response = await apiClient.get(
225
+ `/api/v1/file/fileDownload?fileId=${encodeURIComponent(fileId)}`
226
+ );
227
+ if (!response.data) {
228
+ throw { message: "Failed to download file", status: 500 };
229
+ }
230
+ return response.data;
231
+ } catch (error) {
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
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
234
+ throw { message, status };
235
+ }
236
+ }
237
+ const index$e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
187
238
  __proto__: null,
239
+ fileDownload,
240
+ fileUpload,
188
241
  getFileUrlByFileId
189
242
  }, Symbol.toStringTag, { value: "Module" }));
190
243
  const runPublishedDefinition = async (props) => {
@@ -255,7 +308,7 @@ const runDefinition = async (props) => {
255
308
  };
256
309
  }
257
310
  };
258
- const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
311
+ const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
259
312
  __proto__: null,
260
313
  runDefinition,
261
314
  runPublishedDefinition,
@@ -293,7 +346,7 @@ const getWorksheetsByType = async (type) => {
293
346
  throw { message, status };
294
347
  }
295
348
  };
296
- const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
349
+ const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
297
350
  __proto__: null,
298
351
  getWorksheets,
299
352
  getWorksheetsByType
@@ -5435,7 +5488,7 @@ const getUniqueDuplicateName = (name, collectionToCheckIn, suffix = "Copy", conc
5435
5488
  }
5436
5489
  return newName.trim();
5437
5490
  };
5438
- const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5491
+ const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5439
5492
  __proto__: null,
5440
5493
  formatDate,
5441
5494
  generatePushID,
@@ -5600,7 +5653,7 @@ const getData$3 = async (metricSheetId, options) => {
5600
5653
  resultData = _.flatten(resultData);
5601
5654
  return { data: resultData };
5602
5655
  };
5603
- const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5656
+ const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5604
5657
  __proto__: null,
5605
5658
  getData: getData$3
5606
5659
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5751,7 +5804,7 @@ async function checkSubscriptionStatus(userId, threadId) {
5751
5804
  throw { message, status };
5752
5805
  }
5753
5806
  }
5754
- const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5807
+ const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5755
5808
  __proto__: null,
5756
5809
  checkSubscriptionStatus,
5757
5810
  createThread,
@@ -5955,7 +6008,7 @@ const getAllDatasets = async () => {
5955
6008
  throw { message, status };
5956
6009
  }
5957
6010
  };
5958
- const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6011
+ const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5959
6012
  __proto__: null,
5960
6013
  getAllDatasets,
5961
6014
  getData: getData$2,
@@ -6142,7 +6195,7 @@ const getInputTables = async () => {
6142
6195
  throw { message, status };
6143
6196
  }
6144
6197
  };
6145
- const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6198
+ const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6146
6199
  __proto__: null,
6147
6200
  getData: getData$1,
6148
6201
  getInputTables,
@@ -6164,10 +6217,79 @@ const getWorkbooksByType = async (type) => {
6164
6217
  throw { message, status };
6165
6218
  }
6166
6219
  };
6167
- const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6220
+ async function getWorkbookDetails({
6221
+ workbookId
6222
+ }) {
6223
+ var _a, _b, _c;
6224
+ try {
6225
+ if (!workbookId) {
6226
+ throw { message: "Workbook ID is required", status: 400 };
6227
+ }
6228
+ console.log("workbookId", workbookId);
6229
+ const response = await apiClient.get(
6230
+ `/api/v1/workbook/get-workbook-details?workbookId=${encodeURIComponent(workbookId)}`
6231
+ );
6232
+ if (!response.data) {
6233
+ throw { message: "Failed to fetch workbook details", status: 500 };
6234
+ }
6235
+ return response.data;
6236
+ } catch (error) {
6237
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching workbook details";
6238
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6239
+ throw { message, status };
6240
+ }
6241
+ }
6242
+ async function saveWorkbook({
6243
+ workbook,
6244
+ sheetInputs = []
6245
+ }) {
6246
+ var _a, _b, _c;
6247
+ try {
6248
+ if (!workbook || !workbook.id) {
6249
+ throw { message: "Workbook with ID is required", status: 400 };
6250
+ }
6251
+ const response = await apiClient.put("/api/v1/workbook/save-workbook", {
6252
+ workbook,
6253
+ sheetInputs
6254
+ });
6255
+ if (!response.data) {
6256
+ throw { message: "Failed to save workbook", status: 500 };
6257
+ }
6258
+ return response.data;
6259
+ } catch (error) {
6260
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while saving workbook";
6261
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6262
+ throw { message, status };
6263
+ }
6264
+ }
6265
+ async function publishWorkbook({
6266
+ workbookId
6267
+ }) {
6268
+ var _a, _b, _c;
6269
+ try {
6270
+ if (!workbookId) {
6271
+ throw { message: "Workbook ID is required", status: 400 };
6272
+ }
6273
+ const response = await apiClient.post("/api/v1/workbook/publish-workbook", {
6274
+ workbookId
6275
+ });
6276
+ if (!response.data) {
6277
+ throw { message: "Failed to publish workbook", status: 500 };
6278
+ }
6279
+ return response.data;
6280
+ } catch (error) {
6281
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while publishing workbook";
6282
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6283
+ throw { message, status };
6284
+ }
6285
+ }
6286
+ const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6168
6287
  __proto__: null,
6169
6288
  getPublishedWorkbookById,
6170
- getWorkbooksByType
6289
+ getWorkbookDetails,
6290
+ getWorkbooksByType,
6291
+ publishWorkbook,
6292
+ saveWorkbook
6171
6293
  }, Symbol.toStringTag, { value: "Module" }));
6172
6294
  const getViewsBySheetId = async (sheetId) => {
6173
6295
  var _a, _b, _c;
@@ -6429,7 +6551,7 @@ const getRunResultById = async (runId) => {
6429
6551
  throw { message, status };
6430
6552
  }
6431
6553
  };
6432
- const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6554
+ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6433
6555
  __proto__: null,
6434
6556
  createNewRun,
6435
6557
  getData,
@@ -6438,20 +6560,171 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
6438
6560
  getViewById,
6439
6561
  getViewsBySheetId
6440
6562
  }, Symbol.toStringTag, { value: "Module" }));
6563
+ async function getTaskDetails({
6564
+ taskId
6565
+ }) {
6566
+ var _a, _b, _c;
6567
+ try {
6568
+ if (!taskId) {
6569
+ throw { message: "Task ID is required", status: 400 };
6570
+ }
6571
+ const response = await apiClient.get(
6572
+ `/api/v1/task/get-task-details?taskId=${encodeURIComponent(taskId)}`
6573
+ );
6574
+ if (!response.data) {
6575
+ throw { message: "Failed to fetch task details", status: 500 };
6576
+ }
6577
+ return response.data;
6578
+ } catch (error) {
6579
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching task details";
6580
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6581
+ throw { message, status };
6582
+ }
6583
+ }
6584
+ const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6585
+ __proto__: null,
6586
+ getTaskDetails
6587
+ }, Symbol.toStringTag, { value: "Module" }));
6588
+ async function runRecon({
6589
+ workflowId,
6590
+ runId,
6591
+ fullRefresh = false
6592
+ }) {
6593
+ var _a, _b, _c;
6594
+ try {
6595
+ if (!workflowId) {
6596
+ throw { message: "Workflow ID is required", status: 400 };
6597
+ }
6598
+ const response = await apiClient.post("/api/v1/recon/run-recon", {
6599
+ workflowId,
6600
+ runId,
6601
+ fullRefresh
6602
+ });
6603
+ if (!response.data) {
6604
+ throw { message: "Failed to run recon workflow", status: 500 };
6605
+ }
6606
+ return {
6607
+ success: true,
6608
+ data: response.data
6609
+ };
6610
+ } catch (error) {
6611
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while running recon workflow";
6612
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6613
+ throw { message, status };
6614
+ }
6615
+ }
6616
+ const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6617
+ __proto__: null,
6618
+ runRecon
6619
+ }, Symbol.toStringTag, { value: "Module" }));
6620
+ async function getFormSchema({
6621
+ formInstanceId,
6622
+ formRevision
6623
+ }) {
6624
+ var _a, _b, _c;
6625
+ try {
6626
+ if (!formInstanceId || !formRevision) {
6627
+ throw { message: "Form instance ID and revision are required", status: 400 };
6628
+ }
6629
+ const response = await apiClient.get(
6630
+ `/api/v1/form/get-form-schema?formInstanceId=${encodeURIComponent(formInstanceId)}&formRevision=${encodeURIComponent(formRevision)}`
6631
+ );
6632
+ if (!response.data) {
6633
+ throw { message: "Failed to fetch form schema", status: 500 };
6634
+ }
6635
+ return response.data;
6636
+ } catch (error) {
6637
+ 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 schema";
6638
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6639
+ throw { message, status };
6640
+ }
6641
+ }
6642
+ async function getFormData({
6643
+ formId
6644
+ }) {
6645
+ var _a, _b, _c;
6646
+ try {
6647
+ if (!formId) {
6648
+ throw { message: "Form ID is required", status: 400 };
6649
+ }
6650
+ const response = await apiClient.get(
6651
+ `/api/v1/form/get-form-data?formId=${encodeURIComponent(formId)}`
6652
+ );
6653
+ if (!response.data) {
6654
+ throw { message: "Failed to fetch form data", status: 500 };
6655
+ }
6656
+ return response.data;
6657
+ } catch (error) {
6658
+ 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 data";
6659
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6660
+ throw { message, status };
6661
+ }
6662
+ }
6663
+ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6664
+ __proto__: null,
6665
+ getFormData,
6666
+ getFormSchema
6667
+ }, Symbol.toStringTag, { value: "Module" }));
6668
+ async function getAuditLogs(params) {
6669
+ var _a, _b, _c;
6670
+ try {
6671
+ if (!params.limit) {
6672
+ throw { message: "Limit is required", status: 400 };
6673
+ }
6674
+ const response = await apiClient.post(
6675
+ "/api/v1/audit/get-audit-logs",
6676
+ params
6677
+ );
6678
+ if (!response.data) {
6679
+ throw { message: "Failed to fetch audit logs", status: 500 };
6680
+ }
6681
+ return response.data.data;
6682
+ } catch (error) {
6683
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching audit logs";
6684
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6685
+ throw { message, status };
6686
+ }
6687
+ }
6688
+ async function createAuditLog(params) {
6689
+ var _a, _b, _c;
6690
+ try {
6691
+ if (!params.auditRecords || !Array.isArray(params.auditRecords) || params.auditRecords.length === 0) {
6692
+ throw { message: "Audit records array is required", status: 400 };
6693
+ }
6694
+ const response = await apiClient.post(
6695
+ "/api/v1/audit/create-audit-log",
6696
+ params.auditRecords
6697
+ );
6698
+ return { success: response.data.success || true };
6699
+ } catch (error) {
6700
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while creating audit log";
6701
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6702
+ throw { message, status };
6703
+ }
6704
+ }
6705
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6706
+ __proto__: null,
6707
+ createAuditLog,
6708
+ getAuditLogs
6709
+ }, Symbol.toStringTag, { value: "Module" }));
6441
6710
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6442
6711
  __proto__: null,
6443
6712
  apiClient,
6444
- chat: index$5,
6445
- dataset: index$4,
6446
- definition: index$9,
6447
- files: index$a,
6448
- inputTable: index$3,
6449
- metric: index$6,
6450
- statement: index$1,
6451
- user: index$c,
6452
- workbook: index$2,
6453
- workflow: index$b,
6454
- worksheet: index$8
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
6455
6728
  }, Symbol.toStringTag, { value: "Module" }));
6456
6729
  const bluecopaTailwindConfig = {
6457
6730
  darkMode: "class",
@@ -6615,6 +6888,6 @@ export {
6615
6888
  getConfig as copaGetConfig,
6616
6889
  setConfig as copaSetConfig,
6617
6890
  bluecopaTailwindConfig as copaTailwindConfig,
6618
- index$7 as copaUtils
6891
+ index$b as copaUtils
6619
6892
  };
6620
6893
  //# sourceMappingURL=index.es.js.map