@bluecopa/core 0.1.28 → 0.1.30

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.
@@ -1,9 +1,10 @@
1
1
  import { Form } from './getFormById';
2
2
  export interface CreateOrUpdateFormRequest {
3
3
  data: Form;
4
- }
5
- export interface CreateOrUpdateFormResponse {
6
- data: Form;
4
+ processSheetId: string;
5
+ formInstanceId: string;
6
+ isDummy: boolean;
7
+ status: "DRAFTED" | "PUBLISHED";
7
8
  }
8
9
  /**
9
10
  * Creates or updates a form
@@ -12,4 +13,4 @@ export interface CreateOrUpdateFormResponse {
12
13
  * @returns Promise<Form> The created or updated form
13
14
  * @throws Error if the request fails
14
15
  */
15
- export declare function createOrUpdateForm({ data, }: CreateOrUpdateFormRequest): Promise<Form>;
16
+ export declare function createOrUpdateForm({ data, processSheetId, formInstanceId, isDummy, status, }: CreateOrUpdateFormRequest): Promise<Form>;
@@ -0,0 +1,16 @@
1
+ export interface GetAllInboxItemsRequest {
2
+ page?: number;
3
+ perPage?: number;
4
+ }
5
+ export interface InboxItem {
6
+ [key: string]: any;
7
+ }
8
+ /**
9
+ * Gets all inbox items
10
+ * @param params - The inbox items request parameters
11
+ * @param params.page - Optional: Page number (default: 0)
12
+ * @param params.perPage - Optional: Items per page (default: 50)
13
+ * @returns Promise<InboxItem[]> Array of inbox items
14
+ * @throws Error if the request fails
15
+ */
16
+ export declare function getAllInboxItems({ page, perPage, }?: GetAllInboxItemsRequest): Promise<InboxItem[]>;
@@ -0,0 +1,6 @@
1
+ export { getAllInboxItems } from './getAllInboxItems';
2
+ export { markItemAsRead } from './markItemAsRead';
3
+ export { markItemAsUnread } from './markItemAsUnread';
4
+ export type { GetAllInboxItemsRequest, InboxItem } from './getAllInboxItems';
5
+ export type { MarkItemAsReadRequest } from './markItemAsRead';
6
+ export type { MarkItemAsUnreadRequest } from './markItemAsUnread';
@@ -0,0 +1,11 @@
1
+ export interface MarkItemAsReadRequest {
2
+ inboxItemIds: string[];
3
+ }
4
+ /**
5
+ * Marks inbox items as read
6
+ * @param params - The mark as read request parameters
7
+ * @param params.inboxItemIds - Required: Array of inbox item IDs to mark as read
8
+ * @returns Promise<void>
9
+ * @throws Error if the request fails
10
+ */
11
+ export declare function markItemAsRead({ inboxItemIds, }: MarkItemAsReadRequest): Promise<void>;
@@ -0,0 +1,11 @@
1
+ export interface MarkItemAsUnreadRequest {
2
+ inboxItemIds: string[];
3
+ }
4
+ /**
5
+ * Marks inbox items as unread
6
+ * @param params - The mark as unread request parameters
7
+ * @param params.inboxItemIds - Required: Array of inbox item IDs to mark as unread
8
+ * @returns Promise<void>
9
+ * @throws Error if the request fails
10
+ */
11
+ export declare function markItemAsUnread({ inboxItemIds, }: MarkItemAsUnreadRequest): Promise<void>;
@@ -16,3 +16,4 @@ export * as form from './form';
16
16
  export * as audit from './audit';
17
17
  export * as templatedPipeline from './templatedPipeline';
18
18
  export * as process from './process';
19
+ export * as inboxItems from './inboxItems';
package/dist/index.d.ts CHANGED
@@ -20,3 +20,6 @@ export type { User } from './api/user/getAllUsers';
20
20
  export type { HttpTrigger } from './api/workflow/getAllHttpTriggers';
