@milaboratories/pl-client 2.7.13 → 2.8.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.
Files changed (86) hide show
  1. package/dist/core/auth.d.ts.map +1 -1
  2. package/dist/core/cache.d.ts.map +1 -1
  3. package/dist/core/client.d.ts +5 -2
  4. package/dist/core/client.d.ts.map +1 -1
  5. package/dist/core/default_client.d.ts.map +1 -1
  6. package/dist/core/driver.d.ts.map +1 -1
  7. package/dist/core/errors.d.ts.map +1 -1
  8. package/dist/core/final.d.ts.map +1 -1
  9. package/dist/core/ll_client.d.ts +12 -2
  10. package/dist/core/ll_client.d.ts.map +1 -1
  11. package/dist/core/ll_transaction.d.ts.map +1 -1
  12. package/dist/core/transaction.d.ts +1 -1
  13. package/dist/core/transaction.d.ts.map +1 -1
  14. package/dist/core/type_conversion.d.ts.map +1 -1
  15. package/dist/core/types.d.ts +1 -1
  16. package/dist/core/types.d.ts.map +1 -1
  17. package/dist/core/unauth_client.d.ts.map +1 -1
  18. package/dist/helpers/pl.d.ts.map +1 -1
  19. package/dist/helpers/poll.d.ts.map +1 -1
  20. package/dist/helpers/state_helpers.d.ts.map +1 -1
  21. package/dist/helpers/tx_helpers.d.ts.map +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +2361 -2342
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +4 -4
  27. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +1 -1
  28. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +16 -16
  29. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +1 -1
  30. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +8 -8
  31. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +1 -1
  32. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +22 -22
  33. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +1 -1
  34. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +17 -0
  35. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
  36. package/dist/proto/google/api/http.d.ts +89 -89
  37. package/dist/proto/google/api/http.d.ts.map +1 -1
  38. package/dist/proto/google/protobuf/descriptor.d.ts +1151 -1151
  39. package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -1
  40. package/dist/test/test_config.d.ts.map +1 -1
  41. package/dist/util/util.d.ts.map +1 -1
  42. package/package.json +7 -3
  43. package/src/core/auth.ts +3 -3
  44. package/src/core/cache.ts +1 -1
  45. package/src/core/client.ts +63 -59
  46. package/src/core/config.ts +21 -21
  47. package/src/core/default_client.ts +15 -14
  48. package/src/core/driver.ts +4 -4
  49. package/src/core/errors.ts +3 -3
  50. package/src/core/final.ts +7 -4
  51. package/src/core/ll_client.ts +72 -43
  52. package/src/core/ll_transaction.ts +17 -17
  53. package/src/core/stat.ts +2 -2
  54. package/src/core/transaction.ts +93 -95
  55. package/src/core/type_conversion.ts +11 -8
  56. package/src/core/types.ts +25 -26
  57. package/src/core/unauth_client.ts +6 -6
  58. package/src/helpers/pl.ts +8 -7
  59. package/src/helpers/poll.ts +25 -21
  60. package/src/helpers/state_helpers.ts +2 -1
  61. package/src/helpers/tx_helpers.ts +4 -3
  62. package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +1 -1
  63. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +21 -20
  64. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +240 -225
  65. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +1 -1
  66. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +1 -1
  67. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +32 -30
  68. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +388 -364
  69. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +1 -1
  70. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +1 -1
  71. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +1 -1
  72. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +27 -2
  73. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +1 -1
  74. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +1 -1
  75. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +1 -1
  76. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +1 -1
  77. package/src/proto/google/api/http.ts +280 -271
  78. package/src/proto/google/protobuf/any.ts +1 -1
  79. package/src/proto/google/protobuf/descriptor.ts +2952 -2853
  80. package/src/proto/google/protobuf/duration.ts +1 -1
  81. package/src/proto/google/protobuf/empty.ts +1 -1
  82. package/src/proto/google/protobuf/struct.ts +1 -1
  83. package/src/proto/google/protobuf/timestamp.ts +2 -2
  84. package/src/proto/google/protobuf/wrappers.ts +1 -1
  85. package/src/test/test_config.ts +21 -19
  86. package/src/util/util.ts +1 -0
@@ -1,4 +1,4 @@
1
- // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
1
+ // @generated by protobuf-ts 2.9.6 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "google/protobuf/duration.proto" (package "google.protobuf", syntax proto3)
3
3
  // tslint:disable
4
4
  //
@@ -1,4 +1,4 @@
1
- // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
1
+ // @generated by protobuf-ts 2.9.6 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3)
3
3
  // tslint:disable
4
4
  //
@@ -1,4 +1,4 @@
1
- // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
1
+ // @generated by protobuf-ts 2.9.6 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "google/protobuf/struct.proto" (package "google.protobuf", syntax proto3)
3
3
  // tslint:disable
4
4
  //
@@ -1,4 +1,4 @@
1
- // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
1
+ // @generated by protobuf-ts 2.9.6 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
3
3
  // tslint:disable
4
4
  //
@@ -190,7 +190,7 @@ class Timestamp$Type extends MessageType<Timestamp> {
190
190
  const msg = this.create();
191
191
  const ms = date.getTime();
192
192
  msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
193
- msg.nanos = (ms % 1000) * 1000000;
193
+ msg.nanos = ((ms % 1000) + (ms < 0 && ms % 1000 !== 0 ? 1000 : 0)) * 1000000;
194
194
  return msg;
195
195
  }
