@bluecopa/core 0.1.8 → 0.1.9

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,16 @@
1
+ export interface CheckSubscriptionStatusResponse {
2
+ success: boolean;
3
+ data: {
4
+ isSubscribed: boolean;
5
+ subscriptionDetails?: any;
6
+ };
7
+ message?: string;
8
+ }
9
+ /**
10
+ * Checks if a user is subscribed to a thread
11
+ * @param userId - The ID of the user
12
+ * @param threadId - The ID of the thread
13
+ * @returns Promise<CheckSubscriptionStatusResponse> The subscription status
14
+ * @throws Error if the request fails
15
+ */
16
+ export declare function checkSubscriptionStatus(userId: string, threadId: string): Promise<CheckSubscriptionStatusResponse>;
@@ -0,0 +1,16 @@
1
+ import { ChatThread } from '../../../../models/src/lib/gen/Api';
2
+ export interface CreateThreadRequest {
3
+ data: ChatThread;
4
+ }
5
+ export interface CreateThreadResponse {
6
+ success: boolean;
7
+ data: ChatThread;
8
+ message?: string;
9
+ }
10
+ /**
11
+ * Creates a new comment thread
12
+ * @param request - The thread creation request containing ChatThread data
13
+ * @returns Promise<CreateThreadResponse> The created thread details
14
+ * @throws Error if the request fails
15
+ */
16
+ export declare function createThread(request: CreateThreadRequest): Promise<CreateThreadResponse>;
@@ -0,0 +1,12 @@
1
+ export interface DeleteCommentResponse {
2
+ success: boolean;
3
+ data?: any;
4
+ message?: string;
5
+ }
6
+ /**
7
+ * Deletes a comment
8
+ * @param commentId - The ID of the comment to delete
9
+ * @returns Promise<DeleteCommentResponse> The deletion result
10
+ * @throws Error if the request fails
11
+ */
12
+ export declare function deleteComment(commentId: string): Promise<DeleteCommentResponse>;
@@ -0,0 +1,13 @@
1
+ import { ChatComment } from '../../../../models/src/lib/gen/Api';
2
+ export interface GetCommentsByThreadIdResponse {
3
+ success: boolean;
4
+ data: ChatComment[];
5
+ message?: string;
6
+ }
7
+ /**
8
+ * Gets all comments for a specific thread
9
+ * @param threadId - The ID of the thread to get comments for
10
+ * @returns Promise<GetCommentsByThreadIdResponse> The comments for the thread
11
+ * @throws Error if the request fails
12
+ */
13
+ export declare function getCommentsByThreadId(threadId: string): Promise<GetCommentsByThreadIdResponse>;
@@ -0,0 +1,8 @@
1
+ export { createThread, type CreateThreadRequest, type CreateThreadResponse } from './createThread';
2
+ export { getCommentsByThreadId, type GetCommentsByThreadIdResponse } from './getCommentsByThreadId';
3
+ export { postComment, type PostCommentRequest, type PostCommentResponse } from './postComment';
4
+ export { updateComment, type UpdateCommentRequest, type UpdateCommentResponse } from './updateComment';
5
+ export { deleteComment, type DeleteCommentResponse } from './deleteComment';
6
+ export { subscribeUser, type SubscribeUserRequest, type SubscribeUserResponse } from './subscribeUser';
7
+ export { unsubscribeUser, type UnsubscribeUserRequest, type UnsubscribeUserResponse } from './unsubscribeUser';
8
+ export { checkSubscriptionStatus, type CheckSubscriptionStatusResponse } from './checkSubscriptionStatus';
@@ -0,0 +1,16 @@
1
+ import { ChatComment } from '../../../../models/src/lib/gen/Api';
2
+ export interface PostCommentRequest {
3
+ data: ChatComment;
4
+ }
5
+ export interface PostCommentResponse {
6
+ success: boolean;
7
+ data: ChatComment;
8
+ message?: string;
9
+ }
10
+ /**
11
+ * Adds a new comment to an existing thread
12
+ * @param request - The comment creation request containing ChatComment data
13
+ * @returns Promise<PostCommentResponse> The created comment details
14
+ * @throws Error if the request fails
15
+ */
16
+ export declare function postComment(request: PostCommentRequest): Promise<PostCommentResponse>;
@@ -0,0 +1,18 @@
1
+ export interface SubscribeUserRequest {
2
+ params: {
3
+ userId: string;
4
+ threadId: string;
5
+ };
6
+ }
7
+ export interface SubscribeUserResponse {
8
+ success: boolean;
9
+ data?: any;
10
+ message?: string;
11
+ }
12
+ /**
13
+ * Subscribes a user to a thread
14
+ * @param request - The subscription request containing userId and threadId
15
+ * @returns Promise<SubscribeUserResponse> The subscription result
16
+ * @throws Error if the request fails
17
+ */
18
+ export declare function subscribeUser(request: SubscribeUserRequest): Promise<SubscribeUserResponse>;
@@ -0,0 +1,18 @@
1
+ export interface UnsubscribeUserRequest {
2
+ params: {
3
+ userId: string;
4
+ threadId: string;
5
+ };
6
+ }
7
+ export interface UnsubscribeUserResponse {
8
+ success: boolean;
9
+ data?: any;
10
+ message?: string;
11
+ }
12
+ /**
13
+ * Unsubscribes a user from a thread
14
+ * @param request - The unsubscription request containing userId and threadId
15
+ * @returns Promise<UnsubscribeUserResponse> The unsubscription result
16
+ * @throws Error if the request fails
17
+ */
18
+ export declare function unsubscribeUser(request: UnsubscribeUserRequest): Promise<UnsubscribeUserResponse>;
@@ -0,0 +1,17 @@
1
+ import { ChatComment } from '../../../../models/src/lib/gen/Api';
2
+ export interface UpdateCommentRequest {
3
+ data: ChatComment;
4
+ commentId: string;
5
+ }
6
+ export interface UpdateCommentResponse {
7
+ success: boolean;
8
+ data: ChatComment;
9
+ message?: string;
10
+ }
11
+ /**
12
+ * Updates an existing comment
13
+ * @param request - The comment update request containing ChatComment data and commentId
14
+ * @returns Promise<UpdateCommentResponse> The updated comment details
15
+ * @throws Error if the request fails
16
+ */
17
+ export declare function updateComment(request: UpdateCommentRequest): Promise<UpdateCommentResponse>;
@@ -4,6 +4,7 @@ export * as workflow from './workflow';
4
4
  export * as files from './file';
