geniebox-shared-lib 1.0.71 → 1.0.73

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,5 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
- import type { handleUnaryCall, Metadata, UntypedServiceImplementation } from "@grpc/grpc-js";
2
+ import type { handleServerStreamingCall, handleUnaryCall, Metadata, UntypedServiceImplementation } from "@grpc/grpc-js";
3
3
  import { Observable } from "rxjs";
4
4
  export declare const protobufPackage = "ai";
5
5
  export interface AICallResponse {
@@ -33,6 +33,18 @@ export interface AICancelRequest {
33
33
  endpoint: string;
34
34
  uuid: string;
35
35
  }
36
+ export interface AIStreamRequest {
37
+ endpoint: string;
38
+ payload: string;
39
+ }
40
+ export interface AIStreamResponse {
41
+ requestId: string;
42
+ /** "start", "data", "log", "done", "error" */
43
+ type: string;
44
+ data: string;
45
+ chunk: number;
46
+ timestamp: string;
47
+ }
36
48
  export declare const AI_PACKAGE_NAME = "ai";
37
49
  export declare const AICallResponse: MessageFns<AICallResponse>;
38
50
  export declare const AIStatusResponse: MessageFns<AIStatusResponse>;
@@ -42,17 +54,21 @@ export declare const AICallRequest: MessageFns<AICallRequest>;
42
54
  export declare const AIStatusRequest: MessageFns<AIStatusRequest>;
43
55
  export declare const AIResultRequest: MessageFns<AIResultRequest>;
44
56
  export declare const AICancelRequest: MessageFns<AICancelRequest>;
57
+ export declare const AIStreamRequest: MessageFns<AIStreamRequest>;
58
+ export declare const AIStreamResponse: MessageFns<AIStreamResponse>;
45
59
  export interface AIServiceClient {
46
60
  call(request: AICallRequest, metadata?: Metadata): Observable<AICallResponse>;
47
61
  status(request: AIStatusRequest, metadata?: Metadata): Observable<AIStatusResponse>;
48
62
  result(request: AIResultRequest, metadata?: Metadata): Observable<AIResultResponse>;
49
63
  cancel(request: AICancelRequest, metadata?: Metadata): Observable<AICancelResponse>;
64
+ stream(request: AIStreamRequest, metadata?: Metadata): Observable<AIStreamResponse>;
50
65
  }
51
66
  export interface AIServiceController {
52
67
  call(request: AICallRequest, metadata?: Metadata): Promise<AICallResponse> | Observable<AICallResponse> | AICallResponse;
53
68
  status(request: AIStatusRequest, metadata?: Metadata): Promise<AIStatusResponse> | Observable<AIStatusResponse> | AIStatusResponse;
54
69
  result(request: AIResultRequest, metadata?: Metadata): Promise<AIResultResponse> | Observable<AIResultResponse> | AIResultResponse;
55
70
  cancel(request: AICancelRequest, metadata?: Metadata): Promise<AICancelResponse> | Observable<AICancelResponse> | AICancelResponse;
71
+ stream(request: AIStreamRequest, metadata?: Metadata): Observable<AIStreamResponse>;
56
72
  }
57
73
  export declare function AIServiceControllerMethods(): (constructor: Function) => void;
58
74
  export declare const AI_SERVICE_NAME = "AIService";
@@ -94,12 +110,22 @@ export declare const AIServiceService: {
94
110
  readonly responseSerialize: (value: AICancelResponse) => Buffer;
95
111
  readonly responseDeserialize: (value: Buffer) => AICancelResponse;
96
112
  };
113
+ readonly stream: {
114
+ readonly path: "/ai.AIService/stream";
115
+ readonly requestStream: false;
116
+ readonly responseStream: true;
117
+ readonly requestSerialize: (value: AIStreamRequest) => Buffer;
118
+ readonly requestDeserialize: (value: Buffer) => AIStreamRequest;
119
+ readonly responseSerialize: (value: AIStreamResponse) => Buffer;
120
+ readonly responseDeserialize: (value: Buffer) => AIStreamResponse;
121
+ };
97
122
  };
