@milaboratories/pl-client 2.17.7 → 2.17.8

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 (274) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +43 -0
  2. package/dist/_virtual/_rolldown/runtime.js +18 -0
  3. package/dist/core/PromiseTracker.cjs +33 -33
  4. package/dist/core/PromiseTracker.cjs.map +1 -1
  5. package/dist/core/PromiseTracker.d.ts +10 -7
  6. package/dist/core/PromiseTracker.js +33 -31
  7. package/dist/core/PromiseTracker.js.map +1 -1
  8. package/dist/core/StatefulPromise.cjs +60 -61
  9. package/dist/core/StatefulPromise.cjs.map +1 -1
  10. package/dist/core/StatefulPromise.js +60 -60
  11. package/dist/core/StatefulPromise.js.map +1 -1
  12. package/dist/core/abstract_stream.d.ts +18 -15
  13. package/dist/core/advisory_locks.cjs +42 -49
  14. package/dist/core/advisory_locks.cjs.map +1 -1
  15. package/dist/core/advisory_locks.js +42 -48
  16. package/dist/core/advisory_locks.js.map +1 -1
  17. package/dist/core/auth.cjs +10 -15
  18. package/dist/core/auth.cjs.map +1 -1
  19. package/dist/core/auth.d.ts +7 -3
  20. package/dist/core/auth.js +10 -13
  21. package/dist/core/auth.js.map +1 -1
  22. package/dist/core/cache.d.ts +11 -7
  23. package/dist/core/client.cjs +255 -306
  24. package/dist/core/client.cjs.map +1 -1
  25. package/dist/core/client.d.ts +72 -68
  26. package/dist/core/client.js +253 -285
  27. package/dist/core/client.js.map +1 -1
  28. package/dist/core/config.cjs +81 -99
  29. package/dist/core/config.cjs.map +1 -1
  30. package/dist/core/config.d.ts +93 -90
  31. package/dist/core/config.js +81 -98
  32. package/dist/core/config.js.map +1 -1
  33. package/dist/core/default_client.cjs +84 -125
  34. package/dist/core/default_client.cjs.map +1 -1
  35. package/dist/core/default_client.d.ts +9 -6
  36. package/dist/core/default_client.js +78 -103
  37. package/dist/core/default_client.js.map +1 -1
  38. package/dist/core/driver.cjs +12 -16
  39. package/dist/core/driver.cjs.map +1 -1
  40. package/dist/core/driver.d.ts +18 -14
  41. package/dist/core/driver.js +12 -15
  42. package/dist/core/driver.js.map +1 -1
  43. package/dist/core/error_resource.cjs +5 -4
  44. package/dist/core/error_resource.cjs.map +1 -1
  45. package/dist/core/error_resource.js +5 -3
  46. package/dist/core/error_resource.js.map +1 -1
  47. package/dist/core/errors.cjs +104 -140
  48. package/dist/core/errors.cjs.map +1 -1
  49. package/dist/core/errors.d.ts +34 -30
  50. package/dist/core/errors.js +102 -137
  51. package/dist/core/errors.js.map +1 -1
  52. package/dist/core/final.cjs +63 -89
  53. package/dist/core/final.cjs.map +1 -1
  54. package/dist/core/final.d.ts +8 -4
  55. package/dist/core/final.js +63 -87
  56. package/dist/core/final.js.map +1 -1
  57. package/dist/core/ll_client.cjs +416 -521
  58. package/dist/core/ll_client.cjs.map +1 -1
  59. package/dist/core/ll_client.d.ts +100 -97
  60. package/dist/core/ll_client.js +415 -519
  61. package/dist/core/ll_client.js.map +1 -1
  62. package/dist/core/ll_transaction.cjs +206 -240
  63. package/dist/core/ll_transaction.cjs.map +1 -1
  64. package/dist/core/ll_transaction.d.ts +50 -52
  65. package/dist/core/ll_transaction.js +205 -238
  66. package/dist/core/ll_transaction.js.map +1 -1
  67. package/dist/core/stat.cjs +64 -63
  68. package/dist/core/stat.cjs.map +1 -1
  69. package/dist/core/stat.d.ts +35 -36
  70. package/dist/core/stat.js +64 -62
  71. package/dist/core/stat.js.map +1 -1
  72. package/dist/core/transaction.cjs +613 -650
  73. package/dist/core/transaction.cjs.map +1 -1
  74. package/dist/core/transaction.d.ts +165 -162
  75. package/dist/core/transaction.js +612 -648
  76. package/dist/core/transaction.js.map +1 -1
  77. package/dist/core/type_conversion.cjs +62 -83
  78. package/dist/core/type_conversion.cjs.map +1 -1
  79. package/dist/core/type_conversion.js +61 -81
  80. package/dist/core/type_conversion.js.map +1 -1
  81. package/dist/core/types.cjs +56 -86
  82. package/dist/core/types.cjs.map +1 -1
  83. package/dist/core/types.d.ts +63 -62
  84. package/dist/core/types.js +54 -83
  85. package/dist/core/types.js.map +1 -1
  86. package/dist/core/unauth_client.cjs +35 -41
  87. package/dist/core/unauth_client.cjs.map +1 -1
  88. package/dist/core/unauth_client.d.ts +18 -14
  89. package/dist/core/unauth_client.js +34 -39
  90. package/dist/core/unauth_client.js.map +1 -1
  91. package/dist/core/websocket_stream.cjs +277 -349
  92. package/dist/core/websocket_stream.cjs.map +1 -1
  93. package/dist/core/websocket_stream.js +275 -347
  94. package/dist/core/websocket_stream.js.map +1 -1
  95. package/dist/core/wire.d.ts +21 -17
  96. package/dist/helpers/pl.cjs +71 -73
  97. package/dist/helpers/pl.cjs.map +1 -1
  98. package/dist/helpers/pl.d.ts +40 -41
  99. package/dist/helpers/pl.js +66 -46
  100. package/dist/helpers/pl.js.map +1 -1
  101. package/dist/helpers/poll.cjs +99 -134
  102. package/dist/helpers/poll.cjs.map +1 -1
  103. package/dist/helpers/poll.d.ts +37 -34
  104. package/dist/helpers/poll.js +97 -113
  105. package/dist/helpers/poll.js.map +1 -1
  106. package/dist/helpers/retry_strategy.cjs +82 -87
  107. package/dist/helpers/retry_strategy.cjs.map +1 -1
  108. package/dist/helpers/retry_strategy.js +83 -86
  109. package/dist/helpers/retry_strategy.js.map +1 -1
  110. package/dist/helpers/tx_helpers.cjs +21 -20
  111. package/dist/helpers/tx_helpers.cjs.map +1 -1
  112. package/dist/helpers/tx_helpers.d.ts +11 -7
  113. package/dist/helpers/tx_helpers.js +20 -18
  114. package/dist/helpers/tx_helpers.js.map +1 -1
  115. package/dist/index.cjs +117 -106
  116. package/dist/index.d.ts +17 -17
  117. package/dist/index.js +17 -19
  118. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.cjs +72 -66
  119. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.cjs.map +1 -1
  120. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.d.ts +35 -37
  121. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.js +71 -64
  122. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.js.map +1 -1
  123. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +12611 -12866
  124. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -1
  125. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +226 -226
  126. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -1
  127. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +281 -330
  128. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +225 -224
  129. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -1
  130. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +2640 -4294
  131. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js +12608 -12706
  132. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -1
  133. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs +1230 -1089
  134. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +1 -1
  135. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +393 -420
  136. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js +1228 -1083
  137. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +1 -1
  138. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs +142 -143
  139. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +1 -1
  140. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +62 -64
  141. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js +140 -141
  142. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +1 -1
  143. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs +572 -487
  144. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +1 -1
  145. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +125 -228
  146. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js +572 -485
  147. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +1 -1
  148. package/dist/proto-grpc/google/protobuf/any.cjs +131 -146
  149. package/dist/proto-grpc/google/protobuf/any.cjs.map +1 -1
  150. package/dist/proto-grpc/google/protobuf/any.d.ts +78 -84
  151. package/dist/proto-grpc/google/protobuf/any.js +130 -144
  152. package/dist/proto-grpc/google/protobuf/any.js.map +1 -1
  153. package/dist/proto-grpc/google/protobuf/duration.cjs +92 -100
  154. package/dist/proto-grpc/google/protobuf/duration.cjs.map +1 -1
  155. package/dist/proto-grpc/google/protobuf/duration.d.ts +38 -43
  156. package/dist/proto-grpc/google/protobuf/duration.js +91 -98
  157. package/dist/proto-grpc/google/protobuf/duration.js.map +1 -1
  158. package/dist/proto-grpc/google/protobuf/timestamp.cjs +117 -128
  159. package/dist/proto-grpc/google/protobuf/timestamp.cjs.map +1 -1
  160. package/dist/proto-grpc/google/protobuf/timestamp.d.ts +50 -55
  161. package/dist/proto-grpc/google/protobuf/timestamp.js +116 -126
  162. package/dist/proto-grpc/google/protobuf/timestamp.js.map +1 -1
  163. package/dist/proto-grpc/google/rpc/code.cjs +223 -238
  164. package/dist/proto-grpc/google/rpc/code.cjs.map +1 -1
  165. package/dist/proto-grpc/google/rpc/code.d.ts +209 -206
  166. package/dist/proto-grpc/google/rpc/code.js +221 -237
  167. package/dist/proto-grpc/google/rpc/code.js.map +1 -1
  168. package/dist/proto-rest/index.cjs +67 -66
  169. package/dist/proto-rest/index.cjs.map +1 -1
  170. package/dist/proto-rest/index.d.ts +24 -18
  171. package/dist/proto-rest/index.js +61 -65
  172. package/dist/proto-rest/index.js.map +1 -1
  173. package/dist/proto-rest/plapi.d.ts +1400 -1477
  174. package/dist/test/tcp-proxy.cjs +100 -126
  175. package/dist/test/tcp-proxy.cjs.map +1 -1
  176. package/dist/test/tcp-proxy.d.ts +17 -13
  177. package/dist/test/tcp-proxy.js +97 -104
  178. package/dist/test/tcp-proxy.js.map +1 -1
  179. package/dist/test/test_config.cjs +145 -194
  180. package/dist/test/test_config.cjs.map +1 -1
  181. package/dist/test/test_config.d.ts +34 -30
  182. package/dist/test/test_config.js +138 -166
  183. package/dist/test/test_config.js.map +1 -1
  184. package/dist/util/pl.cjs +4 -3
  185. package/dist/util/pl.cjs.map +1 -1
  186. package/dist/util/pl.js +4 -2
  187. package/dist/util/pl.js.map +1 -1
  188. package/dist/util/util.cjs +7 -10
  189. package/dist/util/util.cjs.map +1 -1
  190. package/dist/util/util.js +7 -9
  191. package/dist/util/util.js.map +1 -1
  192. package/package.json +8 -8
  193. package/src/core/transaction.ts +123 -133
  194. package/dist/__external/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3/__external/tslib/tslib.es6.cjs +0 -61
  195. package/dist/__external/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3/__external/tslib/tslib.es6.cjs.map +0 -1
  196. package/dist/__external/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3/__external/tslib/tslib.es6.js +0 -58
  197. package/dist/__external/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3/__external/tslib/tslib.es6.js.map +0 -1
  198. package/dist/core/PromiseTracker.d.ts.map +0 -1
  199. package/dist/core/StatefulPromise.d.ts +0 -39
  200. package/dist/core/StatefulPromise.d.ts.map +0 -1
  201. package/dist/core/abstract_stream.d.ts.map +0 -1
  202. package/dist/core/advisory_locks.d.ts +0 -10
  203. package/dist/core/advisory_locks.d.ts.map +0 -1
  204. package/dist/core/auth.d.ts.map +0 -1
  205. package/dist/core/cache.d.ts.map +0 -1
  206. package/dist/core/client.d.ts.map +0 -1
  207. package/dist/core/config.d.ts.map +0 -1
  208. package/dist/core/default_client.d.ts.map +0 -1
  209. package/dist/core/driver.d.ts.map +0 -1
  210. package/dist/core/error_resource.d.ts +0 -6
  211. package/dist/core/error_resource.d.ts.map +0 -1
  212. package/dist/core/errors.d.ts.map +0 -1
  213. package/dist/core/final.d.ts.map +0 -1
  214. package/dist/core/ll_client.d.ts.map +0 -1
  215. package/dist/core/ll_transaction.d.ts.map +0 -1
  216. package/dist/core/stat.d.ts.map +0 -1
  217. package/dist/core/transaction.d.ts.map +0 -1
  218. package/dist/core/type_conversion.d.ts +0 -8
  219. package/dist/core/type_conversion.d.ts.map +0 -1
  220. package/dist/core/types.d.ts.map +0 -1
  221. package/dist/core/unauth_client.d.ts.map +0 -1
  222. package/dist/core/websocket_stream.d.ts +0 -67
  223. package/dist/core/websocket_stream.d.ts.map +0 -1
  224. package/dist/core/wire.d.ts.map +0 -1
  225. package/dist/helpers/pl.d.ts.map +0 -1
  226. package/dist/helpers/poll.d.ts.map +0 -1
  227. package/dist/helpers/retry_strategy.d.ts +0 -24
  228. package/dist/helpers/retry_strategy.d.ts.map +0 -1
  229. package/dist/helpers/state_helpers.d.ts +0 -3
  230. package/dist/helpers/state_helpers.d.ts.map +0 -1
  231. package/dist/helpers/tx_helpers.d.ts.map +0 -1
  232. package/dist/index.cjs.map +0 -1
  233. package/dist/index.d.ts.map +0 -1
  234. package/dist/index.js.map +0 -1
  235. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +0 -1
  236. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +0 -1
  237. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +0 -1
  238. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +0 -1
  239. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +0 -1
  240. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +0 -106
  241. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +0 -1
  242. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +0 -1
  243. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.d.ts +0 -73
  244. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.d.ts.map +0 -1
  245. package/dist/proto-grpc/google/api/http.d.ts +0 -456
  246. package/dist/proto-grpc/google/api/http.d.ts.map +0 -1
  247. package/dist/proto-grpc/google/protobuf/any.d.ts.map +0 -1
  248. package/dist/proto-grpc/google/protobuf/descriptor.d.ts +0 -2340
  249. package/dist/proto-grpc/google/protobuf/descriptor.d.ts.map +0 -1
  250. package/dist/proto-grpc/google/protobuf/duration.d.ts.map +0 -1
  251. package/dist/proto-grpc/google/protobuf/empty.d.ts +0 -32
  252. package/dist/proto-grpc/google/protobuf/empty.d.ts.map +0 -1
  253. package/dist/proto-grpc/google/protobuf/struct.d.ts +0 -187
  254. package/dist/proto-grpc/google/protobuf/struct.d.ts.map +0 -1
  255. package/dist/proto-grpc/google/protobuf/timestamp.d.ts.map +0 -1
  256. package/dist/proto-grpc/google/protobuf/wrappers.d.ts +0 -308
  257. package/dist/proto-grpc/google/protobuf/wrappers.d.ts.map +0 -1
  258. package/dist/proto-grpc/google/rpc/code.d.ts.map +0 -1
  259. package/dist/proto-grpc/google/rpc/error_details.d.ts +0 -654
  260. package/dist/proto-grpc/google/rpc/error_details.d.ts.map +0 -1
  261. package/dist/proto-grpc/google/rpc/http.d.ts +0 -121
  262. package/dist/proto-grpc/google/rpc/http.d.ts.map +0 -1
  263. package/dist/proto-grpc/google/rpc/status.d.ts +0 -55
  264. package/dist/proto-grpc/google/rpc/status.d.ts.map +0 -1
  265. package/dist/proto-rest/index.d.ts.map +0 -1
  266. package/dist/proto-rest/plapi.d.ts.map +0 -1
  267. package/dist/test/tcp-proxy.d.ts.map +0 -1
  268. package/dist/test/test_config.d.ts.map +0 -1
  269. package/dist/util/branding.d.ts +0 -7
  270. package/dist/util/branding.d.ts.map +0 -1
  271. package/dist/util/pl.d.ts +0 -9
  272. package/dist/util/pl.d.ts.map +0 -1
  273. package/dist/util/util.d.ts +0 -2
  274. package/dist/util/util.d.ts.map +0 -1