21
21
  export type { GetRowsOptions, GetRowsResponse } from './api/inputTable/getRows';
22
22
  export type { UpdateRowOptions } from './api/inputTable/updateRow';
23
+ export type { GetAllInboxItemsRequest, InboxItem } from './api/inboxItems/getAllInboxItems';
24
+ export type { MarkItemAsReadRequest } from './api/inboxItems/markItemAsRead';
25
+ export type { MarkItemAsUnreadRequest } from './api/inboxItems/markItemAsUnread';
package/dist/index.es.js CHANGED
@@ -114,7 +114,7 @@ async function getAllUsers() {
114
114
  throw { message, status };
115
115
  }
116
116
  }
117
- const index$i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
117
+ const index$j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
118
118
  __proto__: null,
119
119
  getAllUsers,
120
120
  getLoggedInUserDetails
@@ -188,7 +188,7 @@ async function getAllHttpTriggers() {
188
188
  throw { message, status };
189
189
  }
190
190
  }
191
- const index$h = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
191
+ const index$i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
192
192
  __proto__: null,
193
193
  WorkflowStatus,
194
194
  getAllHttpTriggers,
@@ -290,7 +290,7 @@ async function fileDownload({
290
290
  throw { message, status };
291
291
  }
292
292
  }
293
- const index$g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
293
+ const index$h = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
294
294
  __proto__: null,
295
295
  fileDownload,
296
296
  fileUpload,
@@ -364,7 +364,7 @@ const runDefinition = async (props) => {
364
364
  };
365
365
  }
366
366
  };
367
- const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
367
+ const index$g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
368
368
  __proto__: null,
369
369
  runDefinition,
370
370
  runPublishedDefinition,
@@ -402,7 +402,7 @@ const getWorksheetsByType = async (type) => {
402
402
  throw { message, status };
403
403
  }
404
404
  };
405
- const index$e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
405
+ const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
406
406
  __proto__: null,
407
407
  getWorksheets,
408
408
  getWorksheetsByType
@@ -5544,7 +5544,7 @@ const getUniqueDuplicateName = (name, collectionToCheckIn, suffix = "Copy", conc
5544
5544
  }
5545
5545
  return newName.trim();
5546
5546
  };
5547
- const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5547
+ const index$e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5548
5548
  __proto__: null,
5549
5549
  formatDate,
5550
5550
  generatePushID,
@@ -5709,7 +5709,7 @@ const getData$3 = async (metricSheetId, options) => {
5709
5709
  resultData = _.flatten(resultData);
5710
5710
  return { data: resultData };
5711
5711
  };
5712
- const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5712
+ const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5713
5713
  __proto__: null,
5714
5714
  getData: getData$3
5715
5715
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5860,7 +5860,7 @@ async function checkSubscriptionStatus(userId, threadId) {
5860
5860
  throw { message, status };
5861
5861
  }
5862
5862
  }
5863
- const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5863
+ const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5864
5864
  __proto__: null,
5865
5865
  checkSubscriptionStatus,
5866
5866
  createThread,
@@ -6065,7 +6065,7 @@ const getAllDatasets = async () => {
6065
6065
  throw { message, status };
6066
6066
  }
6067
6067
  };
6068
- const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6068
+ const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6069
6069
  __proto__: null,
6070
6070
  getAllDatasets,
6071
6071
  getData: getData$2,
@@ -6384,7 +6384,7 @@ const deleteRow = async (tableId, rowId, idField = "_copa_id") => {
6384
6384
  throw { message, status };
6385
6385
  }
6386
6386
  };
6387
- const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6387
+ const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6388
6388
  __proto__: null,
6389
6389
  deleteRow,
6390
6390
  getData: getData$1,
@@ -6476,7 +6476,7 @@ async function publishWorkbook({
6476
6476
  throw { message, status };
6477
6477
  }
6478
6478
  }
6479
- const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6479
+ const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6480
6480
  __proto__: null,
6481
6481
  getPublishedWorkbookById,
6482
6482
  getWorkbookDetails,