98
123
  export interface AIServiceServer extends UntypedServiceImplementation {
99
124
  call: handleUnaryCall<AICallRequest, AICallResponse>;
100
125
  status: handleUnaryCall<AIStatusRequest, AIStatusResponse>;
101
126
  result: handleUnaryCall<AIResultRequest, AIResultResponse>;
102
127
  cancel: handleUnaryCall<AICancelRequest, AICancelResponse>;
128
+ stream: handleServerStreamingCall<AIStreamRequest, AIStreamResponse>;
103
129
  }
104
130
  export interface MessageFns<T> {
105
131
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
@@ -5,7 +5,7 @@
5
5
  // protoc v5.28.2
6
6
  // source: ai.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AIServiceService = exports.AI_SERVICE_NAME = exports.AICancelRequest = exports.AIResultRequest = exports.AIStatusRequest = exports.AICallRequest = exports.AICancelResponse = exports.AIResultResponse = exports.AIStatusResponse = exports.AICallResponse = exports.AI_PACKAGE_NAME = exports.protobufPackage = void 0;
8
+ exports.AIServiceService = exports.AI_SERVICE_NAME = exports.AIStreamResponse = exports.AIStreamRequest = exports.AICancelRequest = exports.AIResultRequest = exports.AIStatusRequest = exports.AICallRequest = exports.AICancelResponse = exports.AIResultResponse = exports.AIStatusResponse = exports.AICallResponse = exports.AI_PACKAGE_NAME = exports.protobufPackage = void 0;
9
9
  exports.AIServiceControllerMethods = AIServiceControllerMethods;
10
10
  /* eslint-disable */
11
11
  const wire_1 = require("@bufbuild/protobuf/wire");
@@ -346,9 +346,125 @@ exports.AICancelRequest = {
346
346
  return message;
347
347
  },
348
348
  };