5
5
  export * as definition from './definition';
6
6
  export * as metric from './metric';
7
+ export * as chat from './chat';
7
8
  export * as dataset from './dataset';
8
9
  export * as inputTable from './inputTable';
9
10
  export * as workbook from './workbook';
package/dist/index.es.js CHANGED
@@ -99,7 +99,7 @@ async function getLoggedInUserDetails() {
99
99
  throw { message, status };
100
100
  }
101
101
  }
102
- const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
102
+ const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
103
103
  __proto__: null,
104
104
  getLoggedInUserDetails
105
105
  }, Symbol.toStringTag, { value: "Module" }));
@@ -158,7 +158,7 @@ const getWorkflowInstanceStatusById = async (request) => {
158
158
  throw { message, status };
159
159
  }
160
160
  };
161
- const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
161
+ const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
162
162
  __proto__: null,
163
163
  WorkflowStatus,
164
164
  getWorkflowInstanceStatusById,
@@ -183,7 +183,7 @@ async function getFileUrlByFileId({
183
183
  throw { message, status };
184
184
  }
185
185
  }
186
- const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
186
+ const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
187
187
  __proto__: null,
188
188
  getFileUrlByFileId
189
189
  }, Symbol.toStringTag, { value: "Module" }));
@@ -236,7 +236,7 @@ const runDefinition = async (props) => {
236
236
  { cancelToken: source == null ? void 0 : source.token }
237
237
  );