@@ -6744,7 +6744,7 @@ const getRunResultById = async (runId) => {
6744
6744
  throw { message, status };
6745
6745
  }
6746
6746
  };
6747
- const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6747
+ const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6748
6748
  __proto__: null,
6749
6749
  createNewRun,
6750
6750
  getData,
@@ -6774,7 +6774,7 @@ async function getTaskDetails({
6774
6774
  throw { message, status };
6775
6775
  }
6776
6776
  }
6777
- const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6777
+ const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6778
6778
  __proto__: null,
6779
6779
  getTaskDetails
6780
6780
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6820,7 +6820,7 @@ async function getAllReconWorkflows() {
6820
6820
  throw { message, status };
6821
6821
  }
6822
6822
  }
6823
- const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6823
+ const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6824
6824
  __proto__: null,
6825
6825
  getAllReconWorkflows,
6826
6826
  runRecon
@@ -6890,7 +6890,11 @@ async function getFormById({
6890
6890
  }
6891
6891
  }
6892
6892
  async function createOrUpdateForm({
6893
- data
6893
+ data,
6894
+ processSheetId,
6895
+ formInstanceId,
6896
+ isDummy,
6897
+ status
6894
6898
  }) {
6895
6899
  var _a, _b, _c;
6896
6900
  try {
@@ -6898,19 +6902,23 @@ async function createOrUpdateForm({
6898
6902
  throw { message: "Form data is required", status: 400 };
6899
6903
  }
6900
6904
  const response = await apiClient.post("/form/create-or-update-form", {
6901
- data
6905
+ data,
6906
+ processSheetId,
6907
+ formInstanceId,
6908
+ isDummy,
6909
+ status
6902
6910
  });
6903
- if (!response.data || !response.data.data) {
6911
+ if (!response.data) {
6904
6912
  throw { message: "Failed to create or update form", status: 500 };
6905
6913
  }
6906
6914
  return response.data.data;
6907
6915
  } catch (error) {
6908
6916
  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";
6909
- const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6910
- throw { message, status };
6917
+ const status2 = ((_c = error.response) == null ? void 0 : _c.status) || 500;
6918
+ throw { message, status: status2 };
6911
6919
  }
6912
6920
  }
6913
- const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6921
+ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6914
6922
  __proto__: null,
6915
6923
  createOrUpdateForm,
6916
6924
  getFormById,
@@ -6954,7 +6962,7 @@ async function createAuditLog(params) {
6954
6962
  throw { message, status };
6955
6963
  }
6956
6964
  }
6957
- const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6965
+ const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6958
6966
  __proto__: null,
6959
6967
  createAuditLog,
6960
6968
  getAuditLogs
@@ -6973,7 +6981,7 @@ async function getAllTemplatedPipelines() {
6973
6981
  throw { message, status };
6974
6982
  }
6975
6983
  }
6976
- const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6984
+ const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6977
6985
  __proto__: null,
6978
6986
  getAllTemplatedPipelines
6979
6987
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7034,31 +7042,104 @@ async function reassignTask({
7034
7042
  throw { message, status };
7035
7043
  }
7036
7044
  }
7037
- const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7045
+ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7038
7046
  __proto__: null,
7039
7047
  markTaskDone,
7040
7048
  reassignTask
7041
7049
  }, Symbol.toStringTag, { value: "Module" }));