349
+ function createBaseAIStreamRequest() {
350
+ return { endpoint: "", payload: "" };
351
+ }
352
+ exports.AIStreamRequest = {
353
+ encode(message, writer = new wire_1.BinaryWriter()) {
354
+ if (message.endpoint !== "") {
355
+ writer.uint32(10).string(message.endpoint);
356
+ }
357
+ if (message.payload !== "") {
358
+ writer.uint32(18).string(message.payload);
359
+ }
360
+ return writer;
361
+ },
362
+ decode(input, length) {
363
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
364
+ const end = length === undefined ? reader.len : reader.pos + length;
365
+ const message = createBaseAIStreamRequest();
366
+ while (reader.pos < end) {
367
+ const tag = reader.uint32();
368
+ switch (tag >>> 3) {
369
+ case 1: {
370
+ if (tag !== 10) {
371
+ break;
372
+ }
373
+ message.endpoint = reader.string();
374
+ continue;
375
+ }
376
+ case 2: {
377
+ if (tag !== 18) {
378
+ break;
379
+ }
380
+ message.payload = reader.string();
381
+ continue;
382
+ }
383
+ }
384
+ if ((tag & 7) === 4 || tag === 0) {
385
+ break;
386
+ }
387
+ reader.skip(tag & 7);
388
+ }
389
+ return message;
390
+ },
391
+ };
392
+ function createBaseAIStreamResponse() {
393
+ return { requestId: "", type: "", data: "", chunk: 0, timestamp: "" };
394
+ }
395
+ exports.AIStreamResponse = {
396
+ encode(message, writer = new wire_1.BinaryWriter()) {
397
+ if (message.requestId !== "") {
398
+ writer.uint32(10).string(message.requestId);
399
+ }
400
+ if (message.type !== "") {
401
+ writer.uint32(18).string(message.type);
402
+ }
403
+ if (message.data !== "") {
404
+ writer.uint32(26).string(message.data);
405
+ }
406
+ if (message.chunk !== 0) {
407
+ writer.uint32(32).int32(message.chunk);
408
+ }
409
+ if (message.timestamp !== "") {
410
+ writer.uint32(42).string(message.timestamp);
411
+ }
412
+ return writer;
413
+ },
414
+ decode(input, length) {
415
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
416
+ const end = length === undefined ? reader.len : reader.pos + length;
417
+ const message = createBaseAIStreamResponse();
418
+ while (reader.pos < end) {
419
+ const tag = reader.uint32();
420
+ switch (tag >>> 3) {
421
+ case 1: {
422
+ if (tag !== 10) {
423
+ break;
424
+ }
425
+ message.requestId = reader.string();
426
+ continue;
427
+ }
428
+ case 2: {
429
+ if (tag !== 18) {
430
+ break;
431
+ }
432
+ message.type = reader.string();
433
+ continue;
434
+ }
435
+ case 3: {
436
+ if (tag !== 26) {
437
+ break;
438
+ }
439
+ message.data = reader.string();
440
+ continue;
441
+ }
442
+ case 4: {
443
+ if (tag !== 32) {
444
+ break;
445
+ }
446
+ message.chunk = reader.int32();
447
+ continue;
448
+ }
449
+ case 5: {
450
+ if (tag !== 42) {
451
+ break;
452
+ }
453
+ message.timestamp = reader.string();
454
+ continue;
455
+ }
456
+ }
457
+ if ((tag & 7) === 4 || tag === 0) {
458
+ break;
459
+ }
460
+ reader.skip(tag & 7);
461
+ }
462
+ return message;
463
+ },
464
+ };
349
465
  function AIServiceControllerMethods() {
350
466
  return function (constructor) {
351
- const grpcMethods = ["call", "status", "result", "cancel"];
467
+ const grpcMethods = ["call", "status", "result", "cancel", "stream"];
352
468
  for (const method of grpcMethods) {
353
469
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
354
470
  (0, microservices_1.GrpcMethod)("AIService", method)(constructor.prototype[method], method, descriptor);
@@ -398,4 +514,13 @@ exports.AIServiceService = {
398
514
  responseSerialize: (value) => Buffer.from(exports.AICancelResponse.encode(value).finish()),
399
515
  responseDeserialize: (value) => exports.AICancelResponse.decode(value),
400
516
  },
517
+ stream: {
518
+ path: "/ai.AIService/stream",
519
+ requestStream: false,
520
+ responseStream: true,
521
+ requestSerialize: (value) => Buffer.from(exports.AIStreamRequest.encode(value).finish()),
522
+ requestDeserialize: (value) => exports.AIStreamRequest.decode(value),
523
+ responseSerialize: (value) => Buffer.from(exports.AIStreamResponse.encode(value).finish()),
524
+ responseDeserialize: (value) => exports.AIStreamResponse.decode(value),
525
+ },
401
526
  };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { EventClient } from "./event/event.client";
8
8
  export { KeyClient } from "./key/key.client";
9
9
  export { MessageFns as UserMessageFns, protobufPackage as UserProtobufPackage, User, CreateUserRequest, CreateUserPersonal, UpdateUserRequest, GetByIdRequest, UserResponse, UsersResponse, FindByEmailRequest, FindByPhoneRequest, UpdateUserPersonal, UpdatePasswordRequest, UpdateEmailVerificationRequest, ResetPasswordData, GetEmailVerificationStatusRequest, EmailVerificationStatusResponse, UserServiceService as UserService, } from "./user/user.interface";
10
10
  export { MessageFns as AuthMessageFns, protobufPackage as AuthProtobufPackage, LoginCredentials, RegisterCredentials, LogoutRequest, RefreshRequest, AuthResponse, RefreshTokenResponse, RecoverRequest, ResetPasswordRequest, ConfirmEmailRequest, ConfirmEmailByCodeRequest, ConfirmEmailResponse, CheckEmailVerifiedRequest, CheckEmailVerifiedResponse, ResendConfirmationCodeRequest, } from "./auth/auth.interface";
11
- export { MessageFns as AIMessageFns, protobufPackage as AIProtobufPackage, AICallRequest, AICallResponse, AIStatusRequest, AIStatusResponse, AIResultRequest, AIResultResponse, AICancelRequest, AICancelResponse, AIServiceService as AIService, } from "./ai/ai.interface";
11
+ export { MessageFns as AIMessageFns, protobufPackage as AIProtobufPackage, AICallRequest, AICallResponse, AIStatusRequest, AIStatusResponse, AIResultRequest, AIResultResponse, AICancelRequest, AICancelResponse, AIStreamRequest, AIStreamResponse, AIServiceService as AIService, } from "./ai/ai.interface";
12
12
  export { MessageFns as OpenAIMessageFns, protobufPackage as OpenAIProtobufPackage, CreateRequest as OpenAICreateRequest, CreateResponse as OpenAICreateResponse, OpenAIServiceService as OpenAIService, } from "./openai/openai.interface";
13
13
  export { UploadRequest, UploadResponse, DownloadRequest, DownloadResponse, DeleteRequest, DeleteResponse, FileServiceService as FileService, protobufPackage as FileProtobufPackage, } from "./file/file.interface";
14
14
  export { MessageFns as EventMessageFns, protobufPackage as EventProtobufPackage, SubscribeRequest, EventMessage, EventServiceService as EventService, } from "./event/event.interface";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AIService = exports.AICancelResponse = exports.AICancelRequest = exports.AIResultResponse = exports.AIResultRequest = exports.AIStatusResponse = exports.AIStatusRequest = exports.AICallResponse = exports.AICallRequest = exports.AIProtobufPackage = exports.ResendConfirmationCodeRequest = exports.CheckEmailVerifiedResponse = exports.CheckEmailVerifiedRequest = exports.ConfirmEmailResponse = exports.ConfirmEmailByCodeRequest = exports.ConfirmEmailRequest = exports.ResetPasswordRequest = exports.RecoverRequest = exports.RefreshTokenResponse = exports.AuthResponse = exports.RefreshRequest = exports.LogoutRequest = exports.RegisterCredentials = exports.LoginCredentials = exports.AuthProtobufPackage = exports.UserService = exports.EmailVerificationStatusResponse = exports.GetEmailVerificationStatusRequest = exports.ResetPasswordData = exports.UpdateEmailVerificationRequest = exports.UpdatePasswordRequest = exports.UpdateUserPersonal = exports.FindByPhoneRequest = exports.FindByEmailRequest = exports.UsersResponse = exports.UserResponse = exports.GetByIdRequest = exports.UpdateUserRequest = exports.CreateUserPersonal = exports.CreateUserRequest = exports.User = exports.UserProtobufPackage = exports.KeyClient = exports.EventClient = exports.FileClient = exports.OpenAIClient = exports.AIClient = exports.AuthClient = exports.UsersClient = exports.SharedModule = void 0;
4
- exports.KeyService = exports.GetKeysByUserRequest = exports.KeysResponse = exports.KeyResponse = exports.GetKeyByIdRequest = exports.RemoveKeyRequest = exports.UpdateKeyRequest = exports.CreateKeyRequest = exports.Key = exports.KeysProtobufPackage = exports.EventService = exports.EventMessage = exports.SubscribeRequest = exports.EventProtobufPackage = exports.FileProtobufPackage = exports.FileService = exports.DeleteResponse = exports.DeleteRequest = exports.DownloadResponse = exports.DownloadRequest = exports.UploadResponse = exports.UploadRequest = exports.OpenAIService = exports.OpenAICreateResponse = exports.OpenAICreateRequest = exports.OpenAIProtobufPackage = void 0;
3
+ exports.AIStreamRequest = exports.AICancelResponse = exports.AICancelRequest = exports.AIResultResponse = exports.AIResultRequest = exports.AIStatusResponse = exports.AIStatusRequest = exports.AICallResponse = exports.AICallRequest = exports.AIProtobufPackage = exports.ResendConfirmationCodeRequest = exports.CheckEmailVerifiedResponse = exports.CheckEmailVerifiedRequest = exports.ConfirmEmailResponse = exports.ConfirmEmailByCodeRequest = exports.ConfirmEmailRequest = exports.ResetPasswordRequest = exports.RecoverRequest = exports.RefreshTokenResponse = exports.AuthResponse = exports.RefreshRequest = exports.LogoutRequest = exports.RegisterCredentials = exports.LoginCredentials = exports.AuthProtobufPackage = exports.UserService = exports.EmailVerificationStatusResponse = exports.GetEmailVerificationStatusRequest = exports.ResetPasswordData = exports.UpdateEmailVerificationRequest = exports.UpdatePasswordRequest = exports.UpdateUserPersonal = exports.FindByPhoneRequest = exports.FindByEmailRequest = exports.UsersResponse = exports.UserResponse = exports.GetByIdRequest = exports.UpdateUserRequest = exports.CreateUserPersonal = exports.CreateUserRequest = exports.User = exports.UserProtobufPackage = exports.KeyClient = exports.EventClient = exports.FileClient = exports.OpenAIClient = exports.AIClient = exports.AuthClient = exports.UsersClient = exports.SharedModule = void 0;
4
+ exports.KeyService = exports.GetKeysByUserRequest = exports.KeysResponse = exports.KeyResponse = exports.GetKeyByIdRequest = exports.RemoveKeyRequest = exports.UpdateKeyRequest = exports.CreateKeyRequest = exports.Key = exports.KeysProtobufPackage = exports.EventService = exports.EventMessage = exports.SubscribeRequest = exports.EventProtobufPackage = exports.FileProtobufPackage = exports.FileService = exports.DeleteResponse = exports.DeleteRequest = exports.DownloadResponse = exports.DownloadRequest = exports.UploadResponse = exports.UploadRequest = exports.OpenAIService = exports.OpenAICreateResponse = exports.OpenAICreateRequest = exports.OpenAIProtobufPackage = exports.AIService = exports.AIStreamResponse = void 0;
5
5
  var shared_module_1 = require("./shared.module");
6
6
  Object.defineProperty(exports, "SharedModule", { enumerable: true, get: function () { return shared_module_1.SharedModule; } });
7
7
  var user_client_1 = require("./user/user.client");
@@ -71,6 +71,8 @@ Object.defineProperty(exports, "AIResultRequest", { enumerable: true, get: funct
71
71
  Object.defineProperty(exports, "AIResultResponse", { enumerable: true, get: function () { return ai_interface_1.AIResultResponse; } });
72
72
  Object.defineProperty(exports, "AICancelRequest", { enumerable: true, get: function () { return ai_interface_1.AICancelRequest; } });
73
73
  Object.defineProperty(exports, "AICancelResponse", { enumerable: true, get: function () { return ai_interface_1.AICancelResponse; } });
74
+ Object.defineProperty(exports, "AIStreamRequest", { enumerable: true, get: function () { return ai_interface_1.AIStreamRequest; } });
75
+ Object.defineProperty(exports, "AIStreamResponse", { enumerable: true, get: function () { return ai_interface_1.AIStreamResponse; } });
74
76
  Object.defineProperty(exports, "AIService", { enumerable: true, get: function () { return ai_interface_1.AIServiceService; } });
75
77
  // ============================
76
78
  // OpenAI exports
@@ -32,4 +32,5 @@ export interface SharedModuleOptions {
32
32
  export declare class SharedModule {
33
33
  private static readonly logger;
34
34
  static forRoot(options?: SharedModuleOptions): DynamicModule;
35
+ static forFeature(clients: any[]): DynamicModule;
35
36
  }
@@ -239,6 +239,13 @@ let SharedModule = SharedModule_1 = class SharedModule {
239
239
  exports: providers.map((p) => p.provide),
240
240
  };
241
241
  }
242
+ static forFeature(clients) {
243
+ return {
244
+ module: SharedModule_1,
245
+ providers: clients,
246
+ exports: clients,
247
+ };
248
+ }
242
249
  };
243
250
  exports.SharedModule = SharedModule;
244
251
  SharedModule.logger = new common_1.Logger("SharedModule");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geniebox-shared-lib",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
4
4
  "description": "Shared NestJS library with gRPC clients",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",