@@ -1,191 +1,163 @@
1
- import * as fs from 'node:fs';
2
- import { LLPlClient } from '../core/ll_client.js';
3
- import { plAddressToConfig } from '../core/config.js';
4
- import { UnauthenticatedPlClient } from '../core/unauth_client.js';
5
- import { PlClient } from '../core/client.js';
6
- import { randomUUID } from 'node:crypto';
7
- import { NullResourceId, resourceIdToString } from '../core/types.js';
8
- import { inferAuthRefreshTime } from '../core/auth.js';
9
- import * as path from 'node:path';
10
- import { startTcpProxy } from './tcp-proxy.js';
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { NullResourceId, resourceIdToString } from "../core/types.js";
3
+ import { plAddressToConfig } from "../core/config.js";
4
+ import { inferAuthRefreshTime } from "../core/auth.js";
5
+ import { LLPlClient } from "../core/ll_client.js";
6
+ import { PlClient } from "../core/client.js";
7
+ import { UnauthenticatedPlClient } from "../core/unauth_client.js";
8
+ import { startTcpProxy } from "./tcp-proxy.js";
9
+ import { randomUUID } from "node:crypto";
10
+ import * as fs$1 from "node:fs";
11
+ import * as path from "node:path";
11
12
 
13
+ //#region src/test/test_config.ts
14
+ var test_config_exports = /* @__PURE__ */ __exportAll({
15
+ TEST_REQUEST_TIMEOUT: () => TEST_REQUEST_TIMEOUT,
16
+ getTestClient: () => getTestClient,
17
+ getTestClientConf: () => getTestClientConf,
18
+ getTestConfig: () => getTestConfig,
19
+ getTestLLClient: () => getTestLLClient,
20
+ plAddressToTestConfig: () => plAddressToTestConfig,
21
+ withTempRoot: () => withTempRoot
22
+ });
12
23
  const CONFIG_FILE = "test_config.json";