7050
+ async function getAllInboxItems({
7051
+ page,
7052
+ perPage
7053
+ } = {}) {
7054
+ var _a, _b, _c;
7055
+ try {
7056
+ const queryParams = new URLSearchParams();
7057
+ if (page !== void 0) {
7058
+ queryParams.append("page", page.toString());
7059
+ }
7060
+ if (perPage !== void 0) {
7061
+ queryParams.append("perPage", perPage.toString());
7062
+ }
7063
+ const queryString = queryParams.toString();
7064
+ const url = `/inbox-items/get-all-inbox-items${queryString ? `?${queryString}` : ""}`;
7065
+ const response = await apiClient.get(url);
7066
+ if (!response.data || !response.data.data) {
7067
+ throw { message: "Failed to fetch inbox items", status: 500 };
7068
+ }
7069
+ return response.data.data;
7070
+ } catch (error) {
7071
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching inbox items";
7072
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
7073
+ throw { message, status };
7074
+ }
7075
+ }
7076
+ async function markItemAsRead({
7077
+ inboxItemIds
7078
+ }) {
7079
+ var _a, _b, _c;
7080
+ try {
7081
+ if (!inboxItemIds || !Array.isArray(inboxItemIds) || inboxItemIds.length === 0) {
7082
+ throw { message: "inboxItemIds array is required", status: 400 };
7083
+ }
7084
+ const response = await apiClient.put("/inbox-items/mark-item-as-read", {
7085
+ inboxItemIds
7086
+ });
7087
+ if (response.status >= 400) {
7088
+ throw { message: "Failed to mark items as read", status: response.status };
7089
+ }
7090
+ } catch (error) {
7091
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while marking items as read";
7092
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
7093
+ throw { message, status };
7094
+ }
7095
+ }
7096
+ async function markItemAsUnread({
7097
+ inboxItemIds
7098
+ }) {
7099
+ var _a, _b, _c;
7100
+ try {
7101
+ if (!inboxItemIds || !Array.isArray(inboxItemIds) || inboxItemIds.length === 0) {
7102
+ throw { message: "inboxItemIds array is required", status: 400 };
7103
+ }
7104
+ const response = await apiClient.put("/inbox-items/mark-item-as-unread", {
7105
+ inboxItemIds
7106
+ });
7107
+ if (response.status >= 400) {
7108
+ throw { message: "Failed to mark items as unread", status: response.status };
7109
+ }
7110
+ } catch (error) {
7111
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while marking items as unread";
7112
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
7113
+ throw { message, status };
7114
+ }
7115
+ }
7116
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7117
+ __proto__: null,
7118
+ getAllInboxItems,
7119
+ markItemAsRead,
7120
+ markItemAsUnread
7121
+ }, Symbol.toStringTag, { value: "Module" }));
7042
7122
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7043
7123
  __proto__: null,
7044
7124
  apiClient,
7045
- audit: index$3,
7046
- chat: index$b,
7047
- dataset: index$a,
7048
- definition: index$f,
7049
- files: index$g,
7050
- form: index$4,
7051
- inputTable: index$9,
7052
- metric: index$c,
7053
- process: index$1,
7054
- recon: index$5,
7055
- statement: index$7,
7056
- task: index$6,
7057
- templatedPipeline: index$2,
7058
- user: index$i,
7059
- workbook: index$8,
7060
- workflow: index$h,
7061
- worksheet: index$e
7125
+ audit: index$4,
7126
+ chat: index$c,
7127
+ dataset: index$b,
7128
+ definition: index$g,
7129
+ files: index$h,
7130
+ form: index$5,
7131
+ inboxItems: index$1,
7132
+ inputTable: index$a,
7133
+ metric: index$d,
7134
+ process: index$2,
7135
+ recon: index$6,
7136
+ statement: index$8,
7137
+ task: index$7,
7138
+ templatedPipeline: index$3,
7139
+ user: index$j,
7140
+ workbook: index$9,
7141
+ workflow: index$i,
7142
+ worksheet: index$f
7062
7143
  }, Symbol.toStringTag, { value: "Module" }));
7063
7144
  const bluecopaTailwindConfig = {
7064
7145
  darkMode: "class",
@@ -7222,6 +7303,6 @@ export {
7222
7303
  getConfig as copaGetConfig,
7223
7304
  setConfig as copaSetConfig,
7224
7305
  bluecopaTailwindConfig as copaTailwindConfig,
7225
- index$d as copaUtils
7306
+ index$e as copaUtils
7226
7307
  };
7227
7308
  //# sourceMappingURL=index.es.js.map