geniebox-shared-lib 2.4.2 → 2.4.4

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.
@@ -20,6 +20,9 @@ export interface Agent {
20
20
  visibility: string;
21
21
  createdAt: string;
22
22
  updatedAt: string;
23
+ /** Optional denormalized fields for API Gateway to enrich responses */
24
+ userName?: string | undefined;
25
+ userAvatar?: string | undefined;
23
26
  }
24
27
  export interface CreateAgentRequest {
25
28
  userId: string;
@@ -50,6 +53,10 @@ export interface ListAgentsRequest {
50
53
  offset: number;
51
54
  /** Filter by visibility */
52
55
  visibility?: string | undefined;
56
+ /** frontend supports these high-level types: all | mine | shared | bookmarked */
57
+ type?: string | undefined;
58
+ /** comma-separated filters (e.g. types) */
59
+ filters?: string | undefined;
53
60
  }
54
61
  export interface DeleteAgentRequest {
55
62
  id: string;
@@ -47,6 +47,12 @@ exports.Agent = {
47
47
  if (message.updatedAt !== "") {
48
48
  writer.uint32(74).string(message.updatedAt);
49
49
  }
50
+ if (message.userName !== undefined) {
51
+ writer.uint32(82).string(message.userName);
52
+ }
53
+ if (message.userAvatar !== undefined) {
54
+ writer.uint32(90).string(message.userAvatar);
55
+ }
50
56
  return writer;
51
57
  },
52
58
  decode(input, length) {
@@ -119,6 +125,20 @@ exports.Agent = {
119
125
  message.updatedAt = reader.string();
120
126
  continue;
121
127
  }
128
+ case 10: {
129
+ if (tag !== 82) {
130
+ break;
131
+ }
132
+ message.userName = reader.string();
133
+ continue;
134
+ }
135
+ case 11: {
136
+ if (tag !== 90) {
137
+ break;
138
+ }
139
+ message.userAvatar = reader.string();
140
+ continue;
141
+ }
122
142
  }
123
143
  if ((tag & 7) === 4 || tag === 0) {
124
144
  break;
@@ -364,6 +384,12 @@ exports.ListAgentsRequest = {
364
384
  if (message.visibility !== undefined) {
365
385
  writer.uint32(34).string(message.visibility);
366
386
  }
387
+ if (message.type !== undefined) {
388
+ writer.uint32(42).string(message.type);
389
+ }
390
+ if (message.filters !== undefined) {
391
+ writer.uint32(50).string(message.filters);
392
+ }
367
393
  return writer;
368
394
  },
369
395
  decode(input, length) {
@@ -401,6 +427,20 @@ exports.ListAgentsRequest = {
401
427
  message.visibility = reader.string();
402
428
  continue;
403
429
  }
430
+ case 5: {
431
+ if (tag !== 42) {
432
+ break;
433
+ }
434
+ message.type = reader.string();
435
+ continue;
436
+ }
437
+ case 6: {
438
+ if (tag !== 50) {
439
+ break;
440
+ }
441
+ message.filters = reader.string();
442
+ continue;
443
+ }
404
444
  }
405
445
  if ((tag & 7) === 4 || tag === 0) {
406
446
  break;
@@ -0,0 +1,12 @@
1
+ import { OnModuleInit } from "@nestjs/common";
2
+ import { ClientGrpc } from "@nestjs/microservices";
3
+ import { ChatServiceClient } from "./chat.interface";
4
+ export declare class ChatClient implements OnModuleInit {
5
+ private readonly client;
6
+ private readonly logger;
7
+ private chatClient?;
8
+ constructor(client: ClientGrpc);
9
+ onModuleInit(): void;
10
+ get service(): ChatServiceClient;
11
+ isReady(): boolean;
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var ChatClient_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ChatClient = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ let ChatClient = ChatClient_1 = class ChatClient {
19
+ constructor(client) {
20
+ this.client = client;
21
+ this.logger = new common_1.Logger(ChatClient_1.name);
22
+ }
23
+ onModuleInit() {
24
+ this.chatClient =
25
+ this.client.getService("ChatService");
26
+ this.logger.log("ChatServiceClient initialized");
27
+ }
28
+ get service() {
29
+ if (!this.chatClient) {
30
+ throw new common_1.InternalServerErrorException("ChatService is not initialized yet");
31
+ }
32
+ return this.chatClient;
33
+ }
34
+ isReady() {
35
+ return !!this.chatClient;
36
+ }
37
+ };
38
+ exports.ChatClient = ChatClient;
39
+ exports.ChatClient = ChatClient = ChatClient_1 = __decorate([
40
+ (0, common_1.Injectable)(),
41
+ __param(0, (0, common_1.Inject)("CHAT_PACKAGE")),
42
+ __metadata("design:paramtypes", [Object])
43
+ ], ChatClient);
@@ -0,0 +1,173 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import type { handleUnaryCall, Metadata, UntypedServiceImplementation } from "@grpc/grpc-js";
3
+ import { Observable } from "rxjs";
4
+ import { Empty } from "./google/protobuf/empty.interface";
5
+ export declare const protobufPackage = "chat";
6
+ export interface Chat {
7
+ id: string;
8
+ title: string;
9
+ userId: string;
10
+ metadata?: {
11
+ [key: string]: any;
12
+ } | undefined;
13
+ createdAt: string;
14
+ updatedAt: string;
15
+ }
16
+ export interface ChatMessage {
17
+ id: string;
18
+ chatId: string;
19
+ /** user, assistant, system */
20
+ role: string;
21
+ content: string;
22
+ metadata?: {
23
+ [key: string]: any;
24
+ } | undefined;
25
+ createdAt: string;
26
+ }
27
+ /** Requests */
28
+ export interface CreateChatRequest {
29
+ userId: string;
30
+ title: string;
31
+ metadata?: {
32
+ [key: string]: any;
33
+ } | undefined;
34
+ }
35
+ export interface GetChatRequest {
36
+ id: string;
37
+ /** For authorization check */
38
+ userId: string;
39
+ }
40
+ export interface ListChatsRequest {
41
+ userId: string;
42
+ limit: number;
43
+ offset: number;
44
+ }
45
+ export interface DeleteChatRequest {
46
+ id: string;
47
+ /** For authorization check */
48
+ userId: string;
49
+ }
50
+ export interface AddMessageRequest {
51
+ chatId: string;
52
+ /** For authorization check */
53
+ userId: string;
54
+ role: string;
55
+ content: string;
56
+ metadata?: {
57
+ [key: string]: any;
58
+ } | undefined;
59
+ }
60
+ export interface GetMessagesRequest {
61
+ chatId: string;
62
+ /** For authorization check */
63
+ userId: string;
64
+ limit: number;
65
+ offset: number;
66
+ }
67
+ /** Responses */
68
+ export interface ChatsResponse {
69
+ chats: Chat[];
70
+ total: number;
71
+ }
72
+ export interface MessagesResponse {
73
+ messages: ChatMessage[];
74
+ total: number;
75
+ }
76
+ export declare const CHAT_PACKAGE_NAME = "chat";
77
+ export declare const Chat: MessageFns<Chat>;
78
+ export declare const ChatMessage: MessageFns<ChatMessage>;
79
+ export declare const CreateChatRequest: MessageFns<CreateChatRequest>;
80
+ export declare const GetChatRequest: MessageFns<GetChatRequest>;
81
+ export declare const ListChatsRequest: MessageFns<ListChatsRequest>;
82
+ export declare const DeleteChatRequest: MessageFns<DeleteChatRequest>;
83
+ export declare const AddMessageRequest: MessageFns<AddMessageRequest>;
84
+ export declare const GetMessagesRequest: MessageFns<GetMessagesRequest>;
85
+ export declare const ChatsResponse: MessageFns<ChatsResponse>;
86
+ export declare const MessagesResponse: MessageFns<MessagesResponse>;
87
+ export interface ChatServiceClient {
88
+ createChat(request: CreateChatRequest, metadata?: Metadata): Observable<Chat>;
89
+ getChat(request: GetChatRequest, metadata?: Metadata): Observable<Chat>;
90
+ listChats(request: ListChatsRequest, metadata?: Metadata): Observable<ChatsResponse>;
91
+ deleteChat(request: DeleteChatRequest, metadata?: Metadata): Observable<Empty>;
92
+ addMessage(request: AddMessageRequest, metadata?: Metadata): Observable<ChatMessage>;
93
+ getMessages(request: GetMessagesRequest, metadata?: Metadata): Observable<MessagesResponse>;
94
+ }
95
+ export interface ChatServiceController {
96
+ createChat(request: CreateChatRequest, metadata?: Metadata): Promise<Chat> | Observable<Chat> | Chat;
97
+ getChat(request: GetChatRequest, metadata?: Metadata): Promise<Chat> | Observable<Chat> | Chat;
98
+ listChats(request: ListChatsRequest, metadata?: Metadata): Promise<ChatsResponse> | Observable<ChatsResponse> | ChatsResponse;
99
+ deleteChat(request: DeleteChatRequest, metadata?: Metadata): void;
100
+ addMessage(request: AddMessageRequest, metadata?: Metadata): Promise<ChatMessage> | Observable<ChatMessage> | ChatMessage;
101
+ getMessages(request: GetMessagesRequest, metadata?: Metadata): Promise<MessagesResponse> | Observable<MessagesResponse> | MessagesResponse;
102
+ }
103
+ export declare function ChatServiceControllerMethods(): (constructor: Function) => void;
104
+ export declare const CHAT_SERVICE_NAME = "ChatService";
105
+ export type ChatServiceService = typeof ChatServiceService;
106
+ export declare const ChatServiceService: {
107
+ readonly createChat: {
108
+ readonly path: "/chat.ChatService/createChat";
109
+ readonly requestStream: false;
110
+ readonly responseStream: false;
111
+ readonly requestSerialize: (value: CreateChatRequest) => Buffer;
112
+ readonly requestDeserialize: (value: Buffer) => CreateChatRequest;
113
+ readonly responseSerialize: (value: Chat) => Buffer;
114
+ readonly responseDeserialize: (value: Buffer) => Chat;
115
+ };
116
+ readonly getChat: {
117
+ readonly path: "/chat.ChatService/getChat";
118
+ readonly requestStream: false;
119
+ readonly responseStream: false;
120
+ readonly requestSerialize: (value: GetChatRequest) => Buffer;
121
+ readonly requestDeserialize: (value: Buffer) => GetChatRequest;
122
+ readonly responseSerialize: (value: Chat) => Buffer;
123
+ readonly responseDeserialize: (value: Buffer) => Chat;
124
+ };
125
+ readonly listChats: {
126
+ readonly path: "/chat.ChatService/listChats";
127
+ readonly requestStream: false;
128
+ readonly responseStream: false;
129
+ readonly requestSerialize: (value: ListChatsRequest) => Buffer;
130
+ readonly requestDeserialize: (value: Buffer) => ListChatsRequest;
131
+ readonly responseSerialize: (value: ChatsResponse) => Buffer;
132
+ readonly responseDeserialize: (value: Buffer) => ChatsResponse;
133
+ };
134
+ readonly deleteChat: {
135
+ readonly path: "/chat.ChatService/deleteChat";
136
+ readonly requestStream: false;
137
+ readonly responseStream: false;
138
+ readonly requestSerialize: (value: DeleteChatRequest) => Buffer;
139
+ readonly requestDeserialize: (value: Buffer) => DeleteChatRequest;
140
+ readonly responseSerialize: (value: Empty) => Buffer;
141
+ readonly responseDeserialize: (value: Buffer) => Empty;
142
+ };
143
+ readonly addMessage: {
144
+ readonly path: "/chat.ChatService/addMessage";
145
+ readonly requestStream: false;
146
+ readonly responseStream: false;
147
+ readonly requestSerialize: (value: AddMessageRequest) => Buffer;
148
+ readonly requestDeserialize: (value: Buffer) => AddMessageRequest;
149
+ readonly responseSerialize: (value: ChatMessage) => Buffer;
150
+ readonly responseDeserialize: (value: Buffer) => ChatMessage;
151
+ };
152
+ readonly getMessages: {
153
+ readonly path: "/chat.ChatService/getMessages";
154
+ readonly requestStream: false;
155
+ readonly responseStream: false;
156
+ readonly requestSerialize: (value: GetMessagesRequest) => Buffer;
157
+ readonly requestDeserialize: (value: Buffer) => GetMessagesRequest;
158
+ readonly responseSerialize: (value: MessagesResponse) => Buffer;
159
+ readonly responseDeserialize: (value: Buffer) => MessagesResponse;
160
+ };
161
+ };
162
+ export interface ChatServiceServer extends UntypedServiceImplementation {
163
+ createChat: handleUnaryCall<CreateChatRequest, Chat>;
164
+ getChat: handleUnaryCall<GetChatRequest, Chat>;
165
+ listChats: handleUnaryCall<ListChatsRequest, ChatsResponse>;
166
+ deleteChat: handleUnaryCall<DeleteChatRequest, Empty>;
167
+ addMessage: handleUnaryCall<AddMessageRequest, ChatMessage>;
168
+ getMessages: handleUnaryCall<GetMessagesRequest, MessagesResponse>;
169
+ }
170
+ export interface MessageFns<T> {
171
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
172
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
173
+ }