13
- // const AUTH_DATA_FILE = '.test_auth.json';
14
24
  let authDataFilePath;
15
25
  function getFullAuthDataFilePath() {
16
- if (authDataFilePath === undefined)
17
- authDataFilePath = path.resolve(".test_auth.json");
18
- return authDataFilePath;
26
+ if (authDataFilePath === void 0) authDataFilePath = path.resolve(".test_auth.json");
27
+ return authDataFilePath;
19
28
  }
20
29
  function getTestConfig() {
21
- let conf = {};
22
- if (fs.existsSync(CONFIG_FILE))
23
- conf = JSON.parse(fs.readFileSync(CONFIG_FILE, { encoding: "utf-8" }));
24
- if (process.env.PL_ADDRESS !== undefined)
25
- conf.address = process.env.PL_ADDRESS;
26
- if (process.env.PL_TEST_USER !== undefined)
27
- conf.test_user = process.env.PL_TEST_USER;
28
- if (process.env.PL_TEST_PASSWORD !== undefined)
29
- conf.test_password = process.env.PL_TEST_PASSWORD;
30
- if (process.env.PL_TEST_PROXY !== undefined)
31
- conf.test_proxy = process.env.PL_TEST_PROXY;
32
- if (conf.address === undefined)
33
- throw new Error(`can't resolve platform address (checked ${CONFIG_FILE} file and PL_ADDRESS environment var)`);
34
- return conf;
30
+ let conf = {};
31
+ if (fs$1.existsSync(CONFIG_FILE)) conf = JSON.parse(fs$1.readFileSync(CONFIG_FILE, { encoding: "utf-8" }));
32
+ if (process.env.PL_ADDRESS !== void 0) conf.address = process.env.PL_ADDRESS;
33
+ if (process.env.PL_TEST_USER !== void 0) conf.test_user = process.env.PL_TEST_USER;
34
+ if (process.env.PL_TEST_PASSWORD !== void 0) conf.test_password = process.env.PL_TEST_PASSWORD;
35
+ if (process.env.PL_TEST_PROXY !== void 0) conf.test_proxy = process.env.PL_TEST_PROXY;
36
+ if (conf.address === void 0) throw new Error(`can't resolve platform address (checked ${CONFIG_FILE} file and PL_ADDRESS environment var)`);
37
+ return conf;
35
38
  }
36
39
  /** Default request timeout for tests (ms) */
37
40
  const TEST_REQUEST_TIMEOUT = 500;
38
41
  /** Returns PlClientConfig with reduced timeout for tests */
39
42
  function plAddressToTestConfig(address) {
40
- const plConf = plAddressToConfig(address);
41
- plConf.defaultRequestTimeout = TEST_REQUEST_TIMEOUT;
42
- return plConf;
43
+ const plConf = plAddressToConfig(address);
44
+ plConf.defaultRequestTimeout = TEST_REQUEST_TIMEOUT;
45
+ return plConf;
43
46
  }
44
47
  function saveAuthInfoCallback(tConf) {
45
- return (authInformation) => {
46
- const dst = getFullAuthDataFilePath();
47
- const tmpDst = getFullAuthDataFilePath() + randomUUID();
48
- fs.writeFileSync(tmpDst, Buffer.from(JSON.stringify({
49
- conf: tConf,
50
- authInformation,
51
- expiration: inferAuthRefreshTime(authInformation, 24 * 60 * 60),
52
- })), "utf8");
53
- fs.renameSync(tmpDst, dst);
54
- };
48
+ return (authInformation) => {
49
+ const dst = getFullAuthDataFilePath();
50
+ const tmpDst = getFullAuthDataFilePath() + randomUUID();
51
+ fs$1.writeFileSync(tmpDst, Buffer.from(JSON.stringify({
52
+ conf: tConf,
53
+ authInformation,
54
+ expiration: inferAuthRefreshTime(authInformation, 1440 * 60)
55
+ })), "utf8");
56
+ fs$1.renameSync(tmpDst, dst);
57
+ };
55
58
  }
56
59
  const cleanAuthInfoCallback = () => {
57
- console.warn(`Removing: ${getFullAuthDataFilePath()}`);
58
- fs.rmSync(getFullAuthDataFilePath());
60
+ console.warn(`Removing: ${getFullAuthDataFilePath()}`);
61
+ fs$1.rmSync(getFullAuthDataFilePath());
59
62
  };
60
63
  async function getTestClientConf() {
61
- const tConf = getTestConfig();
62
- let authInformation = undefined;
63
- // try recover from cache
64
- if (fs.existsSync(getFullAuthDataFilePath())) {
65
- try {
66
- const cache = JSON.parse(fs.readFileSync(getFullAuthDataFilePath(), { encoding: "utf-8" })); // TODO runtime validation
67
- if (cache.conf.address === tConf.address &&
68
- cache.conf.test_user === tConf.test_user &&
69
- cache.conf.test_password === tConf.test_password &&
70
- cache.expiration > Date.now())
71
- authInformation = cache.authInformation;
72
- }
73
- catch {
74
- // removing cache file on any error
75
- fs.rmSync(getFullAuthDataFilePath());
76
- }
77
- }
78
- const plConf = plAddressToTestConfig(tConf.address);
79
- const uClient = await UnauthenticatedPlClient.build(plConf);
80
- const requireAuth = await uClient.requireAuth();
81
- if (!requireAuth && (tConf.test_user !== undefined || tConf.test_password !== undefined))
82
- throw new Error(`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`);
83
- if (requireAuth && (tConf.test_user === undefined || tConf.test_password === undefined))
84
- throw new Error(`No auth information found in config (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`);
85
- if (authInformation === undefined) {
86
- if (requireAuth)
87
- authInformation = await uClient.login(tConf.test_user, tConf.test_password);
88
- // No authorization is required
89
- else
90
- authInformation = {};
91
- // saving cache
92
- saveAuthInfoCallback(tConf)(authInformation);
93
- }
94
- return {
95
- conf: plConf,
96
- auth: {
97
- authInformation,
98
- onUpdate: saveAuthInfoCallback(tConf),
99
- onAuthError: cleanAuthInfoCallback,
100
- onUpdateError: cleanAuthInfoCallback,
101
- },
102
- };
64
+ const tConf = getTestConfig();
65
+ let authInformation = void 0;
66
+ if (fs$1.existsSync(getFullAuthDataFilePath())) try {
67
+ const cache = JSON.parse(fs$1.readFileSync(getFullAuthDataFilePath(), { encoding: "utf-8" }));
68
+ if (cache.conf.address === tConf.address && cache.conf.test_user === tConf.test_user && cache.conf.test_password === tConf.test_password && cache.expiration > Date.now()) authInformation = cache.authInformation;
69
+ } catch {
70
+ fs$1.rmSync(getFullAuthDataFilePath());
71
+ }
72
+ const plConf = plAddressToTestConfig(tConf.address);
73
+ const uClient = await UnauthenticatedPlClient.build(plConf);
74
+ const requireAuth = await uClient.requireAuth();
75
+ if (!requireAuth && (tConf.test_user !== void 0 || tConf.test_password !== void 0)) throw new Error(`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`);
76
+ if (requireAuth && (tConf.test_user === void 0 || tConf.test_password === void 0)) throw new Error(`No auth information found in config (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`);
77
+ if (authInformation === void 0) {
78
+ if (requireAuth) authInformation = await uClient.login(tConf.test_user, tConf.test_password);
79
+ else authInformation = {};
80
+ saveAuthInfoCallback(tConf)(authInformation);
81
+ }
82
+ return {
83
+ conf: plConf,
84
+ auth: {
85
+ authInformation,
86
+ onUpdate: saveAuthInfoCallback(tConf),
87
+ onAuthError: cleanAuthInfoCallback,
88
+ onUpdateError: cleanAuthInfoCallback
89
+ }
90
+ };
103
91
  }
