geniebox-shared-lib 2.0.3 → 2.1.1
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.
- package/dist/ai.interface.d.ts +143 -90
- package/dist/ai.interface.js +604 -160
- package/dist/auth.interface.d.ts +37 -37
- package/dist/auth.interface.js +266 -266
- package/dist/index.d.ts +6 -2
- package/dist/index.js +47 -13
- package/dist/key.client.js +1 -1
- package/dist/request.client.d.ts +12 -0
- package/dist/request.client.js +43 -0
- package/dist/request.interface.d.ts +163 -0
- package/dist/request.interface.js +685 -0
- package/dist/response.client.d.ts +12 -0
- package/dist/response.client.js +43 -0
- package/dist/response.interface.d.ts +75 -0
- package/dist/response.interface.js +261 -0
- package/dist/shared.module.d.ts +8 -0
- package/dist/shared.module.js +62 -0
- package/dist/storage.interface.d.ts +7 -7
- package/dist/storage.interface.js +31 -31
- package/dist/user.interface.d.ts +131 -12
- package/dist/user.interface.js +796 -15
- package/package.json +1 -1
|
@@ -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 ResponseClient_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ResponseClient = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
let ResponseClient = ResponseClient_1 = class ResponseClient {
|
|
19
|
+
constructor(client) {
|
|
20
|
+
this.client = client;
|
|
21
|
+
this.logger = new common_1.Logger(ResponseClient_1.name);
|
|
22
|
+
}
|
|
23
|
+
onModuleInit() {
|
|
24
|
+
this.responseClient =
|
|
25
|
+
this.client.getService("ResponseService");
|
|
26
|
+
this.logger.log("ResponseServiceClient initialized");
|
|
27
|
+
}
|
|
28
|
+
get service() {
|
|
29
|
+
if (!this.responseClient) {
|
|
30
|
+
throw new common_1.InternalServerErrorException("ResponseService is not initialized yet");
|
|
31
|
+
}
|
|
32
|
+
return this.responseClient;
|
|
33
|
+
}
|
|
34
|
+
isReady() {
|
|
35
|
+
return !!this.responseClient;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.ResponseClient = ResponseClient;
|
|
39
|
+
exports.ResponseClient = ResponseClient = ResponseClient_1 = __decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
__param(0, (0, common_1.Inject)("RESPONSE_PACKAGE")),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
43
|
+
], ResponseClient);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import type { handleServerStreamingCall, handleUnaryCall, Metadata, UntypedServiceImplementation } from "@grpc/grpc-js";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
export declare const protobufPackage = "response";
|
|
5
|
+
export interface StreamUpdate {
|
|
6
|
+
requestId: string;
|
|
7
|
+
/** start, data, done, error */
|
|
8
|
+
type: string;
|
|
9
|
+
/** JSON data */
|
|
10
|
+
data: string;
|
|
11
|
+
/** chunk number */
|
|
12
|
+
chunk: number;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProcessResponseRequest {
|
|
16
|
+
/** ID from RabbitMQ */
|
|
17
|
+
correlationId: string;
|
|
18
|
+
/** JSON response data */
|
|
19
|
+
data: string;
|
|
20
|
+
/** error, if any */
|
|
21
|
+
error: string;
|
|
22
|
+
/** this is a stream chunk */
|
|
23
|
+
isStreamChunk: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface StreamUpdatesRequest {
|
|
26
|
+
requestId: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ProcessResponseResponse {
|
|
29
|
+
success: boolean;
|
|
30
|
+
error: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const RESPONSE_PACKAGE_NAME = "response";
|
|
33
|
+
export declare const StreamUpdate: MessageFns<StreamUpdate>;
|
|
34
|
+
export declare const ProcessResponseRequest: MessageFns<ProcessResponseRequest>;
|
|
35
|
+
export declare const StreamUpdatesRequest: MessageFns<StreamUpdatesRequest>;
|
|
36
|
+
export declare const ProcessResponseResponse: MessageFns<ProcessResponseResponse>;
|
|
37
|
+
export interface ResponseServiceClient {
|
|
38
|
+
processResponse(request: ProcessResponseRequest, metadata?: Metadata): Observable<ProcessResponseResponse>;
|
|
39
|
+
getStreamUpdates(request: StreamUpdatesRequest, metadata?: Metadata): Observable<StreamUpdate>;
|
|
40
|
+
}
|
|
41
|
+
export interface ResponseServiceController {
|
|
42
|
+
processResponse(request: ProcessResponseRequest, metadata?: Metadata): Promise<ProcessResponseResponse> | Observable<ProcessResponseResponse> | ProcessResponseResponse;
|
|
43
|
+
getStreamUpdates(request: StreamUpdatesRequest, metadata?: Metadata): Observable<StreamUpdate>;
|
|
44
|
+
}
|
|
45
|
+
export declare function ResponseServiceControllerMethods(): (constructor: Function) => void;
|
|
46
|
+
export declare const RESPONSE_SERVICE_NAME = "ResponseService";
|
|
47
|
+
export type ResponseServiceService = typeof ResponseServiceService;
|
|
48
|
+
export declare const ResponseServiceService: {
|
|
49
|
+
readonly processResponse: {
|
|
50
|
+
readonly path: "/response.ResponseService/ProcessResponse";
|
|
51
|
+
readonly requestStream: false;
|
|
52
|
+
readonly responseStream: false;
|
|
53
|
+
readonly requestSerialize: (value: ProcessResponseRequest) => Buffer;
|
|
54
|
+
readonly requestDeserialize: (value: Buffer) => ProcessResponseRequest;
|
|
55
|
+
readonly responseSerialize: (value: ProcessResponseResponse) => Buffer;
|
|
56
|
+
readonly responseDeserialize: (value: Buffer) => ProcessResponseResponse;
|
|
57
|
+
};
|
|
58
|
+
readonly getStreamUpdates: {
|
|
59
|
+
readonly path: "/response.ResponseService/GetStreamUpdates";
|
|
60
|
+
readonly requestStream: false;
|
|
61
|
+
readonly responseStream: true;
|
|
62
|
+
readonly requestSerialize: (value: StreamUpdatesRequest) => Buffer;
|
|
63
|
+
readonly requestDeserialize: (value: Buffer) => StreamUpdatesRequest;
|
|
64
|
+
readonly responseSerialize: (value: StreamUpdate) => Buffer;
|
|
65
|
+
readonly responseDeserialize: (value: Buffer) => StreamUpdate;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export interface ResponseServiceServer extends UntypedServiceImplementation {
|
|
69
|
+
processResponse: handleUnaryCall<ProcessResponseRequest, ProcessResponseResponse>;
|
|
70
|
+
getStreamUpdates: handleServerStreamingCall<StreamUpdatesRequest, StreamUpdate>;
|
|
71
|
+
}
|
|
72
|
+
export interface MessageFns<T> {
|
|
73
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
74
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
75
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
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: response.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ResponseServiceService = exports.RESPONSE_SERVICE_NAME = exports.ProcessResponseResponse = exports.StreamUpdatesRequest = exports.ProcessResponseRequest = exports.StreamUpdate = exports.RESPONSE_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
|
+
exports.ResponseServiceControllerMethods = ResponseServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
12
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
13
|
+
exports.protobufPackage = "response";
|
|
14
|
+
exports.RESPONSE_PACKAGE_NAME = "response";
|
|
15
|
+
function createBaseStreamUpdate() {
|
|
16
|
+
return { requestId: "", type: "", data: "", chunk: 0, timestamp: "" };
|
|
17
|
+
}
|
|
18
|
+
exports.StreamUpdate = {
|
|
19
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
20
|
+
if (message.requestId !== "") {
|
|
21
|
+
writer.uint32(10).string(message.requestId);
|
|
22
|
+
}
|
|
23
|
+
if (message.type !== "") {
|
|
24
|
+
writer.uint32(18).string(message.type);
|
|
25
|
+
}
|
|
26
|
+
if (message.data !== "") {
|
|
27
|
+
writer.uint32(26).string(message.data);
|
|
28
|
+
}
|
|
29
|
+
if (message.chunk !== 0) {
|
|
30
|
+
writer.uint32(32).int32(message.chunk);
|
|
31
|
+
}
|
|
32
|
+
if (message.timestamp !== "") {
|
|
33
|
+
writer.uint32(42).string(message.timestamp);
|
|
34
|
+
}
|
|
35
|
+
return writer;
|
|
36
|
+
},
|
|
37
|
+
decode(input, length) {
|
|
38
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
39
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
40
|
+
const message = createBaseStreamUpdate();
|
|
41
|
+
while (reader.pos < end) {
|
|
42
|
+
const tag = reader.uint32();
|
|
43
|
+
switch (tag >>> 3) {
|
|
44
|
+
case 1: {
|
|
45
|
+
if (tag !== 10) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
message.requestId = reader.string();
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
case 2: {
|
|
52
|
+
if (tag !== 18) {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
message.type = reader.string();
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
case 3: {
|
|
59
|
+
if (tag !== 26) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
message.data = reader.string();
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
case 4: {
|
|
66
|
+
if (tag !== 32) {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
message.chunk = reader.int32();
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
case 5: {
|
|
73
|
+
if (tag !== 42) {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
message.timestamp = reader.string();
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
reader.skip(tag & 7);
|
|
84
|
+
}
|
|
85
|
+
return message;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
function createBaseProcessResponseRequest() {
|
|
89
|
+
return { correlationId: "", data: "", error: "", isStreamChunk: false };
|
|
90
|
+
}
|
|
91
|
+
exports.ProcessResponseRequest = {
|
|
92
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
93
|
+
if (message.correlationId !== "") {
|
|
94
|
+
writer.uint32(10).string(message.correlationId);
|
|
95
|
+
}
|
|
96
|
+
if (message.data !== "") {
|
|
97
|
+
writer.uint32(18).string(message.data);
|
|
98
|
+
}
|
|
99
|
+
if (message.error !== "") {
|
|
100
|
+
writer.uint32(26).string(message.error);
|
|
101
|
+
}
|
|
102
|
+
if (message.isStreamChunk !== false) {
|
|
103
|
+
writer.uint32(32).bool(message.isStreamChunk);
|
|
104
|
+
}
|
|
105
|
+
return writer;
|
|
106
|
+
},
|
|
107
|
+
decode(input, length) {
|
|
108
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
109
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
110
|
+
const message = createBaseProcessResponseRequest();
|
|
111
|
+
while (reader.pos < end) {
|
|
112
|
+
const tag = reader.uint32();
|
|
113
|
+
switch (tag >>> 3) {
|
|
114
|
+
case 1: {
|
|
115
|
+
if (tag !== 10) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
message.correlationId = reader.string();
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
case 2: {
|
|
122
|
+
if (tag !== 18) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
message.data = reader.string();
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
case 3: {
|
|
129
|
+
if (tag !== 26) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
message.error = reader.string();
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
case 4: {
|
|
136
|
+
if (tag !== 32) {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
message.isStreamChunk = reader.bool();
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
reader.skip(tag & 7);
|
|
147
|
+
}
|
|
148
|
+
return message;
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
function createBaseStreamUpdatesRequest() {
|
|
152
|
+
return { requestId: "" };
|
|
153
|
+
}
|
|
154
|
+
exports.StreamUpdatesRequest = {
|
|
155
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
156
|
+
if (message.requestId !== "") {
|
|
157
|
+
writer.uint32(10).string(message.requestId);
|
|
158
|
+
}
|
|
159
|
+
return writer;
|
|
160
|
+
},
|
|
161
|
+
decode(input, length) {
|
|
162
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
163
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
164
|
+
const message = createBaseStreamUpdatesRequest();
|
|
165
|
+
while (reader.pos < end) {
|
|
166
|
+
const tag = reader.uint32();
|
|
167
|
+
switch (tag >>> 3) {
|
|
168
|
+
case 1: {
|
|
169
|
+
if (tag !== 10) {
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
message.requestId = reader.string();
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
reader.skip(tag & 7);
|
|
180
|
+
}
|
|
181
|
+
return message;
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
function createBaseProcessResponseResponse() {
|
|
185
|
+
return { success: false, error: "" };
|
|
186
|
+
}
|
|
187
|
+
exports.ProcessResponseResponse = {
|
|
188
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
189
|
+
if (message.success !== false) {
|
|
190
|
+
writer.uint32(8).bool(message.success);
|
|
191
|
+
}
|
|
192
|
+
if (message.error !== "") {
|
|
193
|
+
writer.uint32(18).string(message.error);
|
|
194
|
+
}
|
|
195
|
+
return writer;
|
|
196
|
+
},
|
|
197
|
+
decode(input, length) {
|
|
198
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
199
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
200
|
+
const message = createBaseProcessResponseResponse();
|
|
201
|
+
while (reader.pos < end) {
|
|
202
|
+
const tag = reader.uint32();
|
|
203
|
+
switch (tag >>> 3) {
|
|
204
|
+
case 1: {
|
|
205
|
+
if (tag !== 8) {
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
message.success = reader.bool();
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
case 2: {
|
|
212
|
+
if (tag !== 18) {
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
message.error = reader.string();
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
reader.skip(tag & 7);
|
|
223
|
+
}
|
|
224
|
+
return message;
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
function ResponseServiceControllerMethods() {
|
|
228
|
+
return function (constructor) {
|
|
229
|
+
const grpcMethods = ["processResponse", "getStreamUpdates"];
|
|
230
|
+
for (const method of grpcMethods) {
|
|
231
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
232
|
+
(0, microservices_1.GrpcMethod)("ResponseService", method)(constructor.prototype[method], method, descriptor);
|
|
233
|
+
}
|
|
234
|
+
const grpcStreamMethods = [];
|
|
235
|
+
for (const method of grpcStreamMethods) {
|
|
236
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
237
|
+
(0, microservices_1.GrpcStreamMethod)("ResponseService", method)(constructor.prototype[method], method, descriptor);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
exports.RESPONSE_SERVICE_NAME = "ResponseService";
|
|
242
|
+
exports.ResponseServiceService = {
|
|
243
|
+
processResponse: {
|
|
244
|
+
path: "/response.ResponseService/ProcessResponse",
|
|
245
|
+
requestStream: false,
|
|
246
|
+
responseStream: false,
|
|
247
|
+
requestSerialize: (value) => Buffer.from(exports.ProcessResponseRequest.encode(value).finish()),
|
|
248
|
+
requestDeserialize: (value) => exports.ProcessResponseRequest.decode(value),
|
|
249
|
+
responseSerialize: (value) => Buffer.from(exports.ProcessResponseResponse.encode(value).finish()),
|
|
250
|
+
responseDeserialize: (value) => exports.ProcessResponseResponse.decode(value),
|
|
251
|
+
},
|
|
252
|
+
getStreamUpdates: {
|
|
253
|
+
path: "/response.ResponseService/GetStreamUpdates",
|
|
254
|
+
requestStream: false,
|
|
255
|
+
responseStream: true,
|
|
256
|
+
requestSerialize: (value) => Buffer.from(exports.StreamUpdatesRequest.encode(value).finish()),
|
|
257
|
+
requestDeserialize: (value) => exports.StreamUpdatesRequest.decode(value),
|
|
258
|
+
responseSerialize: (value) => Buffer.from(exports.StreamUpdate.encode(value).finish()),
|
|
259
|
+
responseDeserialize: (value) => exports.StreamUpdate.decode(value),
|
|
260
|
+
},
|
|
261
|
+
};
|
package/dist/shared.module.d.ts
CHANGED
|
@@ -28,6 +28,14 @@ export interface SharedModuleOptions {
|
|
|
28
28
|
protoPath: string;
|
|
29
29
|
url: string;
|
|
30
30
|
};
|
|
31
|
+
request?: {
|
|
32
|
+
protoPath: string;
|
|
33
|
+
url: string;
|
|
34
|
+
};
|
|
35
|
+
response?: {
|
|
36
|
+
protoPath: string;
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
31
39
|
}
|
|
32
40
|
export declare class SharedModule {
|
|
33
41
|
private static readonly logger;
|
package/dist/shared.module.js
CHANGED
|
@@ -18,6 +18,8 @@ const ai_client_1 = require("./ai.client");
|
|
|
18
18
|
const storage_client_1 = require("./storage.client");
|
|
19
19
|
const event_client_1 = require("./event.client");
|
|
20
20
|
const key_client_1 = require("./key.client");
|
|
21
|
+
const request_client_1 = require("./request.client");
|
|
22
|
+
const response_client_1 = require("./response.client");
|
|
21
23
|
let SharedModule = SharedModule_1 = class SharedModule {
|
|
22
24
|
static forRoot(options = {}) {
|
|
23
25
|
const clients = [];
|
|
@@ -232,6 +234,66 @@ let SharedModule = SharedModule_1 = class SharedModule {
|
|
|
232
234
|
else {
|
|
233
235
|
providers.push({ provide: key_client_1.KeyClient, useValue: null });
|
|
234
236
|
}
|
|
237
|
+
// REQUEST
|
|
238
|
+
if (options.request) {
|
|
239
|
+
clients.push({
|
|
240
|
+
name: "REQUEST_PACKAGE",
|
|
241
|
+
transport: microservices_1.Transport.GRPC,
|
|
242
|
+
options: {
|
|
243
|
+
package: "request",
|
|
244
|
+
protoPath: (0, path_1.resolve)(process.cwd(), options.request.protoPath),
|
|
245
|
+
url: options.request.url,
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
providers.push({
|
|
249
|
+
provide: request_client_1.RequestClient,
|
|
250
|
+
useFactory: (client) => {
|
|
251
|
+
const svc = new request_client_1.RequestClient(client);
|
|
252
|
+
try {
|
|
253
|
+
svc.onModuleInit();
|
|
254
|
+
SharedModule_1.logger.log("RequestClient initialized successfully");
|
|
255
|
+
}
|
|
256
|
+
catch (err) {
|
|
257
|
+
SharedModule_1.logger.error("RequestClient initialization failed", err);
|
|
258
|
+
}
|
|
259
|
+
return svc;
|
|
260
|
+
},
|
|
261
|
+
inject: ["REQUEST_PACKAGE"],
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
providers.push({ provide: request_client_1.RequestClient, useValue: null });
|
|
266
|
+
}
|
|
267
|
+
// RESPONSE
|
|
268
|
+
if (options.response) {
|
|
269
|
+
clients.push({
|
|
270
|
+
name: "RESPONSE_PACKAGE",
|
|
271
|
+
transport: microservices_1.Transport.GRPC,
|
|
272
|
+
options: {
|
|
273
|
+
package: "response",
|
|
274
|
+
protoPath: (0, path_1.resolve)(process.cwd(), options.response.protoPath),
|
|
275
|
+
url: options.response.url,
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
providers.push({
|
|
279
|
+
provide: response_client_1.ResponseClient,
|
|
280
|
+
useFactory: (client) => {
|
|
281
|
+
const svc = new response_client_1.ResponseClient(client);
|
|
282
|
+
try {
|
|
283
|
+
svc.onModuleInit();
|
|
284
|
+
SharedModule_1.logger.log("ResponseClient initialized successfully");
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
SharedModule_1.logger.error("ResponseClient initialization failed", err);
|
|
288
|
+
}
|
|
289
|
+
return svc;
|
|
290
|
+
},
|
|
291
|
+
inject: ["RESPONSE_PACKAGE"],
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
providers.push({ provide: response_client_1.ResponseClient, useValue: null });
|
|
296
|
+
}
|
|
235
297
|
return {
|
|
236
298
|
module: SharedModule_1,
|
|
237
299
|
imports: clients.length ? [microservices_1.ClientsModule.register(clients)] : [],
|
|
@@ -13,29 +13,29 @@ export interface UploadRequest_MetadataEntry {
|
|
|
13
13
|
key: string;
|
|
14
14
|
value: string;
|
|
15
15
|
}
|
|
16
|
-
export interface
|
|
16
|
+
export interface DownloadRequest {
|
|
17
17
|
fileId: string;
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface DeleteRequest {
|
|
20
|
+
fileId: string;
|
|
21
|
+
}
|
|
22
|
+
export interface UploadResponse {
|
|
20
23
|
fileId: string;
|
|
21
24
|
}
|
|
22
25
|
export interface DownloadResponse {
|
|
23
26
|
content: Uint8Array;
|
|
24
27
|
filename: string;
|
|
25
28
|
}
|
|
26
|
-
export interface DeleteRequest {
|
|
27
|
-
fileId: string;
|
|
28
|
-
}
|
|
29
29
|
export interface DeleteResponse {
|
|
30
30
|
success: boolean;
|
|
31
31
|
}
|
|
32
32
|
export declare const STORAGE_PACKAGE_NAME = "storage";
|
|
33
33
|
export declare const UploadRequest: MessageFns<UploadRequest>;
|
|
34
34
|
export declare const UploadRequest_MetadataEntry: MessageFns<UploadRequest_MetadataEntry>;
|
|
35
|
-
export declare const UploadResponse: MessageFns<UploadResponse>;
|
|
36
35
|
export declare const DownloadRequest: MessageFns<DownloadRequest>;
|
|
37
|
-
export declare const DownloadResponse: MessageFns<DownloadResponse>;
|
|
38
36
|
export declare const DeleteRequest: MessageFns<DeleteRequest>;
|
|
37
|
+
export declare const UploadResponse: MessageFns<UploadResponse>;
|
|
38
|
+
export declare const DownloadResponse: MessageFns<DownloadResponse>;
|
|
39
39
|
export declare const DeleteResponse: MessageFns<DeleteResponse>;
|
|
40
40
|
export interface StorageServiceClient {
|
|
41
41
|
upload(request: UploadRequest, metadata?: Metadata): Observable<UploadResponse>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// protoc v5.28.2
|
|
6
6
|
// source: storage.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.StorageServiceService = exports.STORAGE_SERVICE_NAME = exports.DeleteResponse = exports.
|
|
8
|
+
exports.StorageServiceService = exports.STORAGE_SERVICE_NAME = exports.DeleteResponse = exports.DownloadResponse = exports.UploadResponse = exports.DeleteRequest = exports.DownloadRequest = exports.UploadRequest_MetadataEntry = exports.UploadRequest = exports.STORAGE_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
9
|
exports.StorageServiceControllerMethods = StorageServiceControllerMethods;
|
|
10
10
|
/* eslint-disable */
|
|
11
11
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
@@ -111,10 +111,10 @@ exports.UploadRequest_MetadataEntry = {
|
|
|
111
111
|
return message;
|
|
112
112
|
},
|
|
113
113
|
};
|
|
114
|
-
function
|
|
114
|
+
function createBaseDownloadRequest() {
|
|
115
115
|
return { fileId: "" };
|
|
116
116
|
}
|
|
117
|
-
exports.
|
|
117
|
+
exports.DownloadRequest = {
|
|
118
118
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
119
119
|
if (message.fileId !== "") {
|
|
120
120
|
writer.uint32(10).string(message.fileId);
|
|
@@ -124,7 +124,7 @@ exports.UploadResponse = {
|
|
|
124
124
|
decode(input, length) {
|
|
125
125
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
126
126
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
127
|
-
const message =
|
|
127
|
+
const message = createBaseDownloadRequest();
|
|
128
128
|
while (reader.pos < end) {
|
|
129
129
|
const tag = reader.uint32();
|
|
130
130
|
switch (tag >>> 3) {
|
|
@@ -144,10 +144,10 @@ exports.UploadResponse = {
|
|
|
144
144
|
return message;
|
|
145
145
|
},
|
|
146
146
|
};
|
|
147
|
-
function
|
|
147
|
+
function createBaseDeleteRequest() {
|
|
148
148
|
return { fileId: "" };
|
|
149
149
|
}
|
|
150
|
-
exports.
|
|
150
|
+
exports.DeleteRequest = {
|
|
151
151
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
152
152
|
if (message.fileId !== "") {
|
|
153
153
|
writer.uint32(10).string(message.fileId);
|
|
@@ -157,7 +157,7 @@ exports.DownloadRequest = {
|
|
|
157
157
|
decode(input, length) {
|
|
158
158
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
159
159
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
160
|
-
const message =
|
|
160
|
+
const message = createBaseDeleteRequest();
|
|
161
161
|
while (reader.pos < end) {
|
|
162
162
|
const tag = reader.uint32();
|
|
163
163
|
switch (tag >>> 3) {
|
|
@@ -177,23 +177,20 @@ exports.DownloadRequest = {
|
|
|
177
177
|
return message;
|
|
178
178
|
},
|
|
179
179
|
};
|
|
180
|
-
function
|
|
181
|
-
return {
|
|
180
|
+
function createBaseUploadResponse() {
|
|
181
|
+
return { fileId: "" };
|
|
182
182
|
}
|
|
183
|
-
exports.
|
|
183
|
+
exports.UploadResponse = {
|
|
184
184
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
185
|
-
if (message.
|
|
186
|
-
writer.uint32(10).
|
|
187
|
-
}
|
|
188
|
-
if (message.filename !== "") {
|
|
189
|
-
writer.uint32(18).string(message.filename);
|
|
185
|
+
if (message.fileId !== "") {
|
|
186
|
+
writer.uint32(10).string(message.fileId);
|
|
190
187
|
}
|
|
191
188
|
return writer;
|
|
192
189
|
},
|
|
193
190
|
decode(input, length) {
|
|
194
191
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
195
192
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
196
|
-
const message =
|
|
193
|
+
const message = createBaseUploadResponse();
|
|
197
194
|
while (reader.pos < end) {
|
|
198
195
|
const tag = reader.uint32();
|
|
199
196
|
switch (tag >>> 3) {
|
|
@@ -201,14 +198,7 @@ exports.DownloadResponse = {
|
|
|
201
198
|
if (tag !== 10) {
|
|
202
199
|
break;
|
|
203
200
|
}
|
|
204
|
-
message.
|
|
205
|
-
continue;
|
|
206
|
-
}
|
|
207
|
-
case 2: {
|
|
208
|
-
if (tag !== 18) {
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
message.filename = reader.string();
|
|
201
|
+
message.fileId = reader.string();
|
|
212
202
|
continue;
|
|
213
203
|
}
|
|
214
204
|
}
|
|
@@ -220,20 +210,23 @@ exports.DownloadResponse = {
|
|
|
220
210
|
return message;
|
|
221
211
|
},
|
|
222
212
|
};
|
|
223
|
-
function
|
|
224
|
-
return {
|
|
213
|
+
function createBaseDownloadResponse() {
|
|
214
|
+
return { content: new Uint8Array(0), filename: "" };
|
|
225
215
|
}
|
|
226
|
-
exports.
|
|
216
|
+
exports.DownloadResponse = {
|
|
227
217
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
228
|
-
if (message.
|
|
229
|
-
writer.uint32(10).
|
|
218
|
+
if (message.content.length !== 0) {
|
|
219
|
+
writer.uint32(10).bytes(message.content);
|
|
220
|
+
}
|
|
221
|
+
if (message.filename !== "") {
|
|
222
|
+
writer.uint32(18).string(message.filename);
|
|
230
223
|
}
|
|
231
224
|
return writer;
|
|
232
225
|
},
|
|
233
226
|
decode(input, length) {
|
|
234
227
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
235
228
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
236
|
-
const message =
|
|
229
|
+
const message = createBaseDownloadResponse();
|
|
237
230
|
while (reader.pos < end) {
|
|
238
231
|
const tag = reader.uint32();
|
|
239
232
|
switch (tag >>> 3) {
|
|
@@ -241,7 +234,14 @@ exports.DeleteRequest = {
|
|
|
241
234
|
if (tag !== 10) {
|
|
242
235
|
break;
|
|
243
236
|
}
|
|
244
|
-
message.
|
|
237
|
+
message.content = reader.bytes();
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
case 2: {
|
|
241
|
+
if (tag !== 18) {
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
message.filename = reader.string();
|
|
245
245
|
continue;
|
|
246
246
|
}
|
|
247
247
|
}
|