@milaboratories/pl-client 2.16.11 → 2.16.13

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.
Files changed (54) hide show
  1. package/dist/core/driver.cjs +1 -1
  2. package/dist/core/driver.cjs.map +1 -1
  3. package/dist/core/driver.js +1 -1
  4. package/dist/core/driver.js.map +1 -1
  5. package/dist/core/errors.cjs +2 -0
  6. package/dist/core/errors.cjs.map +1 -1
  7. package/dist/core/errors.d.ts.map +1 -1
  8. package/dist/core/errors.js +2 -0
  9. package/dist/core/errors.js.map +1 -1
  10. package/dist/core/ll_client.cjs +32 -9
  11. package/dist/core/ll_client.cjs.map +1 -1
  12. package/dist/core/ll_client.d.ts.map +1 -1
  13. package/dist/core/ll_client.js +32 -9
  14. package/dist/core/ll_client.js.map +1 -1
  15. package/dist/core/ll_transaction.cjs +10 -0
  16. package/dist/core/ll_transaction.cjs.map +1 -1
  17. package/dist/core/ll_transaction.d.ts +1 -0
  18. package/dist/core/ll_transaction.d.ts.map +1 -1
  19. package/dist/core/ll_transaction.js +10 -0
  20. package/dist/core/ll_transaction.js.map +1 -1
  21. package/dist/core/websocket_stream.cjs +330 -0
  22. package/dist/core/websocket_stream.cjs.map +1 -0
  23. package/dist/core/websocket_stream.d.ts +67 -0
  24. package/dist/core/websocket_stream.d.ts.map +1 -0
  25. package/dist/core/websocket_stream.js +328 -0
  26. package/dist/core/websocket_stream.js.map +1 -0
  27. package/dist/helpers/retry_strategy.cjs +92 -0
  28. package/dist/helpers/retry_strategy.cjs.map +1 -0
  29. package/dist/helpers/retry_strategy.d.ts +24 -0
  30. package/dist/helpers/retry_strategy.d.ts.map +1 -0
  31. package/dist/helpers/retry_strategy.js +89 -0
  32. package/dist/helpers/retry_strategy.js.map +1 -0
  33. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +136 -0
  34. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -1
  35. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +75 -1
  36. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
  37. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js +135 -1
  38. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -1
  39. package/dist/proto-rest/index.cjs +16 -2
  40. package/dist/proto-rest/index.cjs.map +1 -1
  41. package/dist/proto-rest/index.d.ts.map +1 -1
  42. package/dist/proto-rest/index.js +16 -2
  43. package/dist/proto-rest/index.js.map +1 -1
  44. package/package.json +6 -6
  45. package/src/core/driver.ts +1 -1
  46. package/src/core/errors.ts +1 -0
  47. package/src/core/ll_client.ts +42 -9
  48. package/src/core/ll_transaction.test.ts +18 -0
  49. package/src/core/ll_transaction.ts +12 -0
  50. package/src/core/websocket_stream.test.ts +423 -0
  51. package/src/core/websocket_stream.ts +400 -0
  52. package/src/helpers/retry_strategy.ts +123 -0
  53. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.ts +179 -1
  54. package/src/proto-rest/index.ts +17 -2
@@ -33,8 +33,11 @@ import { Status } from "../../../../googleapis/googleapis/google/rpc/status";
33
33
  * - client reads server responses for each messages sent. Client can batch
34
34
  * writes and reads: e.g. send 3 messages, read 2 responses, send one
35
35
  * more, read 2;
36
- * - to finish communication client sends 'commit' message and reads last
36
+ * - to finish communication client sends 'commit' or 'discard' message and reads last
37
37
  * response;
38
+ * - to make server interrupt communication, client sends 'stream_close' message and reads to the last
39
+ * server response. This allows graceful stream close, waiting for all queued server responses
40
+ * to be sent before closing the stream.
38
41
  *
39
42
  * Detailed description of the process.
40
43
  *
@@ -111,6 +114,10 @@ import { Status } from "../../../../googleapis/googleapis/google/rpc/status";
111
114
  * - server stops reading client stream and does the commit/discard action.
112
115
  * - once transaction is closed, server sends the result to client and
113
116
  * closes server stream.
117
+ * - client stream reading may be interrupted by special 'stream_close' message, which
118
+ * causes transaction automatic discard and does not produce additional reply message.
119
+ * This 'stream_close' message also does not require any 'request_id' value and does not
120
+ * produce any response from server side.
114
121
  *
115
122
  * At this point the transaction over gRPC is considered as finalized, all
116
123
  * local IDs generated within the transaction are no longer valid.