104
92
  async function getTestLLClient(confOverrides = {}) {
105
- const { conf, auth } = await getTestClientConf();
106
- return await LLPlClient.build({ ...conf, ...confOverrides }, { auth });
93
+ const { conf, auth } = await getTestClientConf();
94
+ return await LLPlClient.build({
95
+ ...conf,
96
+ ...confOverrides
97
+ }, { auth });
107
98
  }
108
99
  async function getTestClient(alternativeRoot, confOverrides = {}) {
109
- const { conf, auth } = await getTestClientConf();
110
- if (alternativeRoot !== undefined && conf.alternativeRoot !== undefined)
111
- throw new Error("test pl address configured with alternative root");
112
- return await PlClient.init({ ...conf, ...confOverrides, alternativeRoot }, auth);
100
+ const { conf, auth } = await getTestClientConf();
101
+ if (alternativeRoot !== void 0 && conf.alternativeRoot !== void 0) throw new Error("test pl address configured with alternative root");
102
+ return await PlClient.init({
103
+ ...conf,
104
+ ...confOverrides,
105
+ alternativeRoot
106
+ }, auth);
113
107
  }
114
108
  async function withTempRoot(body, options = {}) {
115
- const alternativeRoot = `test_${Date.now()}_${randomUUID()}`;
116
- let altRootId = NullResourceId;
117
- // Proxy management
118
- let proxy;
119
- let confOverrides = {};
120
- try {
121
- // Optionally start TCP proxy and rewrite PL_ADDRESS to point to proxy
122
- if (options.viaTcpProxy === true && process.env.PL_ADDRESS) {
123
- try {
124
- const url = new URL(process.env.PL_ADDRESS);
125
- const isHttp = url.protocol === "http:";
126
- const isLocal = url.hostname === "127.0.0.1" || url.hostname === "localhost";
127
- const port = parseInt(url.port);
128
- if (isHttp && isLocal && Number.isFinite(port)) {
129
- proxy = await startTcpProxy({ targetPort: port, latency: options.proxyLatencyMs ?? 0 });
130
- // Override client connection host:port to proxy
131
- confOverrides = { hostAndPort: `127.0.0.1:${proxy.port}` };
132
- }
133
- else {
134
- console.warn("*** skipping proxy-based test, PL_ADDRESS is not localhost", process.env.PL_ADDRESS);
135
- return;
136
- }
137
- }
138
- catch {
139
- // ignore proxy setup errors; tests will run against original address
140
- }
141
- }
142
- const client = await getTestClient(alternativeRoot, confOverrides);
143
- altRootId = client.clientRoot;
144
- try {
145
- const value = await body(client, proxy);
146
- const rawClient = await getTestClient();
147
- try {
148
- await rawClient.deleteAlternativeRoot(alternativeRoot);
149
- }
150
- catch (cleanupErr) {
151
- // Cleanup may fail if test intentionally deleted resources
152
- console.warn(`Failed to clean up alternative root ${alternativeRoot}:`, cleanupErr.message);
153
- }
154
- finally {
155
- // Close the cleanup client to avoid dangling gRPC channels that can cause
156
- // segfaults during process exit
157
- await rawClient.close();
158
- }
159
- return value;
160
- }
161
- finally {
162
- // Close the test client to avoid dangling gRPC channels
163
- await client.close();
164
- }
165
- }
166
- catch (err) {
167
- console.log(`ALTERNATIVE ROOT: ${alternativeRoot} (${resourceIdToString(altRootId)})`);
168
- throw err;
169
- // throw new Error('withTempRoot error: ' + err.message, { cause: err });
170
- }
171
- finally {
172
- // Stop proxy if started
173
- if (proxy) {
174
- try {
175
- await proxy.disconnectAll();
176
- }
177
- catch {
178
- /* ignore */
179
- }
180
- try {
181
- await new Promise((resolve) => proxy.server.close(() => resolve()));
182
- }
183
- catch {
184
- /* ignore */
185
- }
186
- }
187
- }
109
+ const alternativeRoot = `test_${Date.now()}_${randomUUID()}`;
110
+ let altRootId = NullResourceId;
111
+ let proxy;
112
+ let confOverrides = {};
113
+ try {
114
+ if (options.viaTcpProxy === true && process.env.PL_ADDRESS) try {
115
+ const url = new URL(process.env.PL_ADDRESS);
116
+ const isHttp = url.protocol === "http:";
117
+ const isLocal = url.hostname === "127.0.0.1" || url.hostname === "localhost";
118
+ const port = parseInt(url.port);
119
+ if (isHttp && isLocal && Number.isFinite(port)) {
120
+ proxy = await startTcpProxy({
121
+ targetPort: port,
122
+ latency: options.proxyLatencyMs ?? 0
123
+ });
124
+ confOverrides = { hostAndPort: `127.0.0.1:${proxy.port}` };
125
+ } else {
126
+ console.warn("*** skipping proxy-based test, PL_ADDRESS is not localhost", process.env.PL_ADDRESS);
127
+ return;
128
+ }
129
+ } catch {}
130
+ const client = await getTestClient(alternativeRoot, confOverrides);
131
+ altRootId = client.clientRoot;
132
+ try {
133
+ const value = await body(client, proxy);
134
+ const rawClient = await getTestClient();
135
+ try {
136
+ await rawClient.deleteAlternativeRoot(alternativeRoot);
137
+ } catch (cleanupErr) {
138
+ console.warn(`Failed to clean up alternative root ${alternativeRoot}:`, cleanupErr.message);
139
+ } finally {
140
+ await rawClient.close();
141
+ }
142
+ return value;
143
+ } finally {
144
+ await client.close();
145
+ }
146
+ } catch (err) {
147
+ console.log(`ALTERNATIVE ROOT: ${alternativeRoot} (${resourceIdToString(altRootId)})`);
148
+ throw err;
149
+ } finally {
150
+ if (proxy) {
151
+ try {
152
+ await proxy.disconnectAll();
153
+ } catch {}
154
+ try {
155
+ await new Promise((resolve) => proxy.server.close(() => resolve()));
156
+ } catch {}
157
+ }
158
+ }
188
159
  }
189
160
 
