@milaboratories/pl-client 2.7.13 → 2.7.14

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 (116) 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 +1 -1
  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.map +1 -1
  10. package/dist/core/ll_transaction.d.ts.map +1 -1
  11. package/dist/core/transaction.d.ts +1 -1
  12. package/dist/core/transaction.d.ts.map +1 -1
  13. package/dist/core/type_conversion.d.ts.map +1 -1
  14. package/dist/core/types.d.ts +1 -1
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/core/unauth_client.d.ts.map +1 -1
  17. package/dist/helpers/pl.d.ts.map +1 -1
  18. package/dist/helpers/poll.d.ts.map +1 -1
  19. package/dist/helpers/state_helpers.d.ts.map +1 -1
  20. package/dist/helpers/tx_helpers.d.ts.map +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +4069 -4075
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +15 -15
  26. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +1 -1
  27. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +4 -4
  28. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +1 -1
  29. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +16 -16
  30. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +1 -1
  31. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +4 -4
  32. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +1 -1
  33. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +59 -59
  34. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +1 -1
  35. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +8 -8
  36. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +1 -1
  37. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +22 -22
  38. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +1 -1
  39. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +72 -72
  40. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +1 -1
  41. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +152 -152
  42. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +1 -1
  43. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +156 -156
  44. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -1
  45. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +773 -773
  46. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
  47. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +163 -163
  48. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -1
  49. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +22 -22
  50. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -1
  51. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +32 -32
  52. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +1 -1
  53. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +78 -78
  54. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +1 -1
  55. package/dist/proto/google/api/http.d.ts +89 -89
  56. package/dist/proto/google/api/http.d.ts.map +1 -1
  57. package/dist/proto/google/protobuf/any.d.ts +52 -52
  58. package/dist/proto/google/protobuf/any.d.ts.map +1 -1
  59. package/dist/proto/google/protobuf/descriptor.d.ts +1151 -1151
  60. package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -1
  61. package/dist/proto/google/protobuf/duration.d.ts +19 -19
  62. package/dist/proto/google/protobuf/duration.d.ts.map +1 -1
  63. package/dist/proto/google/protobuf/empty.d.ts.map +1 -1
  64. package/dist/proto/google/protobuf/struct.d.ts +56 -56
  65. package/dist/proto/google/protobuf/struct.d.ts.map +1 -1
  66. package/dist/proto/google/protobuf/timestamp.d.ts +25 -25
  67. package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -1
  68. package/dist/proto/google/protobuf/wrappers.d.ts +72 -72
  69. package/dist/proto/google/protobuf/wrappers.d.ts.map +1 -1
  70. package/dist/test/test_config.d.ts.map +1 -1
  71. package/dist/util/util.d.ts.map +1 -1
  72. package/package.json +7 -3
  73. package/src/core/auth.ts +3 -3
  74. package/src/core/cache.ts +1 -1
  75. package/src/core/client.ts +39 -31
  76. package/src/core/config.ts +21 -21
  77. package/src/core/default_client.ts +15 -14
  78. package/src/core/driver.ts +4 -4
  79. package/src/core/errors.ts +3 -3
  80. package/src/core/final.ts +7 -4
  81. package/src/core/ll_client.ts +31 -27
  82. package/src/core/ll_transaction.ts +17 -17
  83. package/src/core/stat.ts +2 -2
  84. package/src/core/transaction.ts +93 -95
  85. package/src/core/type_conversion.ts +11 -8
  86. package/src/core/types.ts +25 -26
  87. package/src/core/unauth_client.ts +6 -6
  88. package/src/helpers/pl.ts +8 -7
  89. package/src/helpers/poll.ts +25 -21
  90. package/src/helpers/state_helpers.ts +2 -1
  91. package/src/helpers/tx_helpers.ts +4 -3
  92. package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +74 -71
  93. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +21 -20
  94. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +240 -225
  95. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +21 -20
  96. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +290 -275
  97. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +32 -30
  98. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +388 -364
  99. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +58 -53
  100. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +490 -469
  101. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +262 -237
  102. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +11751 -11032
  103. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +1155 -1114
  104. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +131 -125
  105. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +203 -200
  106. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +559 -540
  107. package/src/proto/google/api/http.ts +280 -271
  108. package/src/proto/google/protobuf/any.ts +149 -139
  109. package/src/proto/google/protobuf/descriptor.ts +2952 -2853
  110. package/src/proto/google/protobuf/duration.ts +107 -102
  111. package/src/proto/google/protobuf/empty.ts +41 -38
  112. package/src/proto/google/protobuf/struct.ts +336 -322
  113. package/src/proto/google/protobuf/timestamp.ts +131 -123
  114. package/src/proto/google/protobuf/wrappers.ts +536 -491
  115. package/src/test/test_config.ts +21 -19
  116. package/src/util/util.ts +1 -0
@@ -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
  }