@@ -165,6 +172,22 @@ export interface TxAPI_ClientMessage {
165
172
  * @generated from protobuf field: MiLaboratories.PL.API.TxAPI.Discard.Request tx_discard = 13
166
173
  */
167
174
  txDiscard: TxAPI_Discard_Request;
175
+ } | {
176
+ oneofKind: "streamClose";
177
+ /**
178
+ * Interrupt the transaction network stream on server side.
179
+ *
180
+ * This allows to gracefully close network connection and discard the associated transaction,
181
+ * ensuring all pending server responses are sent to the client before closing.
182
+ * We use this in RO transactions to imitate the feature of 'half-open' connection
183
+ * available in pure gRPC, when we work with WebSockets.
184
+ * Pure gRPC uses 'end of client messages stream' as a criteria for graceful discard.
185
+ * Pure WebSocket does not allow this, breaking entire connection at once. stream_close helps to get
186
+ * behaviour as we have for gRPC.
187
+ *
188
+ * @generated from protobuf field: MiLaboratories.PL.API.TxAPI.CloseStream.Request stream_close = 14
189
+ */
190
+ streamClose: TxAPI_CloseStream_Request;
168
191
  } | {
169
192
  oneofKind: "resourceCreateRoot";
170
193
  /**
@@ -529,6 +552,12 @@ export interface TxAPI_ServerMessage {
529
552
  * @generated from protobuf field: MiLaboratories.PL.API.TxAPI.Discard.Response tx_discard = 13
530
553
  */
531
554
  txDiscard: TxAPI_Discard_Response;
555
+ } | {
556
+ oneofKind: "streamClose";
557
+ /**
558
+ * @generated from protobuf field: MiLaboratories.PL.API.TxAPI.CloseStream.Response stream_close = 14
559
+ */
560
+ streamClose: TxAPI_CloseStream_Response;
532
561
  } | {
533
562
  oneofKind: "resourceCreateRoot";
534
563
  /**
@@ -973,6 +1002,21 @@ export interface TxAPI_Discard_Request {
973
1002
  */
974
1003
  export interface TxAPI_Discard_Response {
975
1004
  }
1005
+ /**
1006
+ * @generated from protobuf message MiLaboratories.PL.API.TxAPI.CloseStream
1007
+ */
1008
+ export interface TxAPI_CloseStream {
1009
+ }
1010
+ /**
1011
+ * @generated from protobuf message MiLaboratories.PL.API.TxAPI.CloseStream.Request
1012
+ */
1013
+ export interface TxAPI_CloseStream_Request {
1014
+ }
1015
+ /**
1016
+ * @generated from protobuf message MiLaboratories.PL.API.TxAPI.CloseStream.Response
1017
+ */
1018
+ export interface TxAPI_CloseStream_Response {
1019
+ }
976
1020
  /**
977
1021
  * @generated from protobuf message MiLaboratories.PL.API.TxAPI.Sync
978
1022
  */
@@ -3228,6 +3272,36 @@ declare class TxAPI_Discard_Response$Type extends MessageType<TxAPI_Discard_Resp
3228
3272
  * @generated MessageType for protobuf message MiLaboratories.PL.API.TxAPI.Discard.Response
3229
3273
  */
3230
3274
  export declare const TxAPI_Discard_Response: TxAPI_Discard_Response$Type;
3275
+ declare class TxAPI_CloseStream$Type extends MessageType<TxAPI_CloseStream> {
3276
+ constructor();
3277
+ create(value?: PartialMessage<TxAPI_CloseStream>): TxAPI_CloseStream;
3278
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TxAPI_CloseStream): TxAPI_CloseStream;
3279
+ internalBinaryWrite(message: TxAPI_CloseStream, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
3280
+ }
3281
+ /**
3282
+ * @generated MessageType for protobuf message MiLaboratories.PL.API.TxAPI.CloseStream
3283
+ */
3284
+ export declare const TxAPI_CloseStream: TxAPI_CloseStream$Type;
3285
+ declare class TxAPI_CloseStream_Request$Type extends MessageType<TxAPI_CloseStream_Request> {
3286
+ constructor();
3287
+ create(value?: PartialMessage<TxAPI_CloseStream_Request>): TxAPI_CloseStream_Request;
3288
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TxAPI_CloseStream_Request): TxAPI_CloseStream_Request;
3289
+ internalBinaryWrite(message: TxAPI_CloseStream_Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
3290
+ }
3291
+ /**
3292
+ * @generated MessageType for protobuf message MiLaboratories.PL.API.TxAPI.CloseStream.Request
3293
+ */
3294
+ export declare const TxAPI_CloseStream_Request: TxAPI_CloseStream_Request$Type;
3295
+ declare class TxAPI_CloseStream_Response$Type extends MessageType<TxAPI_CloseStream_Response> {
3296
+ constructor();
3297
+ create(value?: PartialMessage<TxAPI_CloseStream_Response>): TxAPI_CloseStream_Response;
3298
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TxAPI_CloseStream_Response): TxAPI_CloseStream_Response;
3299
+ internalBinaryWrite(message: TxAPI_CloseStream_Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
3300
+ }
3301
+ /**
3302
+ * @generated MessageType for protobuf message MiLaboratories.PL.API.TxAPI.CloseStream.Response
3303
+ */
3304
+ export declare const TxAPI_CloseStream_Response: TxAPI_CloseStream_Response$Type;
3231
3305
  declare class TxAPI_Sync$Type extends MessageType<TxAPI_Sync> {
3232
3306
  constructor();
3233
3307
  create(value?: PartialMessage<TxAPI_Sync>): TxAPI_Sync;