@milaboratories/pl-client 2.6.2 → 2.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-client",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "description": "New TS/JS client for Platform API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "./src/**/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@grpc/grpc-js": "^1.12.2",
20
+ "@grpc/grpc-js": "^1.12.4",
21
21
  "@protobuf-ts/grpc-transport": "^2.9.4",
22
22
  "@protobuf-ts/runtime": "^2.9.4",
23
23
  "@protobuf-ts/runtime-rpc": "^2.9.4",
@@ -27,10 +27,11 @@
27
27
  "https-proxy-agent": "^7.0.5",
28
28
  "cacheable-lookup": "^6.1.0",
29
29
  "long": "^5.2.3",
30
- "undici": "^6.21.0",
30
+ "undici": "^7.1.0",
31
31
  "utility-types": "^3.11.0",
32
32
  "yaml": "^2.6.1",
33
- "@milaboratories/ts-helpers": "^1.1.1"
33
+ "@milaboratories/ts-helpers": "^1.1.3",
34
+ "@milaboratories/pl-http": "^1.0.1"
34
35
  },
35
36
  "devDependencies": {
36
37
  "typescript": "~5.5.4",
@@ -16,10 +16,9 @@ import {
16
16
  import { GrpcOptions, GrpcTransport } from '@protobuf-ts/grpc-transport';
17
17
  import { LLPlTransaction } from './ll_transaction';
18
18
  import { parsePlJwt } from '../util/pl';
19
- import { Agent, Client, Dispatcher, ProxyAgent } from 'undici';
19
+ import { Dispatcher } from 'undici';
20
20
  import { inferAuthRefreshTime } from './auth';
21
- import { Resolver } from 'node:dns/promises';
22
- import CacheableLookup from 'cacheable-lookup';
21
+ import { defaultHttpDispatcher } from '@milaboratories/pl-http';
23
22
 
24
23
  export interface PlCallOps {
25
24
  timeout?: number;
@@ -102,24 +101,7 @@ export class LLPlClient {
102
101
  this.grpcTransport = new GrpcTransport(grpcOptions);
103
102
  this.grpcPl = new PlatformClient(this.grpcTransport);
104
103
 
105
- const cacheableLookup = new CacheableLookup({ resolver: new Resolver({ tries: 10 }) });
106
-
107
- const httpOptions: Client.Options = {
108
- // allowH2: true,
109
- headersTimeout: 5e3,
110
- keepAliveTimeout: 3e3,
111
- keepAliveMaxTimeout: 60e3,
112
- maxRedirections: 6,
113
- connect: {
114
- // bug in undici typings
115
- lookup: cacheableLookup.lookup.bind(cacheableLookup) as any
116
- }
117
- };
118
-
119
- // setting up http(s)
120
- if (this.conf.httpProxy !== undefined)
121
- this.httpDispatcher = new ProxyAgent({ uri: this.conf.httpProxy, ...httpOptions });
122
- else this.httpDispatcher = new Agent(httpOptions);
104
+ this.httpDispatcher = defaultHttpDispatcher();
123
105
 
124
106
  if (statusListener !== undefined) {
125
107
  this.statusListener = statusListener;
@@ -232,8 +214,7 @@ export class LLPlClient {
232
214
  createTx(rw: boolean, ops: PlCallOps = {}): LLPlTransaction {
233
215
  return new LLPlTransaction((abortSignal) => {
234
216
  let totalAbortSignal = abortSignal;
235
- if (ops.abortSignal)
236
- totalAbortSignal = AbortSignal.any([totalAbortSignal, ops.abortSignal]);
217
+ if (ops.abortSignal) totalAbortSignal = AbortSignal.any([totalAbortSignal, ops.abortSignal]);
237
218
  return this.grpcPl.tx({
238
219
  abort: totalAbortSignal,
239
220
  timeout: