@milaboratories/pl-client 2.7.12 → 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.
- package/dist/core/auth.d.ts.map +1 -1
- package/dist/core/cache.d.ts.map +1 -1
- package/dist/core/client.d.ts +1 -1
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/default_client.d.ts.map +1 -1
- package/dist/core/driver.d.ts.map +1 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/final.d.ts.map +1 -1
- package/dist/core/ll_client.d.ts.map +1 -1
- package/dist/core/ll_transaction.d.ts.map +1 -1
- package/dist/core/transaction.d.ts +1 -1
- package/dist/core/transaction.d.ts.map +1 -1
- package/dist/core/type_conversion.d.ts.map +1 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/unauth_client.d.ts.map +1 -1
- package/dist/helpers/pl.d.ts.map +1 -1
- package/dist/helpers/poll.d.ts.map +1 -1
- package/dist/helpers/state_helpers.d.ts.map +1 -1
- package/dist/helpers/tx_helpers.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4069 -4075
- package/dist/index.mjs.map +1 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +15 -15
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +4 -4
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +16 -16
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +4 -4
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +59 -59
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +8 -8
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +22 -22
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +72 -72
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +152 -152
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +156 -156
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +773 -773
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +163 -163
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +22 -22
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +32 -32
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +78 -78
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +1 -1
- package/dist/proto/google/api/http.d.ts +89 -89
- package/dist/proto/google/api/http.d.ts.map +1 -1
- package/dist/proto/google/protobuf/any.d.ts +52 -52
- package/dist/proto/google/protobuf/any.d.ts.map +1 -1
- package/dist/proto/google/protobuf/descriptor.d.ts +1151 -1151
- package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -1
- package/dist/proto/google/protobuf/duration.d.ts +19 -19
- package/dist/proto/google/protobuf/duration.d.ts.map +1 -1
- package/dist/proto/google/protobuf/empty.d.ts.map +1 -1
- package/dist/proto/google/protobuf/struct.d.ts +56 -56
- package/dist/proto/google/protobuf/struct.d.ts.map +1 -1
- package/dist/proto/google/protobuf/timestamp.d.ts +25 -25
- package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -1
- package/dist/proto/google/protobuf/wrappers.d.ts +72 -72
- package/dist/proto/google/protobuf/wrappers.d.ts.map +1 -1
- package/dist/test/test_config.d.ts.map +1 -1
- package/dist/util/util.d.ts.map +1 -1
- package/package.json +17 -13
- package/src/core/auth.ts +3 -3
- package/src/core/cache.ts +1 -1
- package/src/core/client.ts +39 -31
- package/src/core/config.ts +21 -21
- package/src/core/default_client.ts +15 -14
- package/src/core/driver.ts +4 -4
- package/src/core/errors.ts +3 -3
- package/src/core/final.ts +7 -4
- package/src/core/ll_client.ts +31 -27
- package/src/core/ll_transaction.ts +17 -17
- package/src/core/stat.ts +2 -2
- package/src/core/transaction.ts +93 -95
- package/src/core/type_conversion.ts +11 -8
- package/src/core/types.ts +25 -26
- package/src/core/unauth_client.ts +6 -6
- package/src/helpers/pl.ts +8 -7
- package/src/helpers/poll.ts +25 -21
- package/src/helpers/state_helpers.ts +2 -1
- package/src/helpers/tx_helpers.ts +4 -3
- package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +74 -71
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +21 -20
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +240 -225
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +21 -20
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +290 -275
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +32 -30
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +388 -364
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +58 -53
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +490 -469
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +262 -237
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +11751 -11032
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +1155 -1114
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +131 -125
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +203 -200
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +559 -540
- package/src/proto/google/api/http.ts +280 -271
- package/src/proto/google/protobuf/any.ts +149 -139
- package/src/proto/google/protobuf/descriptor.ts +2952 -2853
- package/src/proto/google/protobuf/duration.ts +107 -102
- package/src/proto/google/protobuf/empty.ts +41 -38
- package/src/proto/google/protobuf/struct.ts +336 -322
- package/src/proto/google/protobuf/timestamp.ts +131 -123
- package/src/proto/google/protobuf/wrappers.ts +536 -491
- package/src/test/test_config.ts +21 -19
- package/src/util/util.ts +1 -0
package/src/test/test_config.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import { LLPlClient } from '../core/ll_client';
|
|
3
|
-
import { AuthInformation, AuthOps,
|
|
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 {
|
|
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 (
|
|
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
|
}
|