238
238
  };
239
- const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
239
+ const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
240
240
  __proto__: null,
241
241
  runDefinition,
242
242
  runPublishedDefinition,
@@ -274,7 +274,7 @@ const getWorksheetsByType = async (type) => {
274
274
  throw { message, status };
275
275
  }
276
276
  };
277
- const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
277
+ const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
278
278
  __proto__: null,
279
279
  getWorksheets,
280
280
  getWorksheetsByType
@@ -4922,7 +4922,7 @@ const websocketProviderFactory = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
4922
4922
  __proto__: null,
4923
4923
  WebsocketContextFactory
4924
4924
  }, Symbol.toStringTag, { value: "Module" }));
4925
- const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4925
+ const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4926
4926
  __proto__: null,
4927
4927
  formatDate,
4928
4928
  getMetricDefinition,
@@ -5109,10 +5109,168 @@ const getData$2 = async (metricSheetId, options) => {
5109
5109
  resultData = _.flatten(resultData);
5110
5110
  return { data: resultData };
5111
5111
  };
5112
- const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5112
+ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5113
5113
  __proto__: null,
5114
5114
  getData: getData$2
5115
5115
  }, Symbol.toStringTag, { value: "Module" }));
5116
+ async function createThread(request) {
5117
+ var _a, _b, _c;
5118
+ try {
5119
+ const response = await apiClient.post("/chat/create-thread", request);
5120
+ if (!response.data) {
5121
+ throw { message: "Failed to create thread", status: 500 };
5122
+ }
5123
+ return {
5124
+ success: true,
5125
+ data: response.data
5126
+ };
5127
+ } catch (error) {
5128
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while creating thread";
5129
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5130
+ throw { message, status };
5131
+ }
5132
+ }
5133
+ async function getCommentsByThreadId(threadId) {
5134
+ var _a, _b, _c;
5135
+ try {
5136
+ if (!threadId) {
5137
+ throw { message: "Thread ID is required", status: 400 };
5138
+ }
5139
+ const response = await apiClient.get(`/chat/get-comments-by-thread-id?threadId=${threadId}`);
5140
+ if (!response.data) {
5141
+ throw { message: "Failed to fetch comments", status: 500 };
5142
+ }
5143
+ return {
5144
+ success: true,
5145
+ data: response.data
5146
+ };
5147
+ } catch (error) {
5148
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while fetching comments";
5149
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5150
+ throw { message, status };
5151
+ }
5152
+ }
5153
+ async function postComment(request) {
5154
+ var _a, _b, _c;
5155
+ try {
5156
+ const response = await apiClient.post("/chat/post-comment", request);
5157
+ if (!response.data) {
5158
+ throw { message: "Failed to post comment", status: 500 };
5159
+ }
5160
+ return {
5161
+ success: true,
5162
+ data: response.data
5163
+ };
5164
+ } catch (error) {
5165
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while posting comment";
5166
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5167
+ throw { message, status };
5168
+ }
5169
+ }
5170
+ async function updateComment(request) {
5171
+ var _a, _b, _c;
5172
+ try {
5173
+ if (!request.commentId) {
5174
+ throw { message: "Comment ID is required", status: 400 };
5175
+ }
5176
+ const response = await apiClient.put("/chat/update-comment", request);
5177
+ if (!response.data) {
5178
+ throw { message: "Failed to update comment", status: 500 };
5179
+ }
5180
+ return {
5181
+ success: true,
5182
+ data: response.data
5183
+ };
5184
+ } catch (error) {
5185
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while updating comment";
5186
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5187
+ throw { message, status };
5188
+ }
5189
+ }
5190
+ async function deleteComment(commentId) {
5191
+ var _a, _b, _c;
5192
+ try {
5193
+ if (!commentId) {
5194
+ throw { message: "Comment ID is required", status: 400 };
5195
+ }
5196
+ const response = await apiClient.delete(`/chat/delete-comment?commentId=${commentId}`);
5197
+ return {
5198
+ success: true,
5199
+ data: response.data
5200
+ };
5201
+ } catch (error) {
5202
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while deleting comment";
5203
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5204
+ throw { message, status };
5205
+ }
5206
+ }
5207
+ async function subscribeUser(request) {
5208
+ var _a, _b, _c;
5209
+ try {
5210
+ if (!request.params.userId || !request.params.threadId) {
5211
+ throw { message: "User ID and Thread ID are required", status: 400 };
5212
+ }
5213
+ const response = await apiClient.post("/chat/subscribe-user", request);
5214
+ return {
5215
+ success: true,
5216
+ data: response.data
5217
+ };
5218
+ } catch (error) {
5219
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while subscribing user";
5220
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5221
+ throw { message, status };
5222
+ }
5223
+ }
5224
+ async function unsubscribeUser(request) {
5225
+ var _a, _b, _c;
5226
+ try {
5227
+ if (!request.params.userId || !request.params.threadId) {
5228
+ throw { message: "User ID and Thread ID are required", status: 400 };
5229
+ }
5230
+ const response = await apiClient.post("/chat/unsubscribe-user", request);
5231
+ return {
5232
+ success: true,
5233
+ data: response.data
5234
+ };
5235
+ } catch (error) {
5236
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while unsubscribing user";
5237
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5238
+ throw { message, status };
5239
+ }
5240
+ }
5241
+ async function checkSubscriptionStatus(userId, threadId) {
5242
+ var _a, _b, _c;
5243
+ try {
5244
+ if (!userId || !threadId) {
5245
+ throw { message: "User ID and Thread ID are required", status: 400 };
5246
+ }
5247
+ const response = await apiClient.get(
5248
+ `/chat/check-user-subscription-status?userId=${userId}&threadId=${threadId}`
5249
+ );
5250
+ if (!response.data) {
5251
+ throw { message: "Failed to check subscription status", status: 500 };
5252
+ }
5253
+ return {
5254
+ success: true,
5255
+ data: response.data
5256
+ };
5257
+ } catch (error) {
5258
+ const message = ((_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || error.message || "An unexpected error occurred while checking subscription status";
5259
+ const status = ((_c = error.response) == null ? void 0 : _c.status) || 500;
5260
+ throw { message, status };
5261
+ }
5262
+ }
5263
+ const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5264
+ __proto__: null,
5265
+ checkSubscriptionStatus,
5266
+ createThread,
5267
+ deleteComment,
5268
+ getCommentsByThreadId,
5269
+ postComment,
5270
+ subscribeUser,
5271
+ unsubscribeUser,
5272
+ updateComment
5273
+ }, Symbol.toStringTag, { value: "Module" }));
5116
5274
  class DefinitionBuilder {
5117
5275
  constructor(def) {
5118
5276
  __publicField(this, "definition");
@@ -5523,15 +5681,16 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
5523
5681
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5524
5682
  __proto__: null,
5525
5683
  apiClient,
5684
+ chat: index$4,
5526
5685
  dataset: index$3,
5527
- definition: index$7,
5528
- files: index$8,
5686
+ definition: index$8,
5687
+ files: index$9,
5529
5688
  inputTable: index$2,
5530
- metric: index$4,
5531
- user: index$a,
5689
+ metric: index$5,
5690
+ user: index$b,
5532
5691
  workbook: index$1,
5533
- workflow: index$9,
5534
- worksheet: index$6
5692
+ workflow: index$a,
5693
+ worksheet: index$7
5535
5694
  }, Symbol.toStringTag, { value: "Module" }));
5536
5695
  const bluecopaTailwindConfig = {
5537
5696
  darkMode: "class",
@@ -5695,6 +5854,6 @@ export {
5695
5854
  getConfig as copaGetConfig,
5696
5855
  setConfig as copaSetConfig,
5697
5856
  bluecopaTailwindConfig as copaTailwindConfig,
5698
- index$5 as copaUtils
5857
+ index$6 as copaUtils
5699
5858
  };
5700
5859
  //# sourceMappingURL=index.es.js.map