190
- export { TEST_REQUEST_TIMEOUT, getTestClient, getTestClientConf, getTestConfig, getTestLLClient, plAddressToTestConfig, withTempRoot };
191
- //# sourceMappingURL=test_config.js.map
161
+ //#endregion
162
+ export { test_config_exports };
163
+ //# sourceMappingURL=test_config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test_config.js","sources":["../../src/test/test_config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport { LLPlClient } from \"../core/ll_client\";\nimport type { AuthInformation, AuthOps, PlClientConfig } from \"../core/config\";\nimport { plAddressToConfig } from \"../core/config\";\nimport { UnauthenticatedPlClient } from \"../core/unauth_client\";\nimport { PlClient } from \"../core/client\";\nimport { randomUUID } from \"node:crypto\";\nimport type { OptionalResourceId } from \"../core/types\";\nimport { NullResourceId, resourceIdToString } from \"../core/types\";\nimport { inferAuthRefreshTime } from \"../core/auth\";\nimport * as path from \"node:path\";\nimport type { TestTcpProxy } from \"./tcp-proxy\";\nimport { startTcpProxy } from \"./tcp-proxy\";\n\nexport { TestTcpProxy };\n\nexport interface TestConfig {\n address: string;\n test_proxy?: string;\n test_user?: string;\n test_password?: string;\n}\n\nconst CONFIG_FILE = \"test_config.json\";\n// const AUTH_DATA_FILE = '.test_auth.json';\n\nlet authDataFilePath: string | undefined;\n\nfunction getFullAuthDataFilePath() {\n if (authDataFilePath === undefined) authDataFilePath = path.resolve(\".test_auth.json\");\n return authDataFilePath;\n}\n\nexport function getTestConfig(): TestConfig {\n let conf: Partial<TestConfig> = {};\n if (fs.existsSync(CONFIG_FILE))\n conf = JSON.parse(fs.readFileSync(CONFIG_FILE, { encoding: \"utf-8\" })) as TestConfig;\n\n if (process.env.PL_ADDRESS !== undefined) conf.address = process.env.PL_ADDRESS;\n\n if (process.env.PL_TEST_USER !== undefined) conf.test_user = process.env.PL_TEST_USER;\n\n if (process.env.PL_TEST_PASSWORD !== undefined) conf.test_password = process.env.PL_TEST_PASSWORD;\n\n if (process.env.PL_TEST_PROXY !== undefined) conf.test_proxy = process.env.PL_TEST_PROXY;\n\n if (conf.address === undefined)\n throw new Error(\n `can't resolve platform address (checked ${CONFIG_FILE} file and PL_ADDRESS environment var)`,\n );\n\n return conf as TestConfig;\n}\n\n/** Default request timeout for tests (ms) */\nexport const TEST_REQUEST_TIMEOUT = 500;\n\n/** Returns PlClientConfig with reduced timeout for tests */\nexport function plAddressToTestConfig(address: string): PlClientConfig {\n const plConf = plAddressToConfig(address);\n plConf.defaultRequestTimeout = TEST_REQUEST_TIMEOUT;\n return plConf;\n}\n\ninterface AuthCache {\n /** To check if config changed */\n conf: TestConfig;\n expiration: number;\n authInformation: AuthInformation;\n}\n\nfunction saveAuthInfoCallback(tConf: TestConfig): (authInformation: AuthInformation) => void {\n return (authInformation) => {\n const dst = getFullAuthDataFilePath();\n const tmpDst = getFullAuthDataFilePath() + randomUUID();\n fs.writeFileSync(\n tmpDst,\n Buffer.from(\n JSON.stringify({\n conf: tConf,\n authInformation,\n expiration: inferAuthRefreshTime(authInformation, 24 * 60 * 60),\n } as AuthCache),\n ),\n \"utf8\",\n );\n fs.renameSync(tmpDst, dst);\n };\n}\n\nconst cleanAuthInfoCallback = () => {\n console.warn(`Removing: ${getFullAuthDataFilePath()}`);\n fs.rmSync(getFullAuthDataFilePath());\n};\n\nexport async function getTestClientConf(): Promise<{ conf: PlClientConfig; auth: AuthOps }> {\n const tConf = getTestConfig();\n\n let authInformation: AuthInformation | undefined = undefined;\n\n // try recover from cache\n if (fs.existsSync(getFullAuthDataFilePath())) {\n try {\n const cache: AuthCache = JSON.parse(\n fs.readFileSync(getFullAuthDataFilePath(), { encoding: \"utf-8\" }),\n ) as AuthCache; // TODO runtime validation\n if (\n cache.conf.address === tConf.address &&\n cache.conf.test_user === tConf.test_user &&\n cache.conf.test_password === tConf.test_password &&\n cache.expiration > Date.now()\n )\n authInformation = cache.authInformation;\n } catch {\n // removing cache file on any error\n fs.rmSync(getFullAuthDataFilePath());\n }\n }\n\n const plConf = plAddressToTestConfig(tConf.address);\n const uClient = await UnauthenticatedPlClient.build(plConf);\n\n const requireAuth = await uClient.requireAuth();\n\n if (!requireAuth && (tConf.test_user !== undefined || tConf.test_password !== undefined))\n throw new Error(\n `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`,\n );\n\n if (requireAuth && (tConf.test_user === undefined || tConf.test_password === undefined))\n throw new Error(\n `No auth information found in config (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`,\n );\n\n if (authInformation === undefined) {\n if (requireAuth) authInformation = await uClient.login(tConf.test_user!, tConf.test_password!);\n // No authorization is required\n else authInformation = {};\n\n // saving cache\n saveAuthInfoCallback(tConf)(authInformation);\n }\n\n return {\n conf: plConf,\n auth: {\n authInformation,\n onUpdate: saveAuthInfoCallback(tConf),\n onAuthError: cleanAuthInfoCallback,\n onUpdateError: cleanAuthInfoCallback,\n },\n };\n}\n\nexport async function getTestLLClient(confOverrides: Partial<PlClientConfig> = {}) {\n const { conf, auth } = await getTestClientConf();\n return await LLPlClient.build({ ...conf, ...confOverrides }, { auth });\n}\n\nexport async function getTestClient(\n alternativeRoot?: string,\n confOverrides: Partial<PlClientConfig> = {},\n) {\n const { conf, auth } = await getTestClientConf();\n if (alternativeRoot !== undefined && conf.alternativeRoot !== undefined)\n throw new Error(\"test pl address configured with alternative root\");\n return await PlClient.init({ ...conf, ...confOverrides, alternativeRoot }, auth);\n}\n\nexport type WithTempRootOptions =\n | {\n /** If true and PL_ADDRESS is http://localhost or http://127.0.0.1:<port>,\n * a TCP proxy will be started and PL client will connect through it. */\n viaTcpProxy: true;\n /** Artificial latency for proxy (ms). Default 0 */\n proxyLatencyMs?: number;\n }\n | {\n viaTcpProxy?: undefined;\n };\n\nexport async function withTempRoot<T>(body: (pl: PlClient) => Promise<T>): Promise<T | void>;\n\nexport async function withTempRoot<T>(\n body: (pl: PlClient, proxy: Awaited<ReturnType<typeof startTcpProxy>>) => Promise<T>,\n options: {\n viaTcpProxy: true;\n proxyLatencyMs?: number;\n },\n): Promise<T>;\n\nexport async function withTempRoot<T>(\n body: (pl: PlClient, proxy: any) => Promise<T>,\n options: WithTempRootOptions = {},\n): Promise<T | undefined> {\n const alternativeRoot = `test_${Date.now()}_${randomUUID()}`;\n let altRootId: OptionalResourceId = NullResourceId;\n // Proxy management\n let proxy: Awaited<ReturnType<typeof startTcpProxy>> | undefined;\n let confOverrides: Partial<PlClientConfig> = {};\n try {\n // Optionally start TCP proxy and rewrite PL_ADDRESS to point to proxy\n if (options.viaTcpProxy === true && process.env.PL_ADDRESS) {\n try {\n const url = new URL(process.env.PL_ADDRESS);\n const isHttp = url.protocol === \"http:\";\n const isLocal = url.hostname === \"127.0.0.1\" || url.hostname === \"localhost\";\n const port = parseInt(url.port);\n if (isHttp && isLocal && Number.isFinite(port)) {\n proxy = await startTcpProxy({ targetPort: port, latency: options.proxyLatencyMs ?? 0 });\n // Override client connection host:port to proxy\n confOverrides = { hostAndPort: `127.0.0.1:${proxy.port}` } as Partial<PlClientConfig>;\n } else {\n console.warn(\n \"*** skipping proxy-based test, PL_ADDRESS is not localhost\",\n process.env.PL_ADDRESS,\n );\n return;\n }\n } catch {\n // ignore proxy setup errors; tests will run against original address\n }\n }\n\n const client = await getTestClient(alternativeRoot, confOverrides);\n altRootId = client.clientRoot;\n try {\n const value = await body(client, proxy);\n const rawClient = await getTestClient();\n try {\n await rawClient.deleteAlternativeRoot(alternativeRoot);\n } catch (cleanupErr: any) {\n // Cleanup may fail if test intentionally deleted resources\n console.warn(`Failed to clean up alternative root ${alternativeRoot}:`, cleanupErr.message);\n } finally {\n // Close the cleanup client to avoid dangling gRPC channels that can cause\n // segfaults during process exit\n await rawClient.close();\n }\n return value;\n } finally {\n // Close the test client to avoid dangling gRPC channels\n await client.close();\n }\n } catch (err: any) {\n console.log(`ALTERNATIVE ROOT: ${alternativeRoot} (${resourceIdToString(altRootId)})`);\n throw err;\n // throw new Error('withTempRoot error: ' + err.message, { cause: err });\n } finally {\n // Stop proxy if started\n if (proxy) {\n try {\n await proxy.disconnectAll();\n } catch {\n /* ignore */\n }\n try {\n await new Promise<void>((resolve) => proxy!.server.close(() => resolve()));\n } catch {\n /* ignore */\n }\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAuBA,MAAM,WAAW,GAAG,kBAAkB;A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,EAAqB,eAAe,CAAA,EAAA,EAAK,kBAAkB,CAAC,SAAS,CAAC,CAAA,CAAA,CAAG,CAAC;AACtF,QAAA,MAAM,GAAG;;IAEX;YAAU;;QAER,IAAI,KAAK,EAAE;AACT,YAAA,IAAI;AACF,gBAAA,MAAM,KAAK,CAAC,aAAa,EAAE;YAC7B;AAAE,YAAA,MAAM;;YAER;AACA,YAAA,IAAI;gBACF,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,KAAK,KAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC;YAC5E;AAAE,YAAA,MAAM;;YAER;QACF;IACF;AACF;;;;"}
1
+ {"version":3,"file":"test_config.js","names":["fs"],"sources":["../../src/test/test_config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport { LLPlClient } from \"../core/ll_client\";\nimport type { AuthInformation, AuthOps, PlClientConfig } from \"../core/config\";\nimport { plAddressToConfig } from \"../core/config\";\nimport { UnauthenticatedPlClient } from \"../core/unauth_client\";\nimport { PlClient } from \"../core/client\";\nimport { randomUUID } from \"node:crypto\";\nimport type { OptionalResourceId } from \"../core/types\";\nimport { NullResourceId, resourceIdToString } from \"../core/types\";\nimport { inferAuthRefreshTime } from \"../core/auth\";\nimport * as path from \"node:path\";\nimport type { TestTcpProxy } from \"./tcp-proxy\";\nimport { startTcpProxy } from \"./tcp-proxy\";\n\nexport { TestTcpProxy };\n\nexport interface TestConfig {\n address: string;\n test_proxy?: string;\n test_user?: string;\n test_password?: string;\n}\n\nconst CONFIG_FILE = \"test_config.json\";\n// const AUTH_DATA_FILE = '.test_auth.json';\n\nlet authDataFilePath: string | undefined;\n\nfunction getFullAuthDataFilePath() {\n if (authDataFilePath === undefined) authDataFilePath = path.resolve(\".test_auth.json\");\n return authDataFilePath;\n}\n\nexport function getTestConfig(): TestConfig {\n let conf: Partial<TestConfig> = {};\n if (fs.existsSync(CONFIG_FILE))\n conf = JSON.parse(fs.readFileSync(CONFIG_FILE, { encoding: \"utf-8\" })) as TestConfig;\n\n if (process.env.PL_ADDRESS !== undefined) conf.address = process.env.PL_ADDRESS;\n\n if (process.env.PL_TEST_USER !== undefined) conf.test_user = process.env.PL_TEST_USER;\n\n if (process.env.PL_TEST_PASSWORD !== undefined) conf.test_password = process.env.PL_TEST_PASSWORD;\n\n if (process.env.PL_TEST_PROXY !== undefined) conf.test_proxy = process.env.PL_TEST_PROXY;\n\n if (conf.address === undefined)\n throw new Error(\n `can't resolve platform address (checked ${CONFIG_FILE} file and PL_ADDRESS environment var)`,\n );\n\n return conf as TestConfig;\n}\n\n/** Default request timeout for tests (ms) */\nexport const TEST_REQUEST_TIMEOUT = 500;\n\n/** Returns PlClientConfig with reduced timeout for tests */\nexport function plAddressToTestConfig(address: string): PlClientConfig {\n const plConf = plAddressToConfig(address);\n plConf.defaultRequestTimeout = TEST_REQUEST_TIMEOUT;\n return plConf;\n}\n\ninterface AuthCache {\n /** To check if config changed */\n conf: TestConfig;\n expiration: number;\n authInformation: AuthInformation;\n}\n\nfunction saveAuthInfoCallback(tConf: TestConfig): (authInformation: AuthInformation) => void {\n return (authInformation) => {\n const dst = getFullAuthDataFilePath();\n const tmpDst = getFullAuthDataFilePath() + randomUUID();\n fs.writeFileSync(\n tmpDst,\n Buffer.from(\n JSON.stringify({\n conf: tConf,\n authInformation,\n expiration: inferAuthRefreshTime(authInformation, 24 * 60 * 60),\n } as AuthCache),\n ),\n \"utf8\",\n );\n fs.renameSync(tmpDst, dst);\n };\n}\n\nconst cleanAuthInfoCallback = () => {\n console.warn(`Removing: ${getFullAuthDataFilePath()}`);\n fs.rmSync(getFullAuthDataFilePath());\n};\n\nexport async function getTestClientConf(): Promise<{ conf: PlClientConfig; auth: AuthOps }> {\n const tConf = getTestConfig();\n\n let authInformation: AuthInformation | undefined = undefined;\n\n // try recover from cache\n if (fs.existsSync(getFullAuthDataFilePath())) {\n try {\n const cache: AuthCache = JSON.parse(\n fs.readFileSync(getFullAuthDataFilePath(), { encoding: \"utf-8\" }),\n ) as AuthCache; // TODO runtime validation\n if (\n cache.conf.address === tConf.address &&\n cache.conf.test_user === tConf.test_user &&\n cache.conf.test_password === tConf.test_password &&\n cache.expiration > Date.now()\n )\n authInformation = cache.authInformation;\n } catch {\n // removing cache file on any error\n fs.rmSync(getFullAuthDataFilePath());\n }\n }\n\n const plConf = plAddressToTestConfig(tConf.address);\n const uClient = await UnauthenticatedPlClient.build(plConf);\n\n const requireAuth = await uClient.requireAuth();\n\n if (!requireAuth && (tConf.test_user !== undefined || tConf.test_password !== undefined))\n throw new Error(\n `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`,\n );\n\n if (requireAuth && (tConf.test_user === undefined || tConf.test_password === undefined))\n throw new Error(\n `No auth information found in config (${CONFIG_FILE}) or env variables: PL_TEST_USER and PL_TEST_PASSWORD`,\n );\n\n if (authInformation === undefined) {\n if (requireAuth) authInformation = await uClient.login(tConf.test_user!, tConf.test_password!);\n // No authorization is required\n else authInformation = {};\n\n // saving cache\n saveAuthInfoCallback(tConf)(authInformation);\n }\n\n return {\n conf: plConf,\n auth: {\n authInformation,\n onUpdate: saveAuthInfoCallback(tConf),\n onAuthError: cleanAuthInfoCallback,\n onUpdateError: cleanAuthInfoCallback,\n },\n };\n}\n\nexport async function getTestLLClient(confOverrides: Partial<PlClientConfig> = {}) {\n const { conf, auth } = await getTestClientConf();\n return await LLPlClient.build({ ...conf, ...confOverrides }, { auth });\n}\n\nexport async function getTestClient(\n alternativeRoot?: string,\n confOverrides: Partial<PlClientConfig> = {},\n) {\n const { conf, auth } = await getTestClientConf();\n if (alternativeRoot !== undefined && conf.alternativeRoot !== undefined)\n throw new Error(\"test pl address configured with alternative root\");\n return await PlClient.init({ ...conf, ...confOverrides, alternativeRoot }, auth);\n}\n\nexport type WithTempRootOptions =\n | {\n /** If true and PL_ADDRESS is http://localhost or http://127.0.0.1:<port>,\n * a TCP proxy will be started and PL client will connect through it. */\n viaTcpProxy: true;\n /** Artificial latency for proxy (ms). Default 0 */\n proxyLatencyMs?: number;\n }\n | {\n viaTcpProxy?: undefined;\n };\n\nexport async function withTempRoot<T>(body: (pl: PlClient) => Promise<T>): Promise<T | void>;\n\nexport async function withTempRoot<T>(\n body: (pl: PlClient, proxy: Awaited<ReturnType<typeof startTcpProxy>>) => Promise<T>,\n options: {\n viaTcpProxy: true;\n proxyLatencyMs?: number;\n },\n): Promise<T>;\n\nexport async function withTempRoot<T>(\n body: (pl: PlClient, proxy: any) => Promise<T>,\n options: WithTempRootOptions = {},\n): Promise<T | undefined> {\n const alternativeRoot = `test_${Date.now()}_${randomUUID()}`;\n let altRootId: OptionalResourceId = NullResourceId;\n // Proxy management\n let proxy: Awaited<ReturnType<typeof startTcpProxy>> | undefined;\n let confOverrides: Partial<PlClientConfig> = {};\n try {\n // Optionally start TCP proxy and rewrite PL_ADDRESS to point to proxy\n if (options.viaTcpProxy === true && process.env.PL_ADDRESS) {\n try {\n const url = new URL(process.env.PL_ADDRESS);\n const isHttp = url.protocol === \"http:\";\n const isLocal = url.hostname === \"127.0.0.1\" || url.hostname === \"localhost\";\n const port = parseInt(url.port);\n if (isHttp && isLocal && Number.isFinite(port)) {\n proxy = await startTcpProxy({ targetPort: port, latency: options.proxyLatencyMs ?? 0 });\n // Override client connection host:port to proxy\n confOverrides = { hostAndPort: `127.0.0.1:${proxy.port}` } as Partial<PlClientConfig>;\n } else {\n console.warn(\n \"*** skipping proxy-based test, PL_ADDRESS is not localhost\",\n process.env.PL_ADDRESS,\n );\n return;\n }\n } catch {\n // ignore proxy setup errors; tests will run against original address\n }\n }\n\n const client = await getTestClient(alternativeRoot, confOverrides);\n altRootId = client.clientRoot;\n try {\n const value = await body(client, proxy);\n const rawClient = await getTestClient();\n try {\n await rawClient.deleteAlternativeRoot(alternativeRoot);\n } catch (cleanupErr: any) {\n // Cleanup may fail if test intentionally deleted resources\n console.warn(`Failed to clean up alternative root ${alternativeRoot}:`, cleanupErr.message);\n } finally {\n // Close the cleanup client to avoid dangling gRPC channels that can cause\n // segfaults during process exit\n await rawClient.close();\n }\n return value;\n } finally {\n // Close the test client to avoid dangling gRPC channels\n await client.close();\n }\n } catch (err: any) {\n console.log(`ALTERNATIVE ROOT: ${alternativeRoot} (${resourceIdToString(altRootId)})`);\n throw err;\n // throw new Error('withTempRoot error: ' + err.message, { cause: err });\n } finally {\n // Stop proxy if started\n if (proxy) {\n try {\n await proxy.disconnectAll();\n } catch {\n /* ignore */\n }\n try {\n await new Promise<void>((resolve) => proxy!.server.close(() => resolve()));\n } catch {\n /* ignore */\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,cAAc;AAGpB,IAAI;AAEJ,SAAS,0BAA0B;AACjC,KAAI,qBAAqB,OAAW,oBAAmB,KAAK,QAAQ,kBAAkB;AACtF,QAAO;;AAGT,SAAgB,gBAA4B;CAC1C,IAAI,OAA4B,EAAE;AAClC,KAAIA,KAAG,WAAW,YAAY,CAC5B,QAAO,KAAK,MAAMA,KAAG,aAAa,aAAa,EAAE,UAAU,SAAS,CAAC,CAAC;AAExE,KAAI,QAAQ,IAAI,eAAe,OAAW,MAAK,UAAU,QAAQ,IAAI;AAErE,KAAI,QAAQ,IAAI,iBAAiB,OAAW,MAAK,YAAY,QAAQ,IAAI;AAEzE,KAAI,QAAQ,IAAI,qBAAqB,OAAW,MAAK,gBAAgB,QAAQ,IAAI;AAEjF,KAAI,QAAQ,IAAI,kBAAkB,OAAW,MAAK,aAAa,QAAQ,IAAI;AAE3E,KAAI,KAAK,YAAY,OACnB,OAAM,IAAI,MACR,2CAA2C,YAAY,uCACxD;AAEH,QAAO;;;AAIT,MAAa,uBAAuB;;AAGpC,SAAgB,sBAAsB,SAAiC;CACrE,MAAM,SAAS,kBAAkB,QAAQ;AACzC,QAAO,wBAAwB;AAC/B,QAAO;;AAUT,SAAS,qBAAqB,OAA+D;AAC3F,SAAQ,oBAAoB;EAC1B,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AAQ,MAAM;GACvC,MAAM,YAAY,MAAM,eAAe;AACvC,OAAI;AACF,UAAM,UAAU,sBAAsB,gBAAgB;YAC/C,YAAiB;AAExB,YAAQ,KAAK,uCAAuC,gBAAgB,IAAI,WAAW,QAAQ;aACnF;AAGR,UAAM,UAAU,OAAO;;AAEzB,UAAO;YACC;AAER,SAAM,OAAO,OAAO;;UAEf,KAAU;AACjB,UAAQ,IAAI,qBAAqB,gBAAgB,IAAI,mBAAmB,UAAU,CAAC,GAAG;AACtF,QAAM;WAEE;AAER,MAAI,OAAO;AACT,OAAI;AACF,UAAM,MAAM,eAAe;WACrB;AAGR,OAAI;AACF,UAAM,IAAI,SAAe,YAAY,MAAO,OAAO,YAAY,SAAS,CAAC,CAAC;WACpE"}
package/dist/util/pl.cjs CHANGED
@@ -1,8 +1,9 @@
1
- 'use strict';
2
1
 
2
+ //#region src/util/pl.ts
3
3
  function parsePlJwt(token) {
4
- return JSON.parse(Buffer.from(token.split(".")[1], "base64").toString());
4
+ return JSON.parse(Buffer.from(token.split(".")[1], "base64").toString());
5
5
  }
6
6
 
7
+ //#endregion
7
8
  exports.parsePlJwt = parsePlJwt;
8
- //# sourceMappingURL=pl.cjs.map
9
+ //# sourceMappingURL=pl.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"pl.cjs","sources":["../../src/util/pl.ts"],"sourcesContent":["export type PlJWTPayload = {\n user: {\n login: string;\n };\n exp: number;\n iat: number;\n};\n\nexport function parsePlJwt(token: string): PlJWTPayload {\n return JSON.parse(Buffer.from(token.split(\".\")[1], \"base64\").toString());\n}\n"],"names":[],"mappings":";;AAQM,SAAU,UAAU,CAAC,KAAa,EAAA;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC1E;;;;"}
1
+ {"version":3,"file":"pl.cjs","names":[],"sources":["../../src/util/pl.ts"],"sourcesContent":["export type PlJWTPayload = {\n user: {\n login: string;\n };\n exp: number;\n iat: number;\n};\n\nexport function parsePlJwt(token: string): PlJWTPayload {\n return JSON.parse(Buffer.from(token.split(\".\")[1], \"base64\").toString());\n}\n"],"mappings":";;AAQA,SAAgB,WAAW,OAA6B;AACtD,QAAO,KAAK,MAAM,OAAO,KAAK,MAAM,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC"}
package/dist/util/pl.js CHANGED
@@ -1,6 +1,8 @@
1
+ //#region src/util/pl.ts
1
2
  function parsePlJwt(token) {
2
- return JSON.parse(Buffer.from(token.split(".")[1], "base64").toString());
3
+ return JSON.parse(Buffer.from(token.split(".")[1], "base64").toString());
3
4
  }
4
5
 
6
+ //#endregion
5
7
  export { parsePlJwt };
6
- //# sourceMappingURL=pl.js.map
8
+ //# sourceMappingURL=pl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pl.js","sources":["../../src/util/pl.ts"],"sourcesContent":["export type PlJWTPayload = {\n user: {\n login: string;\n };\n exp: number;\n iat: number;\n};\n\nexport function parsePlJwt(token: string): PlJWTPayload {\n return JSON.parse(Buffer.from(token.split(\".\")[1], \"base64\").toString());\n}\n"],"names":[],"mappings":"AAQM,SAAU,UAAU,CAAC,KAAa,EAAA;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC1E;;;;"}
1
+ {"version":3,"file":"pl.js","names":[],"sources":["../../src/util/pl.ts"],"sourcesContent":["export type PlJWTPayload = {\n user: {\n login: string;\n };\n exp: number;\n iat: number;\n};\n\nexport function parsePlJwt(token: string): PlJWTPayload {\n return JSON.parse(Buffer.from(token.split(\".\")[1], \"base64\").toString());\n}\n"],"mappings":";AAQA,SAAgB,WAAW,OAA6B;AACtD,QAAO,KAAK,MAAM,OAAO,KAAK,MAAM,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC"}
@@ -1,17 +1,14 @@
1
- 'use strict';
2
1
 
2
+ //#region src/util/util.ts
3
3
  function isArrayBufferOrView(value) {
4
- return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
4
+ return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
5
5
  }
6
6
  function toBytes(value) {
7
- if (typeof value === "string")
8
- return Buffer.from(value);
9
- else if (isArrayBufferOrView(value))
10
- return value;
11
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
12
- else
13
- throw new Error(`Unexpected type: ${value}`);
7
+ if (typeof value === "string") return Buffer.from(value);
8
+ else if (isArrayBufferOrView(value)) return value;
9
+ else throw new Error(`Unexpected type: ${value}`);
14
10
  }
15
11
 
12
+ //#endregion
16
13
  exports.toBytes = toBytes;
17
- //# sourceMappingURL=util.cjs.map
14
+ //# sourceMappingURL=util.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.cjs","sources":["../../src/util/util.ts"],"sourcesContent":["function isArrayBufferOrView(value: unknown): value is ArrayBufferLike {\n return value instanceof ArrayBuffer || ArrayBuffer.isView(value);\n}\n\nexport function toBytes(value: string | Uint8Array): Uint8Array {\n if (typeof value === \"string\") return Buffer.from(value);\n else if (isArrayBufferOrView(value)) return value;\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n else throw new Error(`Unexpected type: ${value}`);\n}\n"],"names":[],"mappings":";;AAAA,SAAS,mBAAmB,CAAC,KAAc,EAAA;IACzC,OAAO,KAAK,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;AAClE;AAEM,SAAU,OAAO,CAAC,KAA0B,EAAA;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACnD,IAAI,mBAAmB,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;;;AAE5C,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,CAAA,CAAE,CAAC;AACnD;;;;"}
1
+ {"version":3,"file":"util.cjs","names":[],"sources":["../../src/util/util.ts"],"sourcesContent":["function isArrayBufferOrView(value: unknown): value is ArrayBufferLike {\n return value instanceof ArrayBuffer || ArrayBuffer.isView(value);\n}\n\nexport function toBytes(value: string | Uint8Array): Uint8Array {\n if (typeof value === \"string\") return Buffer.from(value);\n else if (isArrayBufferOrView(value)) return value;\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n else throw new Error(`Unexpected type: ${value}`);\n}\n"],"mappings":";;AAAA,SAAS,oBAAoB,OAA0C;AACrE,QAAO,iBAAiB,eAAe,YAAY,OAAO,MAAM;;AAGlE,SAAgB,QAAQ,OAAwC;AAC9D,KAAI,OAAO,UAAU,SAAU,QAAO,OAAO,KAAK,MAAM;UAC/C,oBAAoB,MAAM,CAAE,QAAO;KAEvC,OAAM,IAAI,MAAM,oBAAoB,QAAQ"}
package/dist/util/util.js CHANGED
@@ -1,15 +1,13 @@
1
+ //#region src/util/util.ts
1
2
  function isArrayBufferOrView(value) {
2
- return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
3
+ return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
3
4
  }
4
5
  function toBytes(value) {
5
- if (typeof value === "string")
6
- return Buffer.from(value);
7
- else if (isArrayBufferOrView(value))
8
- return value;
9
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
10
- else
11
- throw new Error(`Unexpected type: ${value}`);
6
+ if (typeof value === "string") return Buffer.from(value);
7
+ else if (isArrayBufferOrView(value)) return value;
8
+ else throw new Error(`Unexpected type: ${value}`);
12
9
  }
13
10
 
11
+ //#endregion
14
12
  export { toBytes };
15
- //# sourceMappingURL=util.js.map
13
+ //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../src/util/util.ts"],"sourcesContent":["function isArrayBufferOrView(value: unknown): value is ArrayBufferLike {\n return value instanceof ArrayBuffer || ArrayBuffer.isView(value);\n}\n\nexport function toBytes(value: string | Uint8Array): Uint8Array {\n if (typeof value === \"string\") return Buffer.from(value);\n else if (isArrayBufferOrView(value)) return value;\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n else throw new Error(`Unexpected type: ${value}`);\n}\n"],"names":[],"mappings":"AAAA,SAAS,mBAAmB,CAAC,KAAc,EAAA;IACzC,OAAO,KAAK,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;AAClE;AAEM,SAAU,OAAO,CAAC,KAA0B,EAAA;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACnD,IAAI,mBAAmB,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;;;AAE5C,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,CAAA,CAAE,CAAC;AACnD;;;;"}
1
+ {"version":3,"file":"util.js","names":[],"sources":["../../src/util/util.ts"],"sourcesContent":["function isArrayBufferOrView(value: unknown): value is ArrayBufferLike {\n return value instanceof ArrayBuffer || ArrayBuffer.isView(value);\n}\n\nexport function toBytes(value: string | Uint8Array): Uint8Array {\n if (typeof value === \"string\") return Buffer.from(value);\n else if (isArrayBufferOrView(value)) return value;\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n else throw new Error(`Unexpected type: ${value}`);\n}\n"],"mappings":";AAAA,SAAS,oBAAoB,OAA0C;AACrE,QAAO,iBAAiB,eAAe,YAAY,OAAO,MAAM;;AAGlE,SAAgB,QAAQ,OAAwC;AAC9D,KAAI,OAAO,UAAU,SAAU,QAAO,OAAO,KAAK,MAAM;UAC/C,oBAAoB,MAAM,CAAE,QAAO;KAEvC,OAAM,IAAI,MAAM,oBAAoB,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-client",
3
- "version": "2.17.7",
3
+ "version": "2.17.8",
4
4
  "description": "New TS/JS client for Platform API",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -30,20 +30,20 @@
30
30
  "undici": "~7.16.0",
31
31
  "utility-types": "^3.11.0",
32
32
  "yaml": "^2.8.0",
33
- "@milaboratories/pl-http": "1.2.3",
34
- "@milaboratories/ts-helpers": "1.7.2",
35
- "@milaboratories/pl-model-common": "1.25.1"
33
+ "@milaboratories/pl-model-common": "1.25.2",
34
+ "@milaboratories/ts-helpers": "1.7.3",
35
+ "@milaboratories/pl-http": "1.2.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@protobuf-ts/plugin": "2.11.1",
39
39
  "@types/node": "~24.5.2",
40
40
  "@vitest/coverage-istanbul": "^4.0.18",
41
41
  "openapi-typescript": "^7.10.0",
42
- "typescript": "~5.6.3",
42
+ "typescript": "~5.9.3",
43
43
  "vitest": "^4.0.18",
44
- "@milaboratories/ts-builder": "1.2.11",
45
- "@milaboratories/ts-configs": "1.2.1",
46
- "@milaboratories/build-configs": "1.5.0"
44
+ "@milaboratories/build-configs": "1.5.1",
45
+ "@milaboratories/ts-builder": "1.2.13",
46
+ "@milaboratories/ts-configs": "1.2.2"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=22.19.0"