@milaboratories/pl-client 2.11.8 → 2.11.9

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 (242) hide show
  1. package/dist/core/auth.cjs +24 -0
  2. package/dist/core/auth.cjs.map +1 -0
  3. package/dist/core/auth.d.ts +0 -1
  4. package/dist/core/auth.js +21 -0
  5. package/dist/core/auth.js.map +1 -0
  6. package/dist/core/cache.d.ts +0 -1
  7. package/dist/core/client.cjs +288 -0
  8. package/dist/core/client.cjs.map +1 -0
  9. package/dist/core/client.d.ts +0 -1
  10. package/dist/core/client.js +267 -0
  11. package/dist/core/client.js.map +1 -0
  12. package/dist/core/config.cjs +111 -0
  13. package/dist/core/config.cjs.map +1 -0
  14. package/dist/core/config.d.ts +0 -1
  15. package/dist/core/config.js +95 -0
  16. package/dist/core/config.js.map +1 -0
  17. package/dist/core/default_client.cjs +143 -0
  18. package/dist/core/default_client.cjs.map +1 -0
  19. package/dist/core/default_client.d.ts +0 -1
  20. package/dist/core/default_client.js +120 -0
  21. package/dist/core/default_client.js.map +1 -0
  22. package/dist/core/driver.cjs +14 -0
  23. package/dist/core/driver.cjs.map +1 -0
  24. package/dist/core/driver.d.ts +0 -1
  25. package/dist/core/driver.js +12 -0
  26. package/dist/core/driver.js.map +1 -0
  27. package/dist/core/error_resource.cjs +9 -0
  28. package/dist/core/error_resource.cjs.map +1 -0
  29. package/dist/core/error_resource.d.ts +0 -1
  30. package/dist/core/error_resource.js +7 -0
  31. package/dist/core/error_resource.js.map +1 -0
  32. package/dist/core/errors.cjs +106 -0
  33. package/dist/core/errors.cjs.map +1 -0
  34. package/dist/core/errors.d.ts +0 -1
  35. package/dist/core/errors.js +93 -0
  36. package/dist/core/errors.js.map +1 -0
  37. package/dist/core/final.cjs +98 -0
  38. package/dist/core/final.cjs.map +1 -0
  39. package/dist/core/final.d.ts +0 -1
  40. package/dist/core/final.js +96 -0
  41. package/dist/core/final.js.map +1 -0
  42. package/dist/core/grpc.d.ts +0 -1
  43. package/dist/core/http.d.ts +1 -1
  44. package/dist/core/ll_client.cjs +266 -0
  45. package/dist/core/ll_client.cjs.map +1 -0
  46. package/dist/core/ll_client.d.ts +0 -1
  47. package/dist/core/ll_client.js +264 -0
  48. package/dist/core/ll_client.js.map +1 -0
  49. package/dist/core/ll_transaction.cjs +236 -0
  50. package/dist/core/ll_transaction.cjs.map +1 -0
  51. package/dist/core/ll_transaction.d.ts +0 -1
  52. package/dist/core/ll_transaction.js +233 -0
  53. package/dist/core/ll_transaction.js.map +1 -0
  54. package/dist/core/stat.cjs +74 -0
  55. package/dist/core/stat.cjs.map +1 -0
  56. package/dist/core/stat.d.ts +0 -1
  57. package/dist/core/stat.js +70 -0
  58. package/dist/core/stat.js.map +1 -0
  59. package/dist/core/transaction.cjs +626 -0
  60. package/dist/core/transaction.cjs.map +1 -0
  61. package/dist/core/transaction.d.ts +0 -1
  62. package/dist/core/transaction.js +613 -0
  63. package/dist/core/transaction.js.map +1 -0
  64. package/dist/core/type_conversion.cjs +106 -0
  65. package/dist/core/type_conversion.cjs.map +1 -0
  66. package/dist/core/type_conversion.d.ts +0 -1
  67. package/dist/core/type_conversion.js +102 -0
  68. package/dist/core/type_conversion.js.map +1 -0
  69. package/dist/core/types.cjs +159 -0
  70. package/dist/core/types.cjs.map +1 -0
  71. package/dist/core/types.d.ts +0 -1
  72. package/dist/core/types.js +134 -0
  73. package/dist/core/types.js.map +1 -0
  74. package/dist/core/unauth_client.cjs +43 -0
  75. package/dist/core/unauth_client.cjs.map +1 -0
  76. package/dist/core/unauth_client.d.ts +0 -1
  77. package/dist/core/unauth_client.js +41 -0
  78. package/dist/core/unauth_client.js.map +1 -0
  79. package/dist/helpers/pl.cjs +124 -0
  80. package/dist/helpers/pl.cjs.map +1 -0
  81. package/dist/helpers/pl.d.ts +0 -1
  82. package/dist/helpers/pl.js +94 -0
  83. package/dist/helpers/pl.js.map +1 -0
  84. package/dist/helpers/poll.cjs +148 -0
  85. package/dist/helpers/poll.cjs.map +1 -0
  86. package/dist/helpers/poll.d.ts +0 -1
  87. package/dist/helpers/poll.js +123 -0
  88. package/dist/helpers/poll.js.map +1 -0
  89. package/dist/helpers/rich_resource_types.d.ts +1 -1
  90. package/dist/helpers/smart_accessors.d.ts +1 -1
  91. package/dist/helpers/state_helpers.d.ts +0 -1
  92. package/dist/helpers/tx_helpers.cjs +25 -0
  93. package/dist/helpers/tx_helpers.cjs.map +1 -0
  94. package/dist/helpers/tx_helpers.d.ts +0 -1
  95. package/dist/helpers/tx_helpers.js +23 -0
  96. package/dist/helpers/tx_helpers.js.map +1 -0
  97. package/dist/index.cjs +99 -0
  98. package/dist/index.cjs.map +1 -0
  99. package/dist/index.d.ts +0 -1
  100. package/dist/index.js +16 -1
  101. package/dist/index.js.map +1 -1
  102. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.cjs +71 -0
  103. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.cjs.map +1 -0
  104. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +0 -1
  105. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.js +69 -0
  106. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.js.map +1 -0
  107. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +3 -5
  108. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +0 -1
  109. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +3 -5
  110. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +0 -1
  111. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +3 -5
  112. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +0 -1
  113. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +3 -5
  114. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +0 -1
  115. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +12238 -0
  116. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -0
  117. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +223 -0
  118. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -0
  119. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +3 -5
  120. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +221 -0
  121. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -0
  122. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +0 -1
  123. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.js +12086 -0
  124. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -0
  125. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs +1127 -0
  126. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +1 -0
  127. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +0 -1
  128. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.js +1113 -0
  129. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +1 -0
  130. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs +152 -0
  131. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +1 -0
  132. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +0 -1
  133. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.js +149 -0
  134. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +1 -0
  135. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +0 -1
  136. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs +500 -0
  137. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +1 -0
  138. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +0 -1
  139. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js +496 -0
  140. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +1 -0
  141. package/dist/proto/google/api/http.d.ts +0 -1
  142. package/dist/proto/google/protobuf/any.cjs +151 -0
  143. package/dist/proto/google/protobuf/any.cjs.map +1 -0
  144. package/dist/proto/google/protobuf/any.d.ts +0 -1
  145. package/dist/proto/google/protobuf/any.js +149 -0
  146. package/dist/proto/google/protobuf/any.js.map +1 -0
  147. package/dist/proto/google/protobuf/descriptor.d.ts +0 -1
  148. package/dist/proto/google/protobuf/duration.cjs +105 -0
  149. package/dist/proto/google/protobuf/duration.cjs.map +1 -0
  150. package/dist/proto/google/protobuf/duration.d.ts +0 -1
  151. package/dist/proto/google/protobuf/duration.js +103 -0
  152. package/dist/proto/google/protobuf/duration.js.map +1 -0
  153. package/dist/proto/google/protobuf/empty.d.ts +0 -1
  154. package/dist/proto/google/protobuf/struct.d.ts +0 -1
  155. package/dist/proto/google/protobuf/timestamp.cjs +133 -0
  156. package/dist/proto/google/protobuf/timestamp.cjs.map +1 -0
  157. package/dist/proto/google/protobuf/timestamp.d.ts +0 -1
  158. package/dist/proto/google/protobuf/timestamp.js +131 -0
  159. package/dist/proto/google/protobuf/timestamp.js.map +1 -0
  160. package/dist/proto/google/protobuf/wrappers.d.ts +0 -1
  161. package/dist/test/test_config.cjs +149 -0
  162. package/dist/test/test_config.cjs.map +1 -0
  163. package/dist/test/test_config.d.ts +0 -1
  164. package/dist/test/test_config.js +123 -0
  165. package/dist/test/test_config.js.map +1 -0
  166. package/dist/util/branding.d.ts +0 -1
  167. package/dist/util/pl.cjs +8 -0
  168. package/dist/util/pl.cjs.map +1 -0
  169. package/dist/util/pl.d.ts +0 -1
  170. package/dist/util/pl.js +6 -0
  171. package/dist/util/pl.js.map +1 -0
  172. package/dist/util/util.cjs +17 -0
  173. package/dist/util/util.cjs.map +1 -0
  174. package/dist/util/util.d.ts +0 -1
  175. package/dist/util/util.js +15 -0
  176. package/dist/util/util.js.map +1 -0
  177. package/package.json +14 -11
  178. package/src/core/client.test.ts +1 -0
  179. package/src/core/config.test.ts +1 -0
  180. package/src/core/error.test.ts +1 -0
  181. package/src/core/ll_client.test.ts +1 -0
  182. package/src/core/ll_transaction.test.ts +1 -0
  183. package/src/core/transaction.test.ts +1 -0
  184. package/src/core/types.test.ts +1 -0
  185. package/src/core/unauth_client.test.ts +1 -0
  186. package/src/helpers/rich_resource_types.test.ts +2 -0
  187. package/src/test/test_config.test.ts +1 -0
  188. package/src/util/util.test.ts +1 -0
  189. package/dist/core/auth.d.ts.map +0 -1
  190. package/dist/core/cache.d.ts.map +0 -1
  191. package/dist/core/client.d.ts.map +0 -1
  192. package/dist/core/config.d.ts.map +0 -1
  193. package/dist/core/default_client.d.ts.map +0 -1
  194. package/dist/core/driver.d.ts.map +0 -1
  195. package/dist/core/error_resource.d.ts.map +0 -1
  196. package/dist/core/errors.d.ts.map +0 -1
  197. package/dist/core/final.d.ts.map +0 -1
  198. package/dist/core/grpc.d.ts.map +0 -1
  199. package/dist/core/http.d.ts.map +0 -1
  200. package/dist/core/ll_client.d.ts.map +0 -1
  201. package/dist/core/ll_transaction.d.ts.map +0 -1
  202. package/dist/core/stat.d.ts.map +0 -1
  203. package/dist/core/transaction.d.ts.map +0 -1
  204. package/dist/core/type_conversion.d.ts.map +0 -1
  205. package/dist/core/types.d.ts.map +0 -1
  206. package/dist/core/unauth_client.d.ts.map +0 -1
  207. package/dist/helpers/pl.d.ts.map +0 -1
  208. package/dist/helpers/poll.d.ts.map +0 -1
  209. package/dist/helpers/rich_resource_types.d.ts.map +0 -1
  210. package/dist/helpers/smart_accessors.d.ts.map +0 -1
  211. package/dist/helpers/state_helpers.d.ts.map +0 -1
  212. package/dist/helpers/tx_helpers.d.ts.map +0 -1
  213. package/dist/index.d.ts.map +0 -1
  214. package/dist/index.mjs +0 -14537
  215. package/dist/index.mjs.map +0 -1
  216. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +0 -1
  217. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +0 -1
  218. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +0 -1
  219. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +0 -1
  220. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +0 -1
  221. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +0 -1
  222. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +0 -1
  223. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +0 -1
  224. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +0 -1
  225. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +0 -1
  226. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +0 -1
  227. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +0 -1
  228. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +0 -1
  229. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +0 -1
  230. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +0 -1
  231. package/dist/proto/google/api/http.d.ts.map +0 -1
  232. package/dist/proto/google/protobuf/any.d.ts.map +0 -1
  233. package/dist/proto/google/protobuf/descriptor.d.ts.map +0 -1
  234. package/dist/proto/google/protobuf/duration.d.ts.map +0 -1
  235. package/dist/proto/google/protobuf/empty.d.ts.map +0 -1
  236. package/dist/proto/google/protobuf/struct.d.ts.map +0 -1
  237. package/dist/proto/google/protobuf/timestamp.d.ts.map +0 -1
  238. package/dist/proto/google/protobuf/wrappers.d.ts.map +0 -1
  239. package/dist/test/test_config.d.ts.map +0 -1
  240. package/dist/util/branding.d.ts.map +0 -1
  241. package/dist/util/pl.d.ts.map +0 -1
  242. package/dist/util/util.d.ts.map +0 -1
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var pl = require('../util/pl.cjs');
4
+
5
+ /** Returns a timestamp when current authorization information should be refreshed.
6
+ * Compare the value with Date.now(). */
7
+ function inferAuthRefreshTime(info, maxRefreshSeconds) {
8
+ if (info.jwtToken === undefined)
9
+ return undefined;
10
+ const { exp, iat } = pl.parsePlJwt(info.jwtToken);
11
+ return (Math.min(
12
+ // in the middle between issue and expiration time points
13
+ (iat + exp) / 2, iat + maxRefreshSeconds) * 1000);
14
+ }
15
+ function expirationFromAuthInformation(authInfo) {
16
+ if (authInfo.jwtToken === undefined)
17
+ return undefined;
18
+ const parsed = pl.parsePlJwt(authInfo.jwtToken);
19
+ return parsed.exp * 1000;
20
+ }
21
+
22
+ exports.expirationFromAuthInformation = expirationFromAuthInformation;
23
+ exports.inferAuthRefreshTime = inferAuthRefreshTime;
24
+ //# sourceMappingURL=auth.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.cjs","sources":["../../src/core/auth.ts"],"sourcesContent":["import type { AuthInformation } from './config';\nimport { parsePlJwt } from '../util/pl';\n\n/** Returns a timestamp when current authorization information should be refreshed.\n * Compare the value with Date.now(). */\nexport function inferAuthRefreshTime(\n info: AuthInformation,\n maxRefreshSeconds: number,\n): number | undefined {\n if (info.jwtToken === undefined) return undefined;\n\n const { exp, iat } = parsePlJwt(info.jwtToken);\n\n return (\n Math.min(\n // in the middle between issue and expiration time points\n (iat + exp) / 2,\n iat + maxRefreshSeconds,\n ) * 1000\n );\n}\n\nexport function expirationFromAuthInformation(authInfo: AuthInformation): number | undefined {\n if (authInfo.jwtToken === undefined) return undefined;\n const parsed = parsePlJwt(authInfo.jwtToken);\n return parsed.exp * 1000;\n}\n"],"names":["parsePlJwt"],"mappings":";;;;AAGA;AACwC;AAClC,SAAU,oBAAoB,CAClC,IAAqB,EACrB,iBAAyB,EAAA;AAEzB,IAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAGA,aAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;IAE9C,QACE,IAAI,CAAC,GAAG;;AAEN,IAAA,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,EACf,GAAG,GAAG,iBAAiB,CACxB,GAAG,IAAI;AAEZ;AAEM,SAAU,6BAA6B,CAAC,QAAyB,EAAA;AACrE,IAAA,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IACrD,MAAM,MAAM,GAAGA,aAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC5C,IAAA,OAAO,MAAM,CAAC,GAAG,GAAG,IAAI;AAC1B;;;;;"}
@@ -3,4 +3,3 @@ import { AuthInformation } from './config';
3
3
  * Compare the value with Date.now(). */