196
196
  /**
@@ -1,4 +1,4 @@
1
- // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
1
+ // @generated by protobuf-ts 2.9.6 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "google/protobuf/wrappers.proto" (package "google.protobuf", syntax proto3)
3
3
  // tslint:disable
4
4
  //
@@ -1,10 +1,12 @@
1
1
  import * as fs from 'node:fs';
2
2
  import { LLPlClient } from '../core/ll_client';
3
- import { AuthInformation, AuthOps, plAddressToConfig, PlClientConfig } from '../core/config';
3
+ import type { AuthInformation, AuthOps, PlClientConfig } from '../core/config';
4
+ import { plAddressToConfig } from '../core/config';
4
5
  import { UnauthenticatedPlClient } from '../core/unauth_client';
5
6
  import { PlClient } from '../core/client';
6
- import { randomUUID } from 'crypto';
7
- import { NullResourceId, OptionalResourceId, ResourceId, resourceIdToString } from '../core/types';
7
+ import { randomUUID } from 'node:crypto';
8
+ import type { OptionalResourceId } from '../core/types';
9
+ import { NullResourceId, resourceIdToString } from '../core/types';
8
10
  import { inferAuthRefreshTime } from '../core/auth';
9
11
  import * as path from 'node:path';
10
12
 
@@ -28,7 +30,7 @@ function getFullAuthDataFilePath() {
28
30
  export function getTestConfig(): TestConfig {
29
31
  let conf: Partial<TestConfig> = {};
30
32
  if (fs.existsSync(CONFIG_FILE))
31
- conf = JSON.parse(fs.readFileSync(CONFIG_FILE, { encoding: 'utf-8' }));
33
+ conf = JSON.parse(fs.readFileSync(CONFIG_FILE, { encoding: 'utf-8' })) as TestConfig;
32
34
 
33
35
  if (process.env.PL_ADDRESS !== undefined) conf.address = process.env.PL_ADDRESS;
34
36
 
@@ -40,7 +42,7 @@ export function getTestConfig(): TestConfig {
40
42
 
41
43
  if (conf.address === undefined)
42
44
  throw new Error(
43
- `can't resolve platform address (checked ${CONFIG_FILE} file and PL_ADDRESS environment var)`
45
+ `can't resolve platform address (checked ${CONFIG_FILE} file and PL_ADDRESS environment var)`,
44
46
  );
45
47
 
46
48
  return conf as TestConfig;
@@ -63,10 +65,10 @@ function saveAuthInfoCallback(tConf: TestConfig): (authInformation: AuthInformat
63
65
  JSON.stringify({
64
66
  conf: tConf,
65
67
  authInformation,
66
- expiration: inferAuthRefreshTime(authInformation, 24 * 60 * 60)
67
- } as AuthCache)
68
+ expiration: inferAuthRefreshTime(authInformation, 24 * 60 * 60),
69
+ } as AuthCache),
68
70
  ),
69
- 'utf8'
71
+ 'utf8',
70
72
  );
71
73
  fs.renameSync(tmpDst, dst);
72
74
  };
@@ -86,16 +88,16 @@ export async function getTestClientConf(): Promise<{ conf: PlClientConfig; auth:
86
88
  if (fs.existsSync(getFullAuthDataFilePath())) {
87
89
  try {
88
90
  const cache: AuthCache = JSON.parse(
89
- fs.readFileSync(getFullAuthDataFilePath(), { encoding: 'utf-8' })
90
- );
91
+ fs.readFileSync(getFullAuthDataFilePath(), { encoding: 'utf-8' }),
92
+ ) as AuthCache; // TODO runtime validation
91
93
  if (
92
- cache.conf.address === tConf.address &&
93
- cache.conf.test_user === tConf.test_user &&
94
- cache.conf.test_password === tConf.test_password &&
95
- cache.expiration > Date.now()
94
+ cache.conf.address === tConf.address
95
+ && cache.conf.test_user === tConf.test_user
96
+ && cache.conf.test_password === tConf.test_password
97
+ && cache.expiration > Date.now()
96
98
  )
97
99
  authInformation = cache.authInformation;
98
- } catch (e: any) {
100
+ } catch (_e) {
99
101
  // removing cache file on any error
100
102
  fs.rmSync(getFullAuthDataFilePath());
101
103
  }
@@ -109,12 +111,12 @@ export async function getTestClientConf(): Promise<{ conf: PlClientConfig; auth:
109
111
 
110
112
  if (!requireAuth && (tConf.test_user !== undefined || tConf.test_password !== undefined))
111
113
  throw new Error(
112
- `Server require no auth, but test user name or test password are provided via (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`
114
+ `Server require no auth, but test user name or test password are provided via (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`,
113
115
  );
114
116
 
115
117
  if (requireAuth && (tConf.test_user === undefined || tConf.test_password === undefined))
116
118
  throw new Error(
117
- `No auth information found in config (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`
119
+ `No auth information found in config (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`,
118
120
  );
119
121
 
120
122
  if (authInformation === undefined) {
@@ -132,8 +134,8 @@ export async function getTestClientConf(): Promise<{ conf: PlClientConfig; auth:
132
134
  authInformation,
133
135
  onUpdate: saveAuthInfoCallback(tConf),
134
136
  onAuthError: cleanAuthInfoCallback,
135
- onUpdateError: cleanAuthInfoCallback
136
- }
137
+ onUpdateError: cleanAuthInfoCallback,
138
+ },
137
139
  };
138
140
  }
139
141
 
package/src/util/util.ts CHANGED
@@ -5,5 +5,6 @@ function isArrayBufferOrView(value: unknown): value is ArrayBufferLike {
5
5
  export function toBytes(value: string | Uint8Array): Uint8Array {
6
6
  if (typeof value === 'string') return Buffer.from(value);
7
7
  else if (isArrayBufferOrView(value)) return value;
8
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
8
9
  else throw new Error(`Unexpected type: ${value}`);
9
10
  }