geniebox-shared-lib 2.2.7 → 2.4.0

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,568 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.7.7
5
+ // protoc v5.28.2
6
+ // source: agent.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AgentServiceService = exports.AGENT_SERVICE_NAME = exports.AgentsResponse = exports.DeleteAgentRequest = exports.ListAgentsRequest = exports.GetAgentRequest = exports.UpdateAgentRequest = exports.CreateAgentRequest = exports.Agent = exports.AGENT_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ exports.AgentServiceControllerMethods = AgentServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const wire_1 = require("@bufbuild/protobuf/wire");
12
+ const microservices_1 = require("@nestjs/microservices");
13
+ const empty_interface_1 = require("./google/protobuf/empty.interface");
14
+ exports.protobufPackage = "agent";
15
+ exports.AGENT_PACKAGE_NAME = "agent";
16
+ function createBaseAgent() {
17
+ return {
18
+ id: "",
19
+ name: "",
20
+ description: "",
21
+ icon: "",
22
+ userId: "",
23
+ instructions: "",
24
+ visibility: "",
25
+ createdAt: "",
26
+ updatedAt: "",
27
+ };
28
+ }
29
+ exports.Agent = {
30
+ encode(message, writer = new wire_1.BinaryWriter()) {
31
+ if (message.id !== "") {
32
+ writer.uint32(10).string(message.id);
33
+ }
34
+ if (message.name !== "") {
35
+ writer.uint32(18).string(message.name);
36
+ }
37
+ if (message.description !== "") {
38
+ writer.uint32(26).string(message.description);
39
+ }
40
+ if (message.icon !== "") {
41
+ writer.uint32(34).string(message.icon);
42
+ }
43
+ if (message.userId !== "") {
44
+ writer.uint32(42).string(message.userId);
45
+ }
46
+ if (message.instructions !== "") {
47
+ writer.uint32(50).string(message.instructions);
48
+ }
49
+ if (message.visibility !== "") {
50
+ writer.uint32(58).string(message.visibility);
51
+ }
52
+ if (message.createdAt !== "") {
53
+ writer.uint32(66).string(message.createdAt);
54
+ }
55
+ if (message.updatedAt !== "") {
56
+ writer.uint32(74).string(message.updatedAt);
57
+ }
58
+ return writer;
59
+ },
60
+ decode(input, length) {
61
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
62
+ const end = length === undefined ? reader.len : reader.pos + length;
63
+ const message = createBaseAgent();
64
+ while (reader.pos < end) {
65
+ const tag = reader.uint32();
66
+ switch (tag >>> 3) {
67
+ case 1: {
68
+ if (tag !== 10) {
69
+ break;
70
+ }
71
+ message.id = reader.string();
72
+ continue;
73
+ }
74
+ case 2: {
75
+ if (tag !== 18) {
76
+ break;
77
+ }
78
+ message.name = reader.string();
79
+ continue;
80
+ }
81
+ case 3: {
82
+ if (tag !== 26) {
83
+ break;
84
+ }
85
+ message.description = reader.string();
86
+ continue;
87
+ }
88
+ case 4: {
89
+ if (tag !== 34) {
90
+ break;
91
+ }
92
+ message.icon = reader.string();
93
+ continue;
94
+ }
95
+ case 5: {
96
+ if (tag !== 42) {
97
+ break;
98
+ }
99
+ message.userId = reader.string();
100
+ continue;
101
+ }
102
+ case 6: {
103
+ if (tag !== 50) {
104
+ break;
105
+ }
106
+ message.instructions = reader.string();
107
+ continue;
108
+ }
109
+ case 7: {
110
+ if (tag !== 58) {
111
+ break;
112
+ }
113
+ message.visibility = reader.string();
114
+ continue;
115
+ }
116
+ case 8: {
117
+ if (tag !== 66) {
118
+ break;
119
+ }
120
+ message.createdAt = reader.string();
121
+ continue;
122
+ }
123
+ case 9: {
124
+ if (tag !== 74) {
125
+ break;
126
+ }
127
+ message.updatedAt = reader.string();
128
+ continue;
129
+ }
130
+ }
131
+ if ((tag & 7) === 4 || tag === 0) {
132
+ break;
133
+ }
134
+ reader.skip(tag & 7);
135
+ }
136
+ return message;
137
+ },
138
+ };
139
+ function createBaseCreateAgentRequest() {
140
+ return { userId: "", name: "", description: "", icon: "", instructions: "", visibility: "" };
141
+ }
142
+ exports.CreateAgentRequest = {
143
+ encode(message, writer = new wire_1.BinaryWriter()) {
144
+ if (message.userId !== "") {
145
+ writer.uint32(10).string(message.userId);
146
+ }
147
+ if (message.name !== "") {
148
+ writer.uint32(18).string(message.name);
149
+ }
150
+ if (message.description !== "") {
151
+ writer.uint32(26).string(message.description);
152
+ }
153
+ if (message.icon !== "") {
154
+ writer.uint32(34).string(message.icon);
155
+ }
156
+ if (message.instructions !== "") {
157
+ writer.uint32(42).string(message.instructions);
158
+ }
159
+ if (message.visibility !== "") {
160
+ writer.uint32(50).string(message.visibility);
161
+ }
162
+ return writer;
163
+ },
164
+ decode(input, length) {
165
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
166
+ const end = length === undefined ? reader.len : reader.pos + length;
167
+ const message = createBaseCreateAgentRequest();
168
+ while (reader.pos < end) {
169
+ const tag = reader.uint32();
170
+ switch (tag >>> 3) {
171
+ case 1: {
172
+ if (tag !== 10) {
173
+ break;
174
+ }
175
+ message.userId = reader.string();
176
+ continue;
177
+ }
178
+ case 2: {
179
+ if (tag !== 18) {
180
+ break;
181
+ }
182
+ message.name = reader.string();
183
+ continue;
184
+ }
185
+ case 3: {
186
+ if (tag !== 26) {
187
+ break;
188
+ }
189
+ message.description = reader.string();
190
+ continue;
191
+ }
192
+ case 4: {
193
+ if (tag !== 34) {
194
+ break;
195
+ }
196
+ message.icon = reader.string();
197
+ continue;
198
+ }
199
+ case 5: {
200
+ if (tag !== 42) {
201
+ break;
202
+ }
203
+ message.instructions = reader.string();
204
+ continue;
205
+ }
206
+ case 6: {
207
+ if (tag !== 50) {
208
+ break;
209
+ }
210
+ message.visibility = reader.string();
211
+ continue;
212
+ }
213
+ }
214
+ if ((tag & 7) === 4 || tag === 0) {
215
+ break;
216
+ }
217
+ reader.skip(tag & 7);
218
+ }
219
+ return message;
220
+ },
221
+ };
222
+ function createBaseUpdateAgentRequest() {
223
+ return { id: "", userId: "" };
224
+ }
225
+ exports.UpdateAgentRequest = {
226
+ encode(message, writer = new wire_1.BinaryWriter()) {
227
+ if (message.id !== "") {
228
+ writer.uint32(10).string(message.id);
229
+ }
230
+ if (message.userId !== "") {
231
+ writer.uint32(18).string(message.userId);
232
+ }
233
+ if (message.name !== undefined) {
234
+ writer.uint32(26).string(message.name);
235
+ }
236
+ if (message.description !== undefined) {
237
+ writer.uint32(34).string(message.description);
238
+ }
239
+ if (message.icon !== undefined) {
240
+ writer.uint32(42).string(message.icon);
241
+ }
242
+ if (message.instructions !== undefined) {
243
+ writer.uint32(50).string(message.instructions);
244
+ }
245
+ if (message.visibility !== undefined) {
246
+ writer.uint32(58).string(message.visibility);
247
+ }
248
+ return writer;
249
+ },
250
+ decode(input, length) {
251
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
252
+ const end = length === undefined ? reader.len : reader.pos + length;
253
+ const message = createBaseUpdateAgentRequest();
254
+ while (reader.pos < end) {
255
+ const tag = reader.uint32();
256
+ switch (tag >>> 3) {
257
+ case 1: {
258
+ if (tag !== 10) {
259
+ break;
260
+ }
261
+ message.id = reader.string();
262
+ continue;
263
+ }
264
+ case 2: {
265
+ if (tag !== 18) {
266
+ break;
267
+ }
268
+ message.userId = reader.string();
269
+ continue;
270
+ }
271
+ case 3: {
272
+ if (tag !== 26) {
273
+ break;
274
+ }
275
+ message.name = reader.string();
276
+ continue;
277
+ }
278
+ case 4: {
279
+ if (tag !== 34) {
280
+ break;
281
+ }
282
+ message.description = reader.string();
283
+ continue;
284
+ }
285
+ case 5: {
286
+ if (tag !== 42) {
287
+ break;
288
+ }
289
+ message.icon = reader.string();
290
+ continue;
291
+ }
292
+ case 6: {
293
+ if (tag !== 50) {
294
+ break;
295
+ }
296
+ message.instructions = reader.string();
297
+ continue;
298
+ }
299
+ case 7: {
300
+ if (tag !== 58) {
301
+ break;
302
+ }
303
+ message.visibility = reader.string();
304
+ continue;
305
+ }
306
+ }
307
+ if ((tag & 7) === 4 || tag === 0) {
308
+ break;
309
+ }
310
+ reader.skip(tag & 7);
311
+ }
312
+ return message;
313
+ },
314
+ };
315
+ function createBaseGetAgentRequest() {
316
+ return { id: "", userId: "" };
317
+ }
318
+ exports.GetAgentRequest = {
319
+ encode(message, writer = new wire_1.BinaryWriter()) {
320
+ if (message.id !== "") {
321
+ writer.uint32(10).string(message.id);
322
+ }
323
+ if (message.userId !== "") {
324
+ writer.uint32(18).string(message.userId);
325
+ }
326
+ return writer;
327
+ },
328
+ decode(input, length) {
329
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
330
+ const end = length === undefined ? reader.len : reader.pos + length;
331
+ const message = createBaseGetAgentRequest();
332
+ while (reader.pos < end) {
333
+ const tag = reader.uint32();
334
+ switch (tag >>> 3) {
335
+ case 1: {
336
+ if (tag !== 10) {
337
+ break;
338
+ }
339
+ message.id = reader.string();
340
+ continue;
341
+ }
342
+ case 2: {
343
+ if (tag !== 18) {
344
+ break;
345
+ }
346
+ message.userId = reader.string();
347
+ continue;
348
+ }
349
+ }
350
+ if ((tag & 7) === 4 || tag === 0) {
351
+ break;
352
+ }
353
+ reader.skip(tag & 7);
354
+ }
355
+ return message;
356
+ },
357
+ };
358
+ function createBaseListAgentsRequest() {
359
+ return { userId: "", limit: 0, offset: 0 };
360
+ }
361
+ exports.ListAgentsRequest = {
362
+ encode(message, writer = new wire_1.BinaryWriter()) {
363
+ if (message.userId !== "") {
364
+ writer.uint32(10).string(message.userId);
365
+ }
366
+ if (message.limit !== 0) {
367
+ writer.uint32(16).int32(message.limit);
368
+ }
369
+ if (message.offset !== 0) {
370
+ writer.uint32(24).int32(message.offset);
371
+ }
372
+ if (message.visibility !== undefined) {
373
+ writer.uint32(34).string(message.visibility);
374
+ }
375
+ return writer;
376
+ },
377
+ decode(input, length) {
378
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
379
+ const end = length === undefined ? reader.len : reader.pos + length;
380
+ const message = createBaseListAgentsRequest();
381
+ while (reader.pos < end) {
382
+ const tag = reader.uint32();
383
+ switch (tag >>> 3) {
384
+ case 1: {
385
+ if (tag !== 10) {
386
+ break;
387
+ }
388
+ message.userId = reader.string();
389
+ continue;
390
+ }
391
+ case 2: {
392
+ if (tag !== 16) {
393
+ break;
394
+ }
395
+ message.limit = reader.int32();
396
+ continue;
397
+ }
398
+ case 3: {
399
+ if (tag !== 24) {
400
+ break;
401
+ }
402
+ message.offset = reader.int32();
403
+ continue;
404
+ }
405
+ case 4: {
406
+ if (tag !== 34) {
407
+ break;
408
+ }
409
+ message.visibility = reader.string();
410
+ continue;
411
+ }
412
+ }
413
+ if ((tag & 7) === 4 || tag === 0) {
414
+ break;
415
+ }
416
+ reader.skip(tag & 7);
417
+ }
418
+ return message;
419
+ },
420
+ };
421
+ function createBaseDeleteAgentRequest() {
422
+ return { id: "", userId: "" };
423
+ }
424
+ exports.DeleteAgentRequest = {
425
+ encode(message, writer = new wire_1.BinaryWriter()) {
426
+ if (message.id !== "") {
427
+ writer.uint32(10).string(message.id);
428
+ }
429
+ if (message.userId !== "") {
430
+ writer.uint32(18).string(message.userId);
431
+ }
432
+ return writer;
433
+ },
434
+ decode(input, length) {
435
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
436
+ const end = length === undefined ? reader.len : reader.pos + length;
437
+ const message = createBaseDeleteAgentRequest();
438
+ while (reader.pos < end) {
439
+ const tag = reader.uint32();
440
+ switch (tag >>> 3) {
441
+ case 1: {
442
+ if (tag !== 10) {
443
+ break;
444
+ }
445
+ message.id = reader.string();
446
+ continue;
447
+ }
448
+ case 2: {
449
+ if (tag !== 18) {
450
+ break;
451
+ }
452
+ message.userId = reader.string();
453
+ continue;
454
+ }
455
+ }
456
+ if ((tag & 7) === 4 || tag === 0) {
457
+ break;
458
+ }
459
+ reader.skip(tag & 7);
460
+ }
461
+ return message;
462
+ },
463
+ };
464
+ function createBaseAgentsResponse() {
465
+ return { agents: [], total: 0 };
466
+ }
467
+ exports.AgentsResponse = {
468
+ encode(message, writer = new wire_1.BinaryWriter()) {
469
+ for (const v of message.agents) {
470
+ exports.Agent.encode(v, writer.uint32(10).fork()).join();
471
+ }
472
+ if (message.total !== 0) {
473
+ writer.uint32(16).int32(message.total);
474
+ }
475
+ return writer;
476
+ },
477
+ decode(input, length) {
478
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
479
+ const end = length === undefined ? reader.len : reader.pos + length;
480
+ const message = createBaseAgentsResponse();
481
+ while (reader.pos < end) {
482
+ const tag = reader.uint32();
483
+ switch (tag >>> 3) {
484
+ case 1: {
485
+ if (tag !== 10) {
486
+ break;
487
+ }
488
+ message.agents.push(exports.Agent.decode(reader, reader.uint32()));
489
+ continue;
490
+ }
491
+ case 2: {
492
+ if (tag !== 16) {
493
+ break;
494
+ }
495
+ message.total = reader.int32();
496
+ continue;
497
+ }
498
+ }
499
+ if ((tag & 7) === 4 || tag === 0) {
500
+ break;
501
+ }
502
+ reader.skip(tag & 7);
503
+ }
504
+ return message;
505
+ },
506
+ };
507
+ function AgentServiceControllerMethods() {
508
+ return function (constructor) {
509
+ const grpcMethods = ["createAgent", "getAgent", "updateAgent", "deleteAgent", "listAgents"];
510
+ for (const method of grpcMethods) {
511
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
512
+ (0, microservices_1.GrpcMethod)("AgentService", method)(constructor.prototype[method], method, descriptor);
513
+ }
514
+ const grpcStreamMethods = [];
515
+ for (const method of grpcStreamMethods) {
516
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
517
+ (0, microservices_1.GrpcStreamMethod)("AgentService", method)(constructor.prototype[method], method, descriptor);
518
+ }
519
+ };
520
+ }
521
+ exports.AGENT_SERVICE_NAME = "AgentService";
522
+ exports.AgentServiceService = {
523
+ createAgent: {
524
+ path: "/agent.AgentService/createAgent",
525
+ requestStream: false,
526
+ responseStream: false,
527
+ requestSerialize: (value) => Buffer.from(exports.CreateAgentRequest.encode(value).finish()),
528
+ requestDeserialize: (value) => exports.CreateAgentRequest.decode(value),
529
+ responseSerialize: (value) => Buffer.from(exports.Agent.encode(value).finish()),
530
+ responseDeserialize: (value) => exports.Agent.decode(value),
531
+ },
532
+ getAgent: {
533
+ path: "/agent.AgentService/getAgent",
534
+ requestStream: false,
535
+ responseStream: false,
536
+ requestSerialize: (value) => Buffer.from(exports.GetAgentRequest.encode(value).finish()),
537
+ requestDeserialize: (value) => exports.GetAgentRequest.decode(value),
538
+ responseSerialize: (value) => Buffer.from(exports.Agent.encode(value).finish()),
539
+ responseDeserialize: (value) => exports.Agent.decode(value),
540
+ },
541
+ updateAgent: {
542
+ path: "/agent.AgentService/updateAgent",
543
+ requestStream: false,
544
+ responseStream: false,
545
+ requestSerialize: (value) => Buffer.from(exports.UpdateAgentRequest.encode(value).finish()),
546
+ requestDeserialize: (value) => exports.UpdateAgentRequest.decode(value),
547
+ responseSerialize: (value) => Buffer.from(exports.Agent.encode(value).finish()),
548
+ responseDeserialize: (value) => exports.Agent.decode(value),
549
+ },
550
+ deleteAgent: {
551
+ path: "/agent.AgentService/deleteAgent",
552
+ requestStream: false,
553
+ responseStream: false,
554
+ requestSerialize: (value) => Buffer.from(exports.DeleteAgentRequest.encode(value).finish()),
555
+ requestDeserialize: (value) => exports.DeleteAgentRequest.decode(value),
556
+ responseSerialize: (value) => Buffer.from(empty_interface_1.Empty.encode(value).finish()),
557
+ responseDeserialize: (value) => empty_interface_1.Empty.decode(value),
558
+ },
559
+ listAgents: {
560
+ path: "/agent.AgentService/listAgents",
561
+ requestStream: false,
562
+ responseStream: false,
563
+ requestSerialize: (value) => Buffer.from(exports.ListAgentsRequest.encode(value).finish()),
564
+ requestDeserialize: (value) => exports.ListAgentsRequest.decode(value),
565
+ responseSerialize: (value) => Buffer.from(exports.AgentsResponse.encode(value).finish()),
566
+ responseDeserialize: (value) => exports.AgentsResponse.decode(value),
567
+ },
568
+ };
@@ -0,0 +1,12 @@
1
+ import { OnModuleInit } from "@nestjs/common";
2
+ import { ClientGrpc } from "@nestjs/microservices";
3
+ import { GenerationServiceClient } from "./generation.interface";
4
+ export declare class GenerationClient implements OnModuleInit {
5
+ private readonly client;
6
+ private readonly logger;
7
+ private generationClient?;
8
+ constructor(client: ClientGrpc);
9
+ onModuleInit(): void;
10
+ get service(): GenerationServiceClient;
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 GenerationClient_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.GenerationClient = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ let GenerationClient = GenerationClient_1 = class GenerationClient {
19
+ constructor(client) {
20
+ this.client = client;
21
+ this.logger = new common_1.Logger(GenerationClient_1.name);
22
+ }
23
+ onModuleInit() {
24
+ this.generationClient =
25
+ this.client.getService("GenerationService");
26
+ this.logger.log("GenerationServiceClient initialized");
27
+ }
28
+ get service() {
29
+ if (!this.generationClient) {
30
+ throw new common_1.InternalServerErrorException("GenerationService is not initialized yet");
31
+ }
32
+ return this.generationClient;
33
+ }
34
+ isReady() {
35
+ return !!this.generationClient;
36
+ }
37
+ };
38
+ exports.GenerationClient = GenerationClient;
39
+ exports.GenerationClient = GenerationClient = GenerationClient_1 = __decorate([
40
+ (0, common_1.Injectable)(),
41
+ __param(0, (0, common_1.Inject)("GENERATION_PACKAGE")),
42
+ __metadata("design:paramtypes", [Object])
43
+ ], GenerationClient);