4
4
  export declare function inferAuthRefreshTime(info: AuthInformation, maxRefreshSeconds: number): number | undefined;
5
5
  export declare function expirationFromAuthInformation(authInfo: AuthInformation): number | undefined;
6
- //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { parsePlJwt } from '../util/pl.js';
2
+
3
+ /** Returns a timestamp when current authorization information should be refreshed.
4
+ * Compare the value with Date.now(). */
5
+ function inferAuthRefreshTime(info, maxRefreshSeconds) {
6
+ if (info.jwtToken === undefined)
7
+ return undefined;
8
+ const { exp, iat } = parsePlJwt(info.jwtToken);
9
+ return (Math.min(
10
+ // in the middle between issue and expiration time points
11
+ (iat + exp) / 2, iat + maxRefreshSeconds) * 1000);
12
+ }
13
+ function expirationFromAuthInformation(authInfo) {
14
+ if (authInfo.jwtToken === undefined)
15
+ return undefined;
16
+ const parsed = parsePlJwt(authInfo.jwtToken);
17
+ return parsed.exp * 1000;
18
+ }
19
+
20
+ export { expirationFromAuthInformation, inferAuthRefreshTime };
21
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sources":["../../src/core/auth.ts"],"sourcesContent":["import type { AuthInformation } from './config';\nimport { parsePlJwt } from '../util/pl';\n\n/** Returns a timestamp when current authorization information should be refreshed.\n * Compare the value with Date.now(). */\nexport function inferAuthRefreshTime(\n info: AuthInformation,\n maxRefreshSeconds: number,\n): number | undefined {\n if (info.jwtToken === undefined) return undefined;\n\n const { exp, iat } = parsePlJwt(info.jwtToken);\n\n return (\n Math.min(\n // in the middle between issue and expiration time points\n (iat + exp) / 2,\n iat + maxRefreshSeconds,\n ) * 1000\n );\n}\n\nexport function expirationFromAuthInformation(authInfo: AuthInformation): number | undefined {\n if (authInfo.jwtToken === undefined) return undefined;\n const parsed = parsePlJwt(authInfo.jwtToken);\n return parsed.exp * 1000;\n}\n"],"names":[],"mappings":";;AAGA;AACwC;AAClC,SAAU,oBAAoB,CAClC,IAAqB,EACrB,iBAAyB,EAAA;AAEzB,IAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;IAE9C,QACE,IAAI,CAAC,GAAG;;AAEN,IAAA,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,EACf,GAAG,GAAG,iBAAiB,CACxB,GAAG,IAAI;AAEZ;AAEM,SAAU,6BAA6B,CAAC,QAAyB,EAAA;AACrE,IAAA,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC5C,IAAA,OAAO,MAAM,CAAC,GAAG,GAAG,IAAI;AAC1B;;;;"}
@@ -6,4 +6,3 @@ export type ResourceDataCacheRecord = {
6
6
  data: ResourceData | undefined;
7
7
  readonly basicData: BasicResourceData;
8
8
  };
9
- //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1,288 @@
1
+ 'use strict';
2
+
3
+ var ll_client = require('./ll_client.cjs');
4
+ var transaction = require('./transaction.cjs');
5
+ var node_crypto = require('node:crypto');
6
+ var types = require('./types.cjs');
7
+ var pl = require('../helpers/pl.cjs');
8
+ var tsHelpers = require('@milaboratories/ts-helpers');
9
+ var api = require('../proto/github.com/milaboratory/pl/plapi/plapiproto/api.cjs');
10
+ var tp = require('node:timers/promises');
11
+ var lruCache = require('lru-cache');
12
+ var final = require('./final.cjs');
13
+ var stat = require('./stat.cjs');
14
+
15
+ function _interopNamespaceDefault(e) {
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n.default = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var tp__namespace = /*#__PURE__*/_interopNamespaceDefault(tp);
33
+
34
+ const defaultTxOps = {
35
+ sync: false,
36
+ };
37
+ const AnonymousClientRoot = 'AnonymousRoot';
38
+ function alternativeRootFieldName(alternativeRoot) {
39
+ return `alternative_root_${alternativeRoot}`;
40
+ }
41
+ /** Client to access core PL API. */
42
+ class PlClient {
43
+ drivers = new Map();
44
+ /** Artificial delay introduced after write transactions completion, to
45
+ * somewhat throttle the load on pl. Delay introduced after sync, if requested. */
46
+ txDelay;
47
+ /** Last resort measure to solve complicated race conditions in pl. */
48
+ forceSync;
49
+ /** Last resort measure to solve complicated race conditions in pl. */
50
+ defaultRetryOptions;
51
+ buildLLPlClient;
52
+ _ll;
53
+ /** Stores client root (this abstraction is intended for future implementation of the security model) */
54
+ _clientRoot = types.NullResourceId;
55
+ _serverInfo = undefined;
56
+ _txCommittedStat = stat.initialTxStat();
57
+ _txConflictStat = stat.initialTxStat();
58
+ _txErrorStat = stat.initialTxStat();
59
+ //
60
+ // Caching
61
+ //
62
+ /** This function determines whether resource data can be cached */
63
+ finalPredicate;
64
+ /** Resource data cache, to minimize redundant data rereading from remote db */
65
+ resourceDataCache;
66
+ constructor(configOrAddress, auth, ops = {}) {
67
+ // Will reinitialize client after getting available feature from server.
68
+ this.buildLLPlClient = (shouldUseGzip) => {
69
+ return new ll_client.LLPlClient(configOrAddress, { auth, ...ops, shouldUseGzip });
70
+ };
71
+ this._ll = this.buildLLPlClient(false);
72
+ const conf = this._ll.conf;
73
+ this.txDelay = conf.txDelay;
74
+ this.forceSync = conf.forceSync;
75
+ this.finalPredicate = ops.finalPredicate ?? final.DefaultFinalResourceDataPredicate;
76
+ this.resourceDataCache = new lruCache.LRUCache({
77
+ maxSize: conf.maxCacheBytes,
78
+ sizeCalculation: (v) => (v.basicData.data?.length ?? 0) + 64,
79
+ });
80
+ switch (conf.retryBackoffAlgorithm) {
81
+ case 'exponential':
82
+ this.defaultRetryOptions = {
83
+ type: 'exponentialBackoff',
84
+ initialDelay: conf.retryInitialDelay,
85
+ maxAttempts: conf.retryMaxAttempts,
86
+ backoffMultiplier: conf.retryExponentialBackoffMultiplier,
87
+ jitter: conf.retryJitter,
88
+ };
89
+ break;
90
+ case 'linear':
91
+ this.defaultRetryOptions = {
92
+ type: 'linearBackoff',
93
+ initialDelay: conf.retryInitialDelay,
94
+ maxAttempts: conf.retryMaxAttempts,
95
+ backoffStep: conf.retryLinearBackoffStep,
96
+ jitter: conf.retryJitter,
97
+ };
98
+ break;
99
+ default:
100
+ tsHelpers.assertNever(conf.retryBackoffAlgorithm);
101
+ }
102
+ }
103
+ get txCommittedStat() {
104
+ return { ...this._txCommittedStat };
105
+ }
106
+ get txConflictStat() {
107
+ return { ...this._txConflictStat };
108
+ }
109
+ get txErrorStat() {
110
+ return { ...this._txErrorStat };
111
+ }
112
+ get txTotalStat() {
113
+ return stat.addStat(stat.addStat(this._txCommittedStat, this._txConflictStat), this._txErrorStat);
114
+ }
115
+ get allTxStat() {
116
+ return {
117
+ committed: this.txCommittedStat,
118
+ conflict: this.txConflictStat,
119
+ error: this.txErrorStat,
120
+ };
121
+ }
122
+ async ping() {
123
+ return (await this._ll.grpcPl.get().ping({})).response;
124
+ }
125
+ get conf() {
126
+ return this._ll.conf;
127
+ }
128
+ get httpDispatcher() {
129
+ return this._ll.httpDispatcher;
130
+ }
131
+ get grpcTransport() {
132
+ return this._ll.grpcTransport;
133
+ }
134
+ get initialized() {
135
+ return !types.isNullResourceId(this._clientRoot);
136
+ }
137
+ checkInitialized() {
138
+ if (!this.initialized)
139
+ throw new Error('Client not initialized');
140
+ }
141
+ get clientRoot() {
142
+ this.checkInitialized();
143
+ return types.ensureResourceIdNotNull(this._clientRoot);
144
+ }
145
+ get serverInfo() {
146
+ this.checkInitialized();
147
+ return this._serverInfo;
148
+ }
149
+ /** Currently implements custom logic to emulate future behaviour with single root. */
150
+ async init() {
151
+ if (this.initialized)
152
+ throw new Error('Already initialized');
153
+ // calculating reproducible root name from the username
154
+ const user = this._ll.authUser;
155
+ const mainRootName = user === null ? AnonymousClientRoot : node_crypto.createHash('sha256').update(user).digest('hex');
156
+ this._serverInfo = await this.ping();
157
+ if (this._serverInfo.compression === api.MaintenanceAPI_Ping_Response_Compression.GZIP) {
158
+ await this._ll.close();
159
+ this._ll = this.buildLLPlClient(true);
160
+ }
161
+ this._clientRoot = await this._withTx('initialization', true, types.NullResourceId, async (tx) => {
162
+ let mainRoot;
163
+ if (await tx.checkResourceNameExists(mainRootName))
164
+ mainRoot = await tx.getResourceByName(mainRootName);
165
+ else {
166
+ mainRoot = tx.createRoot(pl.ClientRoot);
167
+ tx.setResourceName(mainRootName, mainRoot);
168
+ }
169
+ if (this.conf.alternativeRoot === undefined) {
170
+ await tx.commit();
171
+ return await transaction.toGlobalResourceId(mainRoot);
172
+ }
173
+ else {
174
+ const aFId = {
175
+ resourceId: mainRoot,
176
+ fieldName: alternativeRootFieldName(this.conf.alternativeRoot),
177
+ };
178
+ const altRoot = tx.createEphemeral(pl.ClientRoot);
179
+ tx.lock(altRoot);
180
+ tx.createField(aFId, 'Dynamic');
181
+ tx.setField(aFId, altRoot);
182
+ await tx.commit();
183
+ return await altRoot.globalId;
184
+ }
185
+ });
186
+ }
187
+ /** Returns true if field existed */
188
+ async deleteAlternativeRoot(alternativeRootName) {
189
+ this.checkInitialized();
190
+ if (this._ll.conf.alternativeRoot !== undefined)
191
+ throw new Error('Initialized with alternative root.');
192
+ return await this.withWriteTx('delete-alternative-root', async (tx) => {
193
+ const fId = {
194
+ resourceId: tx.clientRoot,
195
+ fieldName: alternativeRootFieldName(alternativeRootName),
196
+ };
197
+ const exists = tx.fieldExists(fId);
198
+ tx.removeField(fId);
199
+ await tx.commit();
200
+ return await exists;
201
+ });
202
+ }
203
+ async _withTx(name, writable, clientRoot, body, ops) {
204
+ // for exponential / linear backoff
205
+ let retryState = tsHelpers.createRetryState(ops?.retryOptions ?? this.defaultRetryOptions);
206
+ while (true) {
207
+ // opening low-level tx
208
+ const llTx = this._ll.createTx(writable, ops);
209
+ // wrapping it into high-level tx (this also asynchronously sends initialization message)
210
+ const tx = new transaction.PlTransaction(llTx, name, writable, clientRoot, this.finalPredicate, this.resourceDataCache);
211
+ let ok = false;
212
+ let result = undefined;
213
+ let txId;
214
+ try {
215
+ // executing transaction body
216
+ result = await body(tx);
217
+ // collecting stat
218
+ this._txCommittedStat = stat.addStat(this._txCommittedStat, tx.stat);
219
+ ok = true;
220
+ }
221
+ catch (e) {
222
+ // the only recoverable
223
+ if (e instanceof transaction.TxCommitConflict) {
224
+ // ignoring
225
+ // collecting stat
226
+ this._txConflictStat = stat.addStat(this._txConflictStat, tx.stat);
227
+ }
228
+ else {
229
+ // collecting stat
230
+ this._txErrorStat = stat.addStat(this._txErrorStat, tx.stat);
231
+ throw e;
232
+ }
233
+ }
234
+ finally {
235
+ // close underlying grpc stream, if not yet done
236
+ // even though we can skip two lines below for read-only transactions,
237
+ // we don't do it to simplify reasoning about what is going on in
238
+ // concurrent code, especially in significant latency situations
239
+ await tx.complete();
240
+ await tx.await();
241
+ txId = await tx.getGlobalTxId();
242
+ }
243
+ if (ok) {
244
+ // syncing on transaction if requested
245
+ if (ops?.sync === undefined ? this.forceSync : ops?.sync)
246
+ await this._ll.grpcPl.get().txSync({ txId });
247
+ // introducing artificial delay, if requested
248
+ if (writable && this.txDelay > 0)
249
+ await tp__namespace.setTimeout(this.txDelay, undefined, { signal: ops?.abortSignal });
250
+ return result;
251
+ }
252
+ // we only get here after TxCommitConflict error,
253
+ // all other errors terminate this loop instantly
254
+ await tp__namespace.setTimeout(retryState.nextDelay, undefined, { signal: ops?.abortSignal });
255
+ retryState = tsHelpers.nextRetryStateOrError(retryState);
256
+ }
257
+ }
258
+ async withTx(name, writable, body, ops = {}) {
259
+ this.checkInitialized();
260
+ return await this._withTx(name, writable, this.clientRoot, body, { ...ops, ...defaultTxOps });
261
+ }
262
+ async withWriteTx(name, body, ops = {}) {
263
+ return await this.withTx(name, true, body, { ...ops, ...defaultTxOps });
264
+ }
265
+ async withReadTx(name, body, ops = {}) {
266
+ return await this.withTx(name, false, body, { ...ops, ...defaultTxOps });
267
+ }
268
+ getDriver(definition) {
269
+ const attached = this.drivers.get(definition.name);
270
+ if (attached !== undefined)
271
+ return attached;
272
+ const driver = definition.init(this, this._ll, this.httpDispatcher);
273
+ this.drivers.set(definition.name, driver);
274
+ return driver;
275
+ }
276
+ /** Closes underlying transport */
277
+ async close() {
278
+ await this._ll.close();
279
+ }
280
+ static async init(configOrAddress, auth, ops = {}) {
281
+ const pl = new PlClient(configOrAddress, auth, ops);
282
+ await pl.init();
283
+ return pl;
284
+ }
285
+ }
286
+
287
+ exports.PlClient = PlClient;
288
+ //# sourceMappingURL=client.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.cjs","sources":["../../src/core/client.ts"],"sourcesContent":["import type { AuthOps, PlClientConfig, PlConnectionStatusListener } from './config';\nimport type { PlCallOps } from './ll_client';\nimport { LLPlClient } from './ll_client';\nimport type { AnyResourceRef } from './transaction';\nimport { PlTransaction, toGlobalResourceId, TxCommitConflict } from './transaction';\nimport { createHash } from 'node:crypto';\nimport type { OptionalResourceId, ResourceId } from './types';\nimport { ensureResourceIdNotNull, isNullResourceId, NullResourceId } from './types';\nimport { ClientRoot } from '../helpers/pl';\nimport type { RetryOptions } from '@milaboratories/ts-helpers';\nimport { assertNever, createRetryState, nextRetryStateOrError } from '@milaboratories/ts-helpers';\nimport type { PlDriver, PlDriverDefinition } from './driver';\nimport type { MaintenanceAPI_Ping_Response } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { MaintenanceAPI_Ping_Response_Compression } from '../proto/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport * as tp from 'node:timers/promises';\nimport type { Dispatcher } from 'undici';\nimport { LRUCache } from 'lru-cache';\nimport type { ResourceDataCacheRecord } from './cache';\nimport type { FinalResourceDataPredicate } from './final';\nimport { DefaultFinalResourceDataPredicate } from './final';\nimport type { AllTxStat, TxStat } from './stat';\nimport { addStat, initialTxStat } from './stat';\nimport type { GrpcTransport } from '@protobuf-ts/grpc-transport';\n\nexport type TxOps = PlCallOps & {\n sync?: boolean;\n retryOptions?: RetryOptions;\n};\n\nconst defaultTxOps = {\n sync: false,\n};\n\nconst AnonymousClientRoot = 'AnonymousRoot';\n\nfunction alternativeRootFieldName(alternativeRoot: string): string {\n return `alternative_root_${alternativeRoot}`;\n}\n\n/** Client to access core PL API. */\nexport class PlClient {\n private readonly drivers = new Map<string, PlDriver>();\n\n /** Artificial delay introduced after write transactions completion, to\n * somewhat throttle the load on pl. Delay introduced after sync, if requested. */\n private readonly txDelay: number;\n\n /** Last resort measure to solve complicated race conditions in pl. */\n private readonly forceSync: boolean;\n\n /** Last resort measure to solve complicated race conditions in pl. */\n private readonly defaultRetryOptions: RetryOptions;\n\n private readonly buildLLPlClient: (shouldUseGzip: boolean) => LLPlClient;\n private _ll: LLPlClient;\n /** Stores client root (this abstraction is intended for future implementation of the security model) */\n private _clientRoot: OptionalResourceId = NullResourceId;\n\n private _serverInfo: MaintenanceAPI_Ping_Response | undefined = undefined;\n\n private _txCommittedStat: TxStat = initialTxStat();\n private _txConflictStat: TxStat = initialTxStat();\n private _txErrorStat: TxStat = initialTxStat();\n\n //\n // Caching\n //\n\n /** This function determines whether resource data can be cached */\n public readonly finalPredicate: FinalResourceDataPredicate;\n\n /** Resource data cache, to minimize redundant data rereading from remote db */\n private readonly resourceDataCache: LRUCache<ResourceId, ResourceDataCacheRecord>;\n\n private constructor(\n configOrAddress: PlClientConfig | string,\n auth: AuthOps,\n ops: {\n statusListener?: PlConnectionStatusListener;\n finalPredicate?: FinalResourceDataPredicate;\n } = {},\n ) {\n // Will reinitialize client after getting available feature from server.\n this.buildLLPlClient = (shouldUseGzip: boolean) => {\n return new LLPlClient(configOrAddress, { auth, ...ops, shouldUseGzip });\n };\n this._ll = this.buildLLPlClient(false);\n const conf = this._ll.conf;\n this.txDelay = conf.txDelay;\n this.forceSync = conf.forceSync;\n this.finalPredicate = ops.finalPredicate ?? DefaultFinalResourceDataPredicate;\n this.resourceDataCache = new LRUCache({\n maxSize: conf.maxCacheBytes,\n sizeCalculation: (v) => (v.basicData.data?.length ?? 0) + 64,\n });\n switch (conf.retryBackoffAlgorithm) {\n case 'exponential':\n this.defaultRetryOptions = {\n type: 'exponentialBackoff',\n initialDelay: conf.retryInitialDelay,\n maxAttempts: conf.retryMaxAttempts,\n backoffMultiplier: conf.retryExponentialBackoffMultiplier,\n jitter: conf.retryJitter,\n };\n break;\n case 'linear':\n this.defaultRetryOptions = {\n type: 'linearBackoff',\n initialDelay: conf.retryInitialDelay,\n maxAttempts: conf.retryMaxAttempts,\n backoffStep: conf.retryLinearBackoffStep,\n jitter: conf.retryJitter,\n };\n break;\n default:\n assertNever(conf.retryBackoffAlgorithm);\n }\n }\n\n public get txCommittedStat(): TxStat {\n return { ...this._txCommittedStat };\n }\n\n public get txConflictStat(): TxStat {\n return { ...this._txConflictStat };\n }\n\n public get txErrorStat(): TxStat {\n return { ...this._txErrorStat };\n }\n\n public get txTotalStat(): TxStat {\n return addStat(addStat(this._txCommittedStat, this._txConflictStat), this._txErrorStat);\n }\n\n public get allTxStat(): AllTxStat {\n return {\n committed: this.txCommittedStat,\n conflict: this.txConflictStat,\n error: this.txErrorStat,\n };\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return (await this._ll.grpcPl.get().ping({})).response;\n }\n\n public get conf(): PlClientConfig {\n return this._ll.conf;\n }\n\n public get httpDispatcher(): Dispatcher {\n return this._ll.httpDispatcher;\n }\n\n public get grpcTransport(): GrpcTransport {\n return this._ll.grpcTransport;\n }\n\n private get initialized() {\n return !isNullResourceId(this._clientRoot);\n }\n\n private checkInitialized() {\n if (!this.initialized) throw new Error('Client not initialized');\n }\n\n public get clientRoot(): ResourceId {\n this.checkInitialized();\n return ensureResourceIdNotNull(this._clientRoot);\n }\n\n public get serverInfo(): MaintenanceAPI_Ping_Response {\n this.checkInitialized();\n return this._serverInfo!;\n }\n\n /** Currently implements custom logic to emulate future behaviour with single root. */\n public async init() {\n if (this.initialized) throw new Error('Already initialized');\n\n // calculating reproducible root name from the username\n const user = this._ll.authUser;\n const mainRootName\n = user === null ? AnonymousClientRoot : createHash('sha256').update(user).digest('hex');\n\n this._serverInfo = await this.ping();\n if (this._serverInfo.compression === MaintenanceAPI_Ping_Response_Compression.GZIP) {\n await this._ll.close();\n this._ll = this.buildLLPlClient(true);\n }\n\n this._clientRoot = await this._withTx('initialization', true, NullResourceId, async (tx) => {\n let mainRoot: AnyResourceRef;\n\n if (await tx.checkResourceNameExists(mainRootName))\n mainRoot = await tx.getResourceByName(mainRootName);\n else {\n mainRoot = tx.createRoot(ClientRoot);\n tx.setResourceName(mainRootName, mainRoot);\n }\n\n if (this.conf.alternativeRoot === undefined) {\n await tx.commit();\n return await toGlobalResourceId(mainRoot);\n } else {\n const aFId = {\n resourceId: mainRoot,\n fieldName: alternativeRootFieldName(this.conf.alternativeRoot),\n };\n\n const altRoot = tx.createEphemeral(ClientRoot);\n tx.lock(altRoot);\n tx.createField(aFId, 'Dynamic');\n tx.setField(aFId, altRoot);\n await tx.commit();\n\n return await altRoot.globalId;\n }\n });\n }\n\n /** Returns true if field existed */\n public async deleteAlternativeRoot(alternativeRootName: string): Promise<boolean> {\n this.checkInitialized();\n if (this._ll.conf.alternativeRoot !== undefined)\n throw new Error('Initialized with alternative root.');\n return await this.withWriteTx('delete-alternative-root', async (tx) => {\n const fId = {\n resourceId: tx.clientRoot,\n fieldName: alternativeRootFieldName(alternativeRootName),\n };\n const exists = tx.fieldExists(fId);\n tx.removeField(fId);\n await tx.commit();\n return await exists;\n });\n }\n\n private async _withTx<T>(\n name: string,\n writable: boolean,\n clientRoot: OptionalResourceId,\n body: (tx: PlTransaction) => Promise<T>,\n ops?: TxOps,\n ): Promise<T> {\n // for exponential / linear backoff\n let retryState = createRetryState(ops?.retryOptions ?? this.defaultRetryOptions);\n\n while (true) {\n // opening low-level tx\n const llTx = this._ll.createTx(writable, ops);\n // wrapping it into high-level tx (this also asynchronously sends initialization message)\n const tx = new PlTransaction(\n llTx,\n name,\n writable,\n clientRoot,\n this.finalPredicate,\n this.resourceDataCache,\n );\n\n let ok = false;\n let result: T | undefined = undefined;\n let txId;\n\n try {\n // executing transaction body\n result = await body(tx);\n // collecting stat\n this._txCommittedStat = addStat(this._txCommittedStat, tx.stat);\n ok = true;\n } catch (e: unknown) {\n // the only recoverable\n if (e instanceof TxCommitConflict) {\n // ignoring\n // collecting stat\n this._txConflictStat = addStat(this._txConflictStat, tx.stat);\n } else {\n // collecting stat\n this._txErrorStat = addStat(this._txErrorStat, tx.stat);\n throw e;\n }\n } finally {\n // close underlying grpc stream, if not yet done\n\n // even though we can skip two lines below for read-only transactions,\n // we don't do it to simplify reasoning about what is going on in\n // concurrent code, especially in significant latency situations\n await tx.complete();\n await tx.await();\n\n txId = await tx.getGlobalTxId();\n }\n\n if (ok) {\n // syncing on transaction if requested\n if (ops?.sync === undefined ? this.forceSync : ops?.sync)\n await this._ll.grpcPl.get().txSync({ txId });\n\n // introducing artificial delay, if requested\n if (writable && this.txDelay > 0)\n await tp.setTimeout(this.txDelay, undefined, { signal: ops?.abortSignal });\n\n return result!;\n }\n\n // we only get here after TxCommitConflict error,\n // all other errors terminate this loop instantly\n\n await tp.setTimeout(retryState.nextDelay, undefined, { signal: ops?.abortSignal });\n retryState = nextRetryStateOrError(retryState);\n }\n }\n\n private async withTx<T>(\n name: string,\n writable: boolean,\n body: (tx: PlTransaction) => Promise<T>,\n ops: Partial<TxOps> = {},\n ): Promise<T> {\n this.checkInitialized();\n return await this._withTx(name, writable, this.clientRoot, body, { ...ops, ...defaultTxOps });\n }\n\n public async withWriteTx<T>(\n name: string,\n body: (tx: PlTransaction) => Promise<T>,\n ops: Partial<TxOps> = {},\n ): Promise<T> {\n return await this.withTx(name, true, body, { ...ops, ...defaultTxOps });\n }\n\n public async withReadTx<T>(\n name: string,\n body: (tx: PlTransaction) => Promise<T>,\n ops: Partial<TxOps> = {},\n ): Promise<T> {\n return await this.withTx(name, false, body, { ...ops, ...defaultTxOps });\n }\n\n public getDriver<Drv extends PlDriver>(definition: PlDriverDefinition<Drv>): Drv {\n const attached = this.drivers.get(definition.name);\n if (attached !== undefined) return attached as Drv;\n const driver = definition.init(this, this._ll, this.httpDispatcher);\n this.drivers.set(definition.name, driver);\n return driver;\n }\n\n /** Closes underlying transport */\n public async close() {\n await this._ll.close();\n }\n\n public static async init(\n configOrAddress: PlClientConfig | string,\n auth: AuthOps,\n ops: {\n statusListener?: PlConnectionStatusListener;\n } = {},\n ) {\n const pl = new PlClient(configOrAddress, auth, ops);\n await pl.init();\n return pl;\n }\n}\n"],"names":["NullResourceId","initialTxStat","LLPlClient","DefaultFinalResourceDataPredicate","LRUCache","assertNever","addStat","isNullResourceId","ensureResourceIdNotNull","createHash","MaintenanceAPI_Ping_Response_Compression","ClientRoot","toGlobalResourceId","createRetryState","PlTransaction","TxCommitConflict","tp","nextRetryStateOrError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,KAAK;CACZ;AAED,MAAM,mBAAmB,GAAG,eAAe;AAE3C,SAAS,wBAAwB,CAAC,eAAuB,EAAA;IACvD,OAAO,CAAA,iBAAA,EAAoB,eAAe,CAAA,CAAE;AAC9C;AAEA;MACa,QAAQ,CAAA;AACF,IAAA,OAAO,GAAG,IAAI,GAAG,EAAoB;AAEtD;AACkF;AACjE,IAAA,OAAO;;AAGP,IAAA,SAAS;;AAGT,IAAA,mBAAmB;AAEnB,IAAA,eAAe;AACxB,IAAA,GAAG;;IAEH,WAAW,GAAuBA,oBAAc;IAEhD,WAAW,GAA6C,SAAS;IAEjE,gBAAgB,GAAWC,kBAAa,EAAE;IAC1C,eAAe,GAAWA,kBAAa,EAAE;IACzC,YAAY,GAAWA,kBAAa,EAAE;;;;;AAO9B,IAAA,cAAc;;AAGb,IAAA,iBAAiB;AAElC,IAAA,WAAA,CACE,eAAwC,EACxC,IAAa,EACb,MAGI,EAAE,EAAA;;AAGN,QAAA,IAAI,CAAC,eAAe,GAAG,CAAC,aAAsB,KAAI;AAChD,YAAA,OAAO,IAAIC,oBAAU,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,GAAG,EAAE,aAAa,EAAE,CAAC;AACzE,QAAA,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,eAAe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AAE,GAAG,YAAY,EAAE,CAAC;IAC1E;AAEO,IAAA,SAAS,CAAuB,UAAmC,EAAA;AACxE,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS;AAAE,YAAA,OAAO,QAAe;AAClD,QAAA,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC;QACnE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;AACzC,QAAA,OAAO,MAAM;IACf;;AAGO,IAAA,MAAM,KAAK,GAAA;AAChB,QAAA,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE;IACxB;IAEO,aAAa,IAAI,CACtB,eAAwC,EACxC,IAAa,EACb,GAAA,GAEI,EAAE,EAAA;QAEN,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,CAAC;AACnD,QAAA,MAAM,EAAE,CAAC,IAAI,EAAE;AACf,QAAA,OAAO,EAAE;IACX;AACD;;;;"}
@@ -64,4 +64,3 @@ export declare class PlClient {
64
64
  statusListener?: PlConnectionStatusListener;
65
65
  }): Promise<PlClient>;
66
66
  }
67
- //# sourceMappingURL=client.d.ts.map