@bluecopa/core 0.1.77 → 0.1.78

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.
package/README.md CHANGED
@@ -11,12 +11,27 @@ The core package provides essential API utilities and functions for data managem
11
11
  - [Requirements](#requirements)
12
12
  - [Configuration](#configuration)
13
13
  - [API Reference](#api-reference)
14
+ - [Audit Module](#audit-module)
15
+ - [Chat Module](#chat-module)
16
+ - [ClientIp Module](#clientip-module)
14
17
  - [Dataset Module](#dataset-module)
15
18
  - [Definition Module](#definition-module)
19
+ - [EmailEngine Module](#emailengine-module)
16
20
  - [File Module](#file-module)
21
+ - [Form Module](#form-module)
22
+ - [InboxItems Module](#inboxitems-module)
17
23
  - [InputTable Module](#inputtable-module)
18
24
  - [Metric Module](#metric-module)
25
+ - [Permissions Module](#permissions-module)
26
+ - [Process Module](#process-module)
27
+ - [Recon Module](#recon-module)
28
+ - [Statement Module](#statement-module)
29
+ - [Task Module](#task-module)
30
+ - [TemplatedPipeline Module](#templatedpipeline-module)
31
+ - [Templates Module](#templates-module)
32
+ - [Tcn Module](#tcn-module)
19
33
  - [User Module](#user-module)
34
+ - [Webcron Module](#webcron-module)
20
35
  - [Workbook Module](#workbook-module)
21
36
  - [Workflow Module](#workflow-module)
22
37
  - [Worksheet Module](#worksheet-module)
@@ -120,13 +135,39 @@ export interface Config {
120
135
 
121
136
  All API functions are asynchronous and use the shared `apiClient` for HTTP requests. They handle errors by throwing objects with `message` and `status`. Access via `copaApi.moduleName.functionName()`.
122
137
 
138
+ ### Audit Module
139
+
140
+ - `copaApi.audit.createAuditLog()`: Records an audit log entry
141
+ - `copaApi.audit.getAuditLogs()`: Retrieves audit log entries
142
+
143
+ See: [`audit/createAuditLog.ts`](src/api/audit/createAuditLog.ts), [`audit/getAuditLogs.ts`](src/api/audit/getAuditLogs.ts)
144
+
145
+ ### Chat Module
146
+
147
+ - `copaApi.chat.checkSubscriptionStatus()`: Checks whether the user is subscribed to chat updates
148
+ - `copaApi.chat.createThread()`: Creates a new chat thread
149
+ - `copaApi.chat.getCommentsByThreadId()`: Lists comments in a thread
150
+ - `copaApi.chat.postComment()`: Posts a comment to a thread
151
+ - `copaApi.chat.updateComment()`: Updates an existing comment
152
+ - `copaApi.chat.deleteComment()`: Deletes a comment
153
+ - `copaApi.chat.subscribeUser()`: Subscribes a user to chat updates
154
+ - `copaApi.chat.unsubscribeUser()`: Unsubscribes a user from chat updates
155
+
156
+ See: [`chat/`](src/api/chat:1)
157
+
158
+ ### ClientIp Module
159
+
160
+ - `copaApi.clientIp.getClientIp()`: Returns the caller's client IP
161
+
162
+ See: [`clientIp/getClientIp.ts`](src/api/clientIp/getClientIp.ts)
163
+
123
164
  ### Dataset Module
124
165
 
125
166
  - `copaApi.dataset.getData()`: Retrieves specific dataset data by ID or parameters
126
167
  - `copaApi.dataset.getDatasets()`: Fetches a list of datasets
127
168
  - `copaApi.dataset.getSampleData()`: Gets sample data for datasets
128
169
 
129
- See: [`dataset/getData.ts`](src/api/dataset/getData.ts:1), [`dataset/getSampleData.ts`](src/api/dataset/getSampleData.ts:1), [`dataset/getDatasets.ts`](src/api/dataset/getDatasets.ts:1)
170
+ See: [`dataset/getData.ts`](src/api/dataset/getData.ts), [`dataset/getSampleData.ts`](src/api/dataset/getSampleData.ts), [`dataset/getDatasets.ts`](src/api/dataset/getDatasets.ts)
130
171
 
131
172
  ### Definition Module
132
173
 
@@ -134,55 +175,193 @@ See: [`dataset/getData.ts`](src/api/dataset/getData.ts:1), [`dataset/getSampleDa
134
175
  - `copaApi.definition.runPublishedDefinition()`: Runs a published definition
135
176
  - `copaApi.definition.runSampleDefinition()`: Executes a sample definition for testing
136
177
 
137
- See: [`definition/runPublishedDefinition.ts`](src/api/definition/runPublishedDefinition.ts:1), [`definition/runSampleDefinition.ts`](src/api/definition/runSampleDefinition.ts:1), [`definition/runDefinition.ts`](src/api/definition/runDefinition.ts:1)
178
+ See: [`definition/runPublishedDefinition.ts`](src/api/definition/runPublishedDefinition.ts), [`definition/runSampleDefinition.ts`](src/api/definition/runSampleDefinition.ts), [`definition/runDefinition.ts`](src/api/definition/runDefinition.ts)
179
+
180
+ ### EmailEngine Module
181
+
182
+ - `copaApi.emailEngine.getAllConversations()`: Lists email conversations (paginated)
183
+ - `copaApi.emailEngine.getConversation()`: Fetches a single conversation
184
+ - `copaApi.emailEngine.createConversation()`: Creates a new conversation
185
+ - `copaApi.emailEngine.replyToConversation()`: Sends a reply on a conversation
186
+ - `copaApi.emailEngine.getMessageBySenderId()`: Retrieves messages filtered by sender id
187
+
188
+ See: [`emailEngine/`](src/api/emailEngine:1)
138
189
 
139
190
  ### File Module
140
191
 
141
192
  - `copaApi.files.getFileUrlByFileId(fileId: string)`: Generates a URL for a file by its ID
193
+ - `copaApi.files.fileUpload({ data, contentType, method, uploadType })`: Uploads data and returns a file id/path
194
+ - `copaApi.files.fileDownload({ fileId })`: Downloads a file by id
195
+ - `copaApi.files.getFileByFolderIdAndName({ folderId, name })`: Fetches a filebox file by its parent folder and name
196
+
197
+ See: [`file/getFileUrlByFileId.ts`](src/api/file/getFileUrlByFileId.ts), [`file/fileUpload.ts`](src/api/file/fileUpload.ts), [`file/fileDownload.ts`](src/api/file/fileDownload.ts), [`file/getFileByFolderIdAndName.ts`](src/api/file/getFileByFolderIdAndName.ts)
142
198
 
143
- See: [`file/getFileUrlByFileId.ts`](src/api/file/getFileUrlByFileId.ts:1)
199
+ ### Form Module
200
+
201
+ - `copaApi.form.getFormById()`: Fetches a form by id
202
+ - `copaApi.form.getFormSchema()`: Retrieves a form's schema
203
+ - `copaApi.form.getFormData()`: Retrieves submitted form data
204
+ - `copaApi.form.createOrUpdateForm()`: Creates or updates a form definition
205
+
206
+ See: [`form/`](src/api/form:1)
207
+
208
+ ### InboxItems Module
209
+
210
+ - `copaApi.inboxItems.getAllInboxItems()`: Lists inbox items
211
+ - `copaApi.inboxItems.createInboxItemPerUser()`: Creates an inbox item for a specific user
212
+ - `copaApi.inboxItems.markItemAsRead()`: Marks an inbox item as read
213
+ - `copaApi.inboxItems.markItemAsUnread()`: Marks an inbox item as unread
214
+
215
+ See: [`inboxItems/`](src/api/inboxItems:1)
144
216
 
145
217
  ### InputTable Module
146
218
 
147
219
  - `copaApi.inputTable.getData()`: Retrieves data from an input table
148
220
  - `copaApi.inputTable.getInputTables()`: Fetches all input tables
149
221
  - `copaApi.inputTable.getTableById(id: string)`: Gets a specific input table by ID
222
+ - `copaApi.inputTable.getRows(options)`: Reads rows from an input table view (filters, paging, sorting)
223
+ - `copaApi.inputTable.insertRow(options)`: Inserts a new row
224
+ - `copaApi.inputTable.updateRow(options)`: Updates an existing row
225
+ - `copaApi.inputTable.deleteRow(options)`: Deletes a row
150
226
 
151
- See: [`inputTable/getData.ts`](src/api/inputTable/getData.ts:1), [`inputTable/getInputTables.ts`](src/api/inputTable/getInputTables.ts:1), [`inputTable/getTableById.ts`](src/api/inputTable/getTableById.ts:1)
227
+ See: [`inputTable/getData.ts`](src/api/inputTable/getData.ts), [`inputTable/getInputTables.ts`](src/api/inputTable/getInputTables.ts), [`inputTable/getTableById.ts`](src/api/inputTable/getTableById.ts), [`inputTable/getRows.ts`](src/api/inputTable/getRows.ts), [`inputTable/insertRow.ts`](src/api/inputTable/insertRow.ts), [`inputTable/updateRow.ts`](src/api/inputTable/updateRow.ts), [`inputTable/deleteRow.ts`](src/api/inputTable/deleteRow.ts)
152
228
 
153
229
  ### Metric Module
154
230
 
155
231
  - `copaApi.metric.getData()`: Fetches metric data
156
232
 
157
- See: [`metric/getData.ts`](src/api/metric/getData.ts:1)
233
+ See: [`metric/getData.ts`](src/api/metric/getData.ts)
234
+
235
+ ### Permissions Module
236
+
237
+ - `copaApi.permissions.getPermissions()`: Retrieves permissions for the current user / context
238
+
239
+ See: [`permissions/getPermissions.ts`](src/api/permissions/getPermissions.ts)
240
+
241
+ ### Process Module
242
+
243
+ - `copaApi.process.markTaskDone()`: Marks a process task as done
244
+ - `copaApi.process.reassignTask()`: Reassigns a process task to a different user
245
+ - `copaApi.process.getTriggersBySheet()`: Lists triggers associated with a sheet
246
+ - `copaApi.process.registerProcessTrigger()`: Registers a new process trigger
247
+ - `copaApi.process.deleteProcessTrigger()`: Deletes a process trigger
248
+
249
+ See: [`process/`](src/api/process:1)
250
+
251
+ ### Recon Module
252
+
253
+ - `copaApi.recon.runRecon()`: Triggers a recon workflow run
254
+ - `copaApi.recon.getAllReconWorkflows()`: Lists all recon workflows
255
+
256
+ See: [`recon/runRecon.ts`](src/api/recon/runRecon.ts), [`recon/getAllReconWorkflows.ts`](src/api/recon/getAllReconWorkflows.ts)
257
+
258
+ ### Statement Module
259
+
260
+ - `copaApi.statement.getData()`: Retrieves statement data
261
+ - `copaApi.statement.getViewsBySheetId()`: Lists statement views for a sheet
262
+ - `copaApi.statement.getViewById()`: Fetches a single statement view
263
+ - `copaApi.statement.getRunsByViewId()`: Lists runs for a given view
264
+ - `copaApi.statement.createNewRun()`: Creates a new statement run
265
+ - `copaApi.statement.getRunResultById()`: Fetches the result of a given run
266
+
267
+ See: [`statement/`](src/api/statement:1)
268
+
269
+ ### Task Module
270
+
271
+ - `copaApi.task.getTaskDetails()`: Fetches detailed information about a task
272
+
273
+ See: [`task/getTaskDetails.ts`](src/api/task/getTaskDetails.ts)
274
+
275
+ ### TemplatedPipeline Module
276
+
277
+ - `copaApi.templatedPipeline.getAllTemplatedPipelines()`: Lists all templated pipelines
278
+
279
+ See: [`templatedPipeline/getAllTemplatedPipelines.ts`](src/api/templatedPipeline/getAllTemplatedPipelines.ts)
280
+
281
+ ### Templates Module
282
+
283
+ - `copaApi.templates.renderTemplate()`: Renders a template with provided variables
284
+
285
+ See: [`templates/render.ts`](src/api/templates/render.ts)
286
+
287
+ ### Tcn Module
288
+
289
+ - `copaApi.tcn.getAuthUrl()`: Returns the TCN OAuth authorization URL
290
+ - `copaApi.tcn.exchangeCode()`: Exchanges an OAuth code for TCN tokens
291
+ - `copaApi.tcn.refreshToken()`: Refreshes a TCN access token
292
+ - `copaApi.tcn.getCurrentAgent()`: Fetches the currently signed-in TCN agent
293
+ - `copaApi.tcn.getAgentSkills()`: Lists skills available to the agent
294
+ - `copaApi.tcn.createSession()`: Creates a new TCN agent session
295
+ - `copaApi.tcn.keepAlive()`: Pings the TCN session to keep it alive
296
+ - `copaApi.tcn.agentGetStatus()`: Returns the current agent status
297
+ - `copaApi.tcn.agentSetReady()`: Marks the agent as ready
298
+ - `copaApi.tcn.agentPause()`: Pauses the agent
299
+ - `copaApi.tcn.agentDisconnect()`: Disconnects the agent
300
+ - `copaApi.tcn.agentGetConnectedParty()`: Returns the currently connected party for the agent
301
+ - `copaApi.tcn.agentPutCallOnHold()`: Puts the agent's current call on hold
302
+ - `copaApi.tcn.agentGetCallFromHold()`: Resumes the agent's held call
303
+ - `copaApi.tcn.getHuntGroupAgentSettings()`: Fetches hunt-group settings for the agent
304
+ - `copaApi.tcn.getCallData()`: Retrieves data for an active call
305
+ - `copaApi.tcn.dialManualPrepare()`: Prepares a manual dial
306
+ - `copaApi.tcn.manualDialStart()`: Starts a prepared manual dial
307
+ - `copaApi.tcn.processManualDial()`: Processes the result of a manual dial
308
+
309
+ See: [`tcn/`](src/api/tcn:1)
158
310
 
159
311
  ### User Module
160
312
 
161
313
  - `copaApi.user.getLoggedInUserDetails()`: Retrieves details of the currently logged-in user
314
+ - `copaApi.user.getAllUsers()`: Lists all users in the workspace
315
+
316
+ See: [`user/getLoggedInUserDetails.ts`](src/api/user/getLoggedInUserDetails.ts), [`user/getAllUsers.ts`](src/api/user/getAllUsers.ts)
317
+
318
+ ### Webcron Module
319
+
320
+ Webhook CRUD + execution helpers:
321
+ - `copaApi.webcron.listWebhooks()`, `getWebhook()`, `createWebhook()`, `updateWebhook()`, `deleteWebhook()`, `testWebhook()`, `getWebhookExecutions()`, `getWebhookSchedules()`, `createWebhookSchedule()`
322
+
323
+ Schedule controls:
324
+ - `copaApi.webcron.getSchedule()`, `updateSchedule()`, `deleteSchedule()`, `pauseSchedule()`, `resumeSchedule()`, `triggerSchedule()`
325
+
326
+ Execution history:
327
+ - `copaApi.webcron.listExecutions()`, `getExecution()`, `retryExecution()`
328
+
329
+ Task lifecycle:
330
+ - `copaApi.webcron.listTasks()`, `createTask()`, `getTask()`, `cancelTask()`, `retryTask()`, `progressTask()`, `signalTask()`
331
+
332
+ Inspection bins:
333
+ - `copaApi.webcron.listBins()`, `createBin()`, `getBin()`, `deleteBin()`, `getBinRequests()`, `clearBinRequests()`
334
+
335
+ Workflow trigger:
336
+ - `copaApi.webcron.triggerWorkflowById()`
162
337
 
163
- See: [`user/getLoggedInUserDetails.ts`](src/api/user/getLoggedInUserDetails.ts:1)
338
+ See: [`webcron/`](src/api/webcron:1)
164
339
 
165
340
  ### Workbook Module
166
341
 
167
342
  - `copaApi.workbook.getPublishedWorkbookById(id: string)`: Fetches a published workbook by ID
168
343
  - `copaApi.workbook.getWorkbooksByType(type: string)`: Retrieves workbooks filtered by type
344
+ - `copaApi.workbook.getWorkbookDetails()`: Retrieves workbook metadata/details
345
+ - `copaApi.workbook.saveWorkbook()`: Saves a workbook draft
346
+ - `copaApi.workbook.publishWorkbook()`: Publishes a workbook
169
347
 
170
- See: [`workbook/getPublishedWorkbookById.ts`](src/api/workbook/getPublishedWorkbookById.ts:1), [`workbook/getWorkbooksByType.ts`](src/api/workbook/getWorkbooksByType.ts:1)
348
+ See: [`workbook/getPublishedWorkbookById.ts`](src/api/workbook/getPublishedWorkbookById.ts), [`workbook/getWorkbooksByType.ts`](src/api/workbook/getWorkbooksByType.ts), [`workbook/getWorkbookDetails.ts`](src/api/workbook/getWorkbookDetails.ts), [`workbook/saveWorkbook.ts`](src/api/workbook/saveWorkbook.ts), [`workbook/publishWorkbook.ts`](src/api/workbook/publishWorkbook.ts)
171
349
 
172
350
  ### Workflow Module
173
351
 
174
352
  - `copaApi.workflow.getWorkflowInstanceStatusById(id: string)`: Checks the status of a workflow instance
175
353
  - `copaApi.workflow.triggerHttpWorkflowById(id: string)`: Triggers an HTTP-based workflow
176
354
  - `copaApi.workflow.triggerWorkflowById(id: string)`: Triggers a workflow by ID
355
+ - `copaApi.workflow.getAllHttpTriggers()`: Lists all HTTP triggers
177
356
 
178
- See: [`workflow/triggerHttpWorkflowById.ts`](src/api/workflow/triggerHttpWorkflowById.ts:1), [`workflow/triggerWorkflowById.ts`](src/api/workflow/triggerWorkflowById.ts:1), [`workflow/getWorkflowInstanceStatusById.ts`](src/api/workflow/getWorkflowInstanceStatusById.ts:1)
357
+ See: [`workflow/triggerHttpWorkflowById.ts`](src/api/workflow/triggerHttpWorkflowById.ts), [`workflow/triggerWorkflowById.ts`](src/api/workflow/triggerWorkflowById.ts), [`workflow/getWorkflowInstanceStatusById.ts`](src/api/workflow/getWorkflowInstanceStatusById.ts), [`workflow/getAllHttpTriggers.ts`](src/api/workflow/getAllHttpTriggers.ts)
179
358
 
180
359
  ### Worksheet Module
181
360
 
182
361
  - `copaApi.worksheet.getWorksheets()`: Fetches all worksheets
183
362
  - `copaApi.worksheet.getWorksheetsByType(type: string)`: Retrieves worksheets by type
184
363
 
185
- See: [`worksheet/getWorksheets.ts`](src/api/worksheet/getWorksheets.ts:1), [`worksheet/getWorksheetsByType.ts`](src/api/worksheet/getWorksheetsByType.ts:1)
364
+ See: [`worksheet/getWorksheets.ts`](src/api/worksheet/getWorksheets.ts), [`worksheet/getWorksheetsByType.ts`](src/api/worksheet/getWorksheetsByType.ts)
186
365
 
187
366
  ## InputTableDB — Reactive Database Client
188
367
 
@@ -0,0 +1,31 @@
1
+ export interface GetFileByFolderIdAndNameRequest {
2
+ folderId: string;
3
+ name: string;
4
+ }
5
+ export type FileboxFileType = "CSV" | "XLSX" | "ZIP" | "RAW" | "JSON" | "PDF" | "TXT" | "SWT1" | "MSG" | "OUT" | "PNG" | "JPG" | "JPEG" | "MT940" | "XLS" | "XLSB" | "GZ" | "DOCX";
6
+ export interface FileboxFile {
7
+ name: string;
8
+ type: FileboxFileType;
9
+ parentId: string;
10
+ status: "DRAFT" | "PUBLISHED";
11
+ blobFileId: string;
12
+ copaUploadDate?: string;
13
+ solutionId?: string;
14
+ solutionBranch?: string;
15
+ createdBy?: string;
16
+ createdDate?: string;
17
+ lastModifiedBy?: string;
18
+ lastModifiedDate?: string;
19
+ id?: string;
20
+ workspaceId?: string;
21
+ entityVersion?: number;
22
+ }
23
+ /**
24
+ * Gets a filebox file by its parent folder and name.
25
+ *
26
+ * @param params.folderId - The parent folder id
27
+ * @param params.name - The exact file name to look up
28
+ * @returns Promise<FileboxFile> The matching filebox file metadata
29
+ * @throws { message: string; status: number } if the request fails
30
+ */
31
+ export declare function getFileByFolderIdAndName({ folderId, name, }: GetFileByFolderIdAndNameRequest): Promise<FileboxFile>;
@@ -1,3 +1,4 @@
1
1
  export * from './getFileUrlByFileId';
2
2
  export * from './fileUpload';
3
3
  export * from './fileDownload';
4
+ export * from './getFileByFolderIdAndName';
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export type { DeleteProcessTriggerResponse, } from './api/process/deleteProcessT
21
21
  export type { FileUploadRequest, FileUploadResponse, } from './api/file/fileUpload';
22
22
  export type { FileDownloadRequest } from './api/file/fileDownload';
23
23
  export type { GetFileUrlRequest, GetFileUrlResponse, } from './api/file/getFileUrlByFileId';
24
+ export type { GetFileByFolderIdAndNameRequest, FileboxFile, FileboxFileType, } from './api/file/getFileByFolderIdAndName';
24
25
  export type { User } from './api/user/getAllUsers';
25
26
  export type { HttpTrigger } from './api/workflow/getAllHttpTriggers';
26
27
  export type { GetRowsOptions, GetRowsResponse } from './api/inputTable/getRows';
package/dist/index.es.js CHANGED
@@ -330,10 +330,37 @@ async function fileDownload({
330
330
  throw { message, status };
331
331
  }
332
332
  }
333
+ async function getFileByFolderIdAndName({
334
+ folderId,
335
+ name
336
+ }) {
337
+ var _a, _b, _c, _d;
338
+ const normalizedFolderId = folderId == null ? void 0 : folderId.trim();
339
+ const normalizedName = name == null ? void 0 : name.trim();
340
+ if (!normalizedFolderId || !normalizedName) {
341
+ throw { message: "folderId and name are required", status: 400 };
342
+ }
343
+ try {
344
+ const response = await apiClient.get(
345
+ `/filebox/${encodeURIComponent(normalizedFolderId)}`,
346
+ { params: { fileName: normalizedName } }
347
+ );
348
+ if (!response.data) {
349
+ throw { message: "Failed to get filebox file", status: 500 };
350
+ }
351
+ return response.data;
352
+ } catch (error) {
353
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while getting filebox file";
354
+ const status = ((_c = error.response) == null ? void 0 : _c.status) ?? error.status ?? 500;
355
+ const data = ((_d = error.response) == null ? void 0 : _d.data) ?? error.data;
356
+ throw data !== void 0 ? { message, status, data } : { message, status };
357
+ }
358
+ }
333
359
  const index$n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
334
360
  __proto__: null,
335
361
  fileDownload,
336
362
  fileUpload,
363
+ getFileByFolderIdAndName,
337
364
  getFileUrlByFileId
338
365
  }, Symbol.toStringTag, { value: "Module" }));
339
366
  const runPublishedDefinition = async (props) => {