@milaboratories/pl-client 2.11.7 → 2.11.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.
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  var Xi = Object.defineProperty;
2
2
  var Qi = (l, e, t) => e in l ? Xi(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
3
  var y = (l, e, t) => Qi(l, typeof e != "symbol" ? e + "" : e, t);
4
- import { cachedDeserialize as mi, notEmpty as R, Aborted as gi, assertNever as ki, canonicalJsonBytes as er, canonicalJsonGzBytes as tr, deepFreeze as Gn, createRetryState as bi, nextRetryStateOrError as Ti } from "@milaboratories/ts-helpers";
4
+ import { cachedDeserialize as mi, notEmpty as R, Aborted as gi, assertNever as ki, canonicalJsonBytes as er, canonicalJsonGzBytes as tr, deepFreeze as Yn, createRetryState as bi, nextRetryStateOrError as Ti } from "@milaboratories/ts-helpers";
5
5
  import { ServiceType as nr, stackIntercept as g } from "@protobuf-ts/runtime-rpc";
6
- import { MessageType as h, PbLong as F, typeofJsonValue as Bn, reflectionMergePartial as p, UnknownFieldHandler as f, WireType as d, jsonWriteOptions as ir, isJsonObject as Jn } from "@protobuf-ts/runtime";
7
- import { compressionAlgorithms as rr, ChannelCredentials as zn, InterceptingCall as Hn, status as Yn } from "@grpc/grpc-js";
6
+ import { MessageType as h, PbLong as F, typeofJsonValue as En, reflectionMergePartial as p, UnknownFieldHandler as f, WireType as d, jsonWriteOptions as ir, isJsonObject as Zn } from "@protobuf-ts/runtime";
7
+ import { compressionAlgorithms as rr, ChannelCredentials as Xn, InterceptingCall as Qn, status as ei } from "@grpc/grpc-js";
8
8
  import { GrpcTransport as sr } from "@protobuf-ts/grpc-transport";
9
9
  import or from "denque";
10
10
  import { defaultHttpDispatcher as ar } from "@milaboratories/pl-http";
@@ -16,7 +16,7 @@ import E from "node:fs";
16
16
  import cr from "canonicalize";
17
17
  import ur from "yaml";
18
18
  import * as Pi from "node:os";
19
- import * as $n from "node:path";
19
+ import * as xn from "node:path";
20
20
  const S = 0n;
21
21
  function B(l) {
22
22
  return l === S;
@@ -67,23 +67,23 @@ function fr(l) {
67
67
  };
68
68
  }
69
69
  const pf = (l) => Buffer.from(JSON.stringify(l)), yf = (l) => mi(R(l.data));
70
- function Zn(l, e) {
70
+ function ti(l, e) {
71
71
  return R(l.fields.find((t) => t.name === e));
72
72
  }
73
- const Un = 1n << 63n, Ni = 1n << 62n, dr = 0x3fffffffffffffffn, _i = 24n, Li = 16777215, Fn = 4294967295, hr = BigInt(Fn), pr = BigInt(Li);
74
- function Xn(l) {
75
- return (l & Un) !== 0n;
73
+ const Wn = 1n << 63n, Ni = 1n << 62n, dr = 0x3fffffffffffffffn, _i = 24n, Li = 16777215, Sn = 4294967295, hr = BigInt(Sn), pr = BigInt(Li);
74
+ function ni(l) {
75
+ return (l & Wn) !== 0n;
76
76
  }
77
77
  function x(l) {
78
78
  return (l & Ni) !== 0n;
79
79
  }
80
80
  function Ai(l, e, t) {
81
- if (e > Li || t > Fn || e < 0 || t <= 0)
81
+ if (e > Li || t > Sn || e < 0 || t <= 0)
82
82
  throw Error("wrong local id or tx id");
83
- return (l ? Un : 0n) | Ni | BigInt(e) | BigInt(t) << _i;
83
+ return (l ? Wn : 0n) | Ni | BigInt(e) | BigInt(t) << _i;
84
84
  }
85
85
  function yr(l, e) {
86
- return (l ? Un : 0n) | e;
86
+ return (l ? Wn : 0n) | e;
87
87
  }
88
88
  function Bi(l) {
89
89
  return Number(l >> _i & hr);
@@ -95,7 +95,7 @@ function wf(l, e) {
95
95
  );
96
96
  }
97
97
  function we(l) {
98
- return B(l) ? "XX:0x0" : x(l) ? (Xn(l) ? "R" : "N") + "L:0x" + (pr & l).toString(16) + "[0x" + Bi(l).toString(16) + "]" : (Xn(l) ? "R" : "N") + "G:0x" + (dr & l).toString(16);
98
+ return B(l) ? "XX:0x0" : x(l) ? (ni(l) ? "R" : "N") + "L:0x" + (pr & l).toString(16) + "[0x" + Bi(l).toString(16) + "]" : (ni(l) ? "R" : "N") + "G:0x" + (dr & l).toString(16);
99
99
  }
100
100
  const wr = /^(?:(?<xx>XX)|(?<rn>[XRN])(?<lg>[XLG])):0x(?<rid>[0-9a-fA-F]+)(?:\[0x(?<txid>[0-9a-fA-F]+)])?$/;
101
101
  function mf(l) {
@@ -155,7 +155,7 @@ class mr extends h {
155
155
  */
156
156
  internalJsonRead(e, t, i) {
157
157
  if (typeof e != "string")
158
- throw new Error("Unable to parse Duration from JSON " + Bn(e) + ". Expected string.");
158
+ throw new Error("Unable to parse Duration from JSON " + En(e) + ". Expected string.");
159
159
  let n = e.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
160
160
  if (n === null)
161
161
  throw new Error("Unable to parse Duration from JSON string. Invalid format.");
@@ -939,7 +939,7 @@ class _r extends h {
939
939
  */
940
940
  internalJsonRead(e, t, i) {
941
941
  if (typeof e != "string")
942
- throw new Error("Unable to parse Timestamp from JSON " + Bn(e) + ".");
942
+ throw new Error("Unable to parse Timestamp from JSON " + En(e) + ".");
943
943
  let n = e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
944
944
  if (!n)
945
945
  throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
@@ -2117,12 +2117,12 @@ class qr extends h {
2117
2117
  if (!r)
2118
2118
  throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + e.typeUrl + "' to JSON. The specified type " + i + " is not available in the type registry.");
2119
2119
  let c = r.fromBinary(e.value, { readUnknownField: !1 }), a = r.internalJsonWrite(c, n);
2120
- return (i.startsWith("google.protobuf.") || !Jn(a)) && (a = { value: a }), a["@type"] = e.typeUrl, a;
2120
+ return (i.startsWith("google.protobuf.") || !Zn(a)) && (a = { value: a }), a["@type"] = e.typeUrl, a;
2121
2121
  }
2122
2122
  internalJsonRead(e, t, i) {
2123
2123
  var a;
2124
- if (!Jn(e))
2125
- throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + Bn(e) + ".");
2124
+ if (!Zn(e))
2125
+ throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + En(e) + ".");
2126
2126
  if (typeof e["@type"] != "string" || e["@type"] == "")
2127
2127
  return this.create();
2128
2128
  let n = this.typeUrlToName(e["@type"]), r = (a = t == null ? void 0 : t.typeRegistry) == null ? void 0 : a.find((o) => o.typeName == n);
@@ -2244,7 +2244,7 @@ class Or extends h {
2244
2244
  }
2245
2245
  }
2246
2246
  const Ae = new Or();
2247
- var he = /* @__PURE__ */ ((l) => (l[l.INVALID = 0] = "INVALID", l[l.WRITABLE = 1] = "WRITABLE", l[l.NOT_WRITABLE = 2] = "NOT_WRITABLE", l))(he || {}), En = /* @__PURE__ */ ((l) => (l[l.NONE = 0] = "NONE", l[l.GZIP = 1] = "GZIP", l))(En || {});
2247
+ var he = /* @__PURE__ */ ((l) => (l[l.INVALID = 0] = "INVALID", l[l.WRITABLE = 1] = "WRITABLE", l[l.NOT_WRITABLE = 2] = "NOT_WRITABLE", l))(he || {}), Cn = /* @__PURE__ */ ((l) => (l[l.NONE = 0] = "NONE", l[l.GZIP = 1] = "GZIP", l))(Cn || {});
2248
2248
  class Kr extends h {
2249
2249
  constructor() {
2250
2250
  super("MiLaboratories.PL.API.TxAPI", []);
@@ -12349,7 +12349,7 @@ class Xc extends h {
12349
12349
  T: 9
12350
12350
  /*ScalarType.STRING*/
12351
12351
  },
12352
- { no: 4, name: "compression", kind: "enum", T: () => ["MiLaboratories.PL.API.MaintenanceAPI.Ping.Response.Compression", En] },
12352
+ { no: 4, name: "compression", kind: "enum", T: () => ["MiLaboratories.PL.API.MaintenanceAPI.Ping.Response.Compression", Cn] },
12353
12353
  {
12354
12354
  no: 5,
12355
12355
  name: "instance_id",
@@ -12443,12 +12443,12 @@ function $i(l, e = !1) {
12443
12443
  return l instanceof Wi || l.name == "RpcError" && l.code == "UNAVAILABLE" ? !0 : l.cause !== void 0 && !e ? $i(l.cause, !0) : !1;
12444
12444
  }
12445
12445
  function Ui(l, e = !1) {
12446
- return l instanceof Sn || l.name == "RpcError" && l.code == "UNAUTHENTICATED" ? !0 : l.cause !== void 0 && !e ? Ui(l.cause, !0) : !1;
12446
+ return l instanceof qn || l.name == "RpcError" && l.code == "UNAUTHENTICATED" ? !0 : l.cause !== void 0 && !e ? Ui(l.cause, !0) : !1;
12447
12447
  }
12448
12448
  function Fi(l, e = !1) {
12449
12449
  return l instanceof gi || l.name == "AbortError" || l.code == "ABORT_ERR" || l.name == "RpcError" && (l.code == "CANCELLED" || l.code == "DEADLINE_EXCEEDED") ? !0 : l.cause !== void 0 && !e ? Fi(l.cause, !0) : !1;
12450
12450
  }
12451
- const xn = 5;
12451
+ const Dn = 5;
12452
12452
  class Ei extends Error {
12453
12453
  constructor(t) {
12454
12454
  super(`code=${t.code} ${t.message}`);
@@ -12457,9 +12457,9 @@ class Ei extends Error {
12457
12457
  }
12458
12458
  }
12459
12459
  function nu(l) {
12460
- throw new Wn({ code: xn, message: l, details: [] });
12460
+ throw new vn({ code: Dn, message: l, details: [] });
12461
12461
  }
12462
- class Wn extends Ei {
12462
+ class vn extends Ei {
12463
12463
  constructor(t) {
12464
12464
  super(t);
12465
12465
  y(this, "name", "RecoverablePlError");
@@ -12472,9 +12472,9 @@ class iu extends Ei {
12472
12472
  }
12473
12473
  }
12474
12474
  function xi(l, e = !1) {
12475
- return l.name == "RpcError" && l.code == "NOT_FOUND" ? !0 : l.cause !== void 0 && !e ? xi(l.cause, !0) : l instanceof Wn && l.status.code === xn;
12475
+ return l.name == "RpcError" && l.code == "NOT_FOUND" ? !0 : l.cause !== void 0 && !e ? xi(l.cause, !0) : l instanceof vn && l.status.code === Dn;
12476
12476
  }
12477
- class Sn extends Error {
12477
+ class qn extends Error {
12478
12478
  constructor(t) {
12479
12479
  super("LoginFailed: " + t);
12480
12480
  y(this, "name", "UnauthenticatedError");
@@ -12487,13 +12487,13 @@ class Wi extends Error {
12487
12487
  }
12488
12488
  }
12489
12489
  function ru(l, e = !1) {
12490
- throw Ui(l) ? new Sn(l.message) : $i(l) ? new Wi(l.message) : Fi(l) ? new gi(l) : e ? new Error(l.message, { cause: l }) : l;
12490
+ throw Ui(l) ? new qn(l.message) : $i(l) ? new Wi(l.message) : Fi(l) ? new gi(l) : e ? new Error(l.message, { cause: l }) : l;
12491
12491
  }
12492
12492
  const Si = "resourceError";
12493
12493
  function su(l) {
12494
12494
  return l.deletedTime !== void 0 && l.deletedTime.seconds !== 0n;
12495
12495
  }
12496
- function Qn(l) {
12496
+ function ii(l) {
12497
12497
  var e;
12498
12498
  return su(l) && nu("resource deleted"), {
12499
12499
  id: l.id,
@@ -12682,7 +12682,7 @@ function T(l) {
12682
12682
  async function hu(l) {
12683
12683
  return M(l) ? await l.globalId : l;
12684
12684
  }
12685
- function Cn(l, e) {
12685
+ function On(l, e) {
12686
12686
  return { resourceId: l, fieldName: e };
12687
12687
  }
12688
12688
  class qi extends Error {
@@ -12819,7 +12819,7 @@ const $ = class $ {
12819
12819
  loadFields: t
12820
12820
  }
12821
12821
  },
12822
- (i) => Qn(R(i.resourceGetSingleton.resource))
12822
+ (i) => ii(R(i.resourceGetSingleton.resource))
12823
12823
  );
12824
12824
  }
12825
12825
  createResource(e, t, i) {
@@ -12932,16 +12932,16 @@ const $ = class $ {
12932
12932
  oneofKind: "resourceGet",
12933
12933
  resourceGet: { resourceId: T(e), loadFields: t }
12934
12934
  },
12935
- (o) => Qn(R(o.resourceGet.resource))
12935
+ (o) => ii(R(o.resourceGet.resource))
12936
12936
  );
12937
12937
  if (this._stat.rGetDataNetRequests++, this._stat.rGetDataNetBytes += ((a = n.data) == null ? void 0 : a.length) ?? 0, this._stat.rGetDataNetFields += n.fields.length, !M(e) && !x(e) && this.finalPredicate(n)) {
12938
- Gn(n);
12938
+ Yn(n);
12939
12939
  const o = this.sharedResourceDataCache.get(e);
12940
12940
  if (o)
12941
12941
  t && !o.data && (o.data = n, o.cacheTxOpenTimestamp = this.txOpenTimestamp);
12942
12942
  else {
12943
12943
  const s = fr(n);
12944
- Gn(s), t ? this.sharedResourceDataCache.set(e, {
12944
+ Yn(s), t ? this.sharedResourceDataCache.set(e, {
12945
12945
  basicData: s,
12946
12946
  data: n,
12947
12947
  cacheTxOpenTimestamp: this.txOpenTimestamp
@@ -13168,7 +13168,7 @@ const $ = class $ {
13168
13168
  return Ai(e, ++this.localResourceIdCounter, this.localTxId);
13169
13169
  }
13170
13170
  static nextLocalTxId() {
13171
- return $.localTxIdCounter++, $.localTxIdCounter === Fn && ($.localTxIdCounter = 1), $.localTxIdCounter;
13171
+ return $.localTxIdCounter++, $.localTxIdCounter === Sn && ($.localTxIdCounter = 1), $.localTxIdCounter;
13172
13172
  }
13173
13173
  };
13174
13174
  y($, "localTxIdCounter", 0);
@@ -13176,7 +13176,7 @@ let _n = $;
13176
13176
  function I(l, e) {
13177
13177
  return { name: l, version: e };
13178
13178
  }
13179
- const Ln = I("ClientRoot", "1"), pu = I("StructTest", "1"), yu = I("ValueTest", "1"), Oi = I("json/string", "1"), Ki = I("json/bool", "1"), pe = I("json/object", "1"), ji = I("json-gz/object", "1"), Vi = I("json/array", "1"), Mi = I("json/number", "1"), Gi = I("json/null", "1"), wu = I("Null", "1"), Dn = I("EphStdMap", "1"), vn = I("StdMap", "1");
13179
+ const Ln = I("ClientRoot", "1"), pu = I("StructTest", "1"), yu = I("ValueTest", "1"), Oi = I("json/string", "1"), Ki = I("json/bool", "1"), pe = I("json/object", "1"), ji = I("json-gz/object", "1"), Vi = I("json/array", "1"), Mi = I("json/number", "1"), Gi = I("json/null", "1"), wu = I("Null", "1"), Kn = I("EphStdMap", "1"), jn = I("StdMap", "1");
13180
13180
  function mu(l) {
13181
13181
  return l.createValue(Gi, Buffer.from(JSON.stringify(null)));
13182
13182
  }
@@ -13195,30 +13195,30 @@ function Tu(l, e) {
13195
13195
  function Ru(l, e) {
13196
13196
  return l.createValue(pe, Buffer.from(JSON.stringify(e)));
13197
13197
  }
13198
- function qn(l, e) {
13198
+ function Vn(l, e) {
13199
13199
  return [l, e];
13200
13200
  }
13201
13201
  function Ji(l, e) {
13202
- return e === void 0 ? Object.entries(l) : e.map((t) => qn(t, l[t]));
13202
+ return e === void 0 ? Object.entries(l) : e.map((t) => Vn(t, l[t]));
13203
13203
  }
13204
13204
  function Iu(l, e, t, i) {
13205
- const n = i ?? (t ? Dn : vn), r = t ? l.createEphemeral(n) : l.createStruct(n);
13205
+ const n = i ?? (t ? Kn : jn), r = t ? l.createEphemeral(n) : l.createStruct(n);
13206
13206
  for (const [c, a] of Array.isArray(e) ? e : Ji(e))
13207
- l.createField(Cn(r, c), "Input", a);
13207
+ l.createField(On(r, c), "Input", a);
13208
13208
  return l.lock(r), r;
13209
13209
  }
13210
13210
  function Pu(l, e, t, i, n = "") {
13211
13211
  return Object.fromEntries(
13212
- t.map((r) => qn(r, l.getFutureFieldValue(e, `${n}${r}`, i)))
13212
+ t.map((r) => Vn(r, l.getFutureFieldValue(e, `${n}${r}`, i)))
13213
13213
  );
13214
13214
  }
13215
- const zi = vn, Hi = Dn, me = "ref";
13215
+ const zi = jn, Hi = Kn, me = "ref";
13216
13216
  function Nu(l, e) {
13217
- const t = l.createStruct(zi), i = Cn(t, me);
13217
+ const t = l.createStruct(zi), i = On(t, me);
13218
13218
  return l.createField(i, "Input", e), l.lock(t), t;
13219
13219
  }
13220
13220
  function _u(l, e) {
13221
- const t = l.createEphemeral(Hi), i = Cn(t, me);
13221
+ const t = l.createEphemeral(Hi), i = On(t, me);
13222
13222
  return l.createField(i, "Input", e), l.lock(t), t;
13223
13223
  }
13224
13224
  function Lu(l, e) {
@@ -13228,7 +13228,7 @@ const If = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13228
13228
  __proto__: null,
13229
13229
  ClientRoot: Ln,
13230
13230
  EphHolder: Hi,
13231
- EphStdMap: Dn,
13231
+ EphStdMap: Kn,
13232
13232
  Holder: zi,
13233
13233
  HolderRefField: me,
13234
13234
  JsonArray: Vi,
@@ -13239,7 +13239,7 @@ const If = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13239
13239
  JsonObject: pe,
13240
13240
  JsonString: Oi,
13241
13241
  RNull: wu,
13242
- StdMap: vn,
13242
+ StdMap: jn,
13243
13243
  StructTestResource: pu,
13244
13244
  ValueTestResource: yu,
13245
13245
  createPlArray: Tu,
@@ -13251,11 +13251,17 @@ const If = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13251
13251
  createPlString: bu,
13252
13252
  futureRecord: Pu,
13253
13253
  plEntries: Ji,
13254
- plEntry: qn,
13254
+ plEntry: Vn,
13255
13255
  unwrapHolder: Lu,
13256
13256
  wrapInEphHolder: _u,
13257
13257
  wrapInHolder: Nu
13258
- }, Symbol.toStringTag, { value: "Module" })), ei = 5e3, ti = 3e5, ni = 6e4, ii = 31 * 24 * 60 * 60, ri = 12 * 24 * 60 * 60, si = 128e6, oi = "exponential", ai = 16, li = 14, ci = 1.5, ui = 50, fi = 0.3;
13258
+ }, Symbol.toStringTag, { value: "Module" })), ri = 5e3, si = 3e5, oi = 6e4, ai = 31 * 24 * 60 * 60, li = 12 * 24 * 60 * 60, ci = 128e6, ui = "exponential", An = 16, Bn = 14, $n = 1.5, fi = 50, Un = 0.3, Pf = {
13259
+ type: "exponentialBackoff",
13260
+ maxAttempts: An,
13261
+ initialDelay: Bn,
13262
+ backoffMultiplier: $n,
13263
+ jitter: Un
13264
+ };
13259
13265
  function P(l) {
13260
13266
  if (!l) return;
13261
13267
  const e = Number(l);
@@ -13267,20 +13273,20 @@ function ye(l, e = {}) {
13267
13273
  return {
13268
13274
  hostAndPort: l,
13269
13275
  ssl: !1,
13270
- defaultRequestTimeout: ei,
13271
- defaultROTransactionTimeout: ti,
13272
- defaultRWTransactionTimeout: ni,
13273
- authTTLSeconds: ii,
13274
- authMaxRefreshSeconds: ri,
13276
+ defaultRequestTimeout: ri,
13277
+ defaultROTransactionTimeout: si,
13278
+ defaultRWTransactionTimeout: oi,
13279
+ authTTLSeconds: ai,
13280
+ authMaxRefreshSeconds: li,
13275
13281
  txDelay: 0,
13276
13282
  forceSync: !1,
13277
- maxCacheBytes: si,
13278
- retryBackoffAlgorithm: oi,
13279
- retryMaxAttempts: ai,
13280
- retryInitialDelay: li,
13281
- retryExponentialBackoffMultiplier: ci,
13282
- retryLinearBackoffStep: ui,
13283
- retryJitter: fi,
13283
+ maxCacheBytes: ci,
13284
+ retryBackoffAlgorithm: ui,
13285
+ retryMaxAttempts: An,
13286
+ retryInitialDelay: Bn,
13287
+ retryExponentialBackoffMultiplier: $n,
13288
+ retryLinearBackoffStep: fi,
13289
+ retryJitter: Un,
13284
13290
  ...e
13285
13291
  };
13286
13292
  const t = new URL(l);
@@ -13293,28 +13299,28 @@ function ye(l, e = {}) {
13293
13299
  // this also includes port
13294
13300
  alternativeRoot: t.searchParams.get("alternative-root") ?? void 0,
13295
13301
  ssl: t.protocol === "https:" || t.protocol === "tls:",
13296
- defaultRequestTimeout: P(t.searchParams.get("request-timeout")) ?? ei,
13297
- defaultROTransactionTimeout: P(t.searchParams.get("ro-tx-timeout")) ?? P(t.searchParams.get("tx-timeout")) ?? ti,
13298
- defaultRWTransactionTimeout: P(t.searchParams.get("rw-tx-timeout")) ?? P(t.searchParams.get("tx-timeout")) ?? ni,
13299
- authTTLSeconds: ii,
13300
- authMaxRefreshSeconds: ri,
13302
+ defaultRequestTimeout: P(t.searchParams.get("request-timeout")) ?? ri,
13303
+ defaultROTransactionTimeout: P(t.searchParams.get("ro-tx-timeout")) ?? P(t.searchParams.get("tx-timeout")) ?? si,
13304
+ defaultRWTransactionTimeout: P(t.searchParams.get("rw-tx-timeout")) ?? P(t.searchParams.get("tx-timeout")) ?? oi,
13305
+ authTTLSeconds: ai,
13306
+ authMaxRefreshSeconds: li,
13301
13307
  grpcProxy: t.searchParams.get("grpc-proxy") ?? void 0,
13302
13308
  httpProxy: t.searchParams.get("http-proxy") ?? void 0,
13303
13309
  user: t.username === "" ? void 0 : t.username,
13304
13310
  password: t.password === "" ? void 0 : t.password,
13305
13311
  txDelay: P(t.searchParams.get("tx-delay")) ?? 0,
13306
13312
  forceSync: !!t.searchParams.get("force-sync"),
13307
- maxCacheBytes: P(t.searchParams.get("max-cache-bytes")) ?? si,
13308
- retryBackoffAlgorithm: t.searchParams.get("retry-backoff-algorithm") ?? oi,
13309
- retryMaxAttempts: P(t.searchParams.get("retry-max-attempts")) ?? ai,
13310
- retryInitialDelay: P(t.searchParams.get("retry-initial-delay")) ?? li,
13311
- retryExponentialBackoffMultiplier: P(t.searchParams.get("retry-exp-backoff-multiplier")) ?? ci,
13312
- retryLinearBackoffStep: P(t.searchParams.get("retry-linear-backoff-step")) ?? ui,
13313
- retryJitter: P(t.searchParams.get("retry-backoff-jitter")) ?? fi,
13313
+ maxCacheBytes: P(t.searchParams.get("max-cache-bytes")) ?? ci,
13314
+ retryBackoffAlgorithm: t.searchParams.get("retry-backoff-algorithm") ?? ui,
13315
+ retryMaxAttempts: P(t.searchParams.get("retry-max-attempts")) ?? An,
13316
+ retryInitialDelay: P(t.searchParams.get("retry-initial-delay")) ?? Bn,
13317
+ retryExponentialBackoffMultiplier: P(t.searchParams.get("retry-exp-backoff-multiplier")) ?? $n,
13318
+ retryLinearBackoffStep: P(t.searchParams.get("retry-linear-backoff-step")) ?? fi,
13319
+ retryJitter: P(t.searchParams.get("retry-backoff-jitter")) ?? Un,
13314
13320
  ...e
13315
13321
  };
13316
13322
  }
13317
- const Pf = {};
13323
+ const Nf = {};
13318
13324
  class Au {
13319
13325
  constructor(e) {
13320
13326
  y(this, "typeName", bn.typeName);
@@ -13530,7 +13536,7 @@ function Bu(l, e, t, i) {
13530
13536
  return { kind: l, expectMultiResponse: e, resolve: t, reject: i };
13531
13537
  }
13532
13538
  function $u(l) {
13533
- return l.code === xn;
13539
+ return l.code === Dn;
13534
13540
  }
13535
13541
  class J extends Error {
13536
13542
  constructor(t) {
@@ -13596,7 +13602,7 @@ class Uu {
13596
13602
  if ($u(c)) {
13597
13603
  if (t.reject(
13598
13604
  new J(() => {
13599
- throw new Wn(c);
13605
+ throw new vn(c);
13600
13606
  })
13601
13607
  ), t = void 0, r.multiMessage !== void 0 && !r.multiMessage.isLast) {
13602
13608
  this.assignErrorFactoryIfNotSet(() => {
@@ -13696,20 +13702,20 @@ class Uu {
13696
13702
  this._completed || (this._completed = !0, await this.stream.requests.complete());
13697
13703
  }
13698
13704
  }
13699
- function On(l) {
13705
+ function Mn(l) {
13700
13706
  return JSON.parse(Buffer.from(l.split(".")[1], "base64").toString());
13701
13707
  }
13702
13708
  function Q(l, e) {
13703
13709
  if (l.jwtToken === void 0) return;
13704
- const { exp: t, iat: i } = On(l.jwtToken);
13710
+ const { exp: t, iat: i } = Mn(l.jwtToken);
13705
13711
  return Math.min(
13706
13712
  // in the middle between issue and expiration time points
13707
13713
  (i + t) / 2,
13708
13714
  i + e
13709
13715
  ) * 1e3;
13710
13716
  }
13711
- function Nf(l) {
13712
- return l.jwtToken === void 0 ? void 0 : On(l.jwtToken).exp * 1e3;
13717
+ function _f(l) {
13718
+ return l.jwtToken === void 0 ? void 0 : Mn(l.jwtToken).exp * 1e3;
13713
13719
  }
13714
13720
  class Fu {
13715
13721
  constructor(e, t) {
@@ -13723,7 +13729,7 @@ class Fu {
13723
13729
  return this.client === void 0 && (this.client = this.clientConstructor(this.grpcTransport())), this.client;
13724
13730
  }
13725
13731
  }
13726
- class Kn {
13732
+ class Gn {
13727
13733
  constructor(e, t = {}) {
13728
13734
  y(this, "conf");
13729
13735
  /** Initial authorization information */
@@ -13766,7 +13772,7 @@ class Kn {
13766
13772
  const i = {
13767
13773
  host: this.conf.hostAndPort,
13768
13774
  timeout: this.conf.defaultRequestTimeout,
13769
- channelCredentials: this.conf.ssl ? zn.createSsl() : zn.createInsecure(),
13775
+ channelCredentials: this.conf.ssl ? Xn.createSsl() : Xn.createInsecure(),
13770
13776
  clientOptions: t
13771
13777
  };
13772
13778
  this.conf.grpcProxy ? process.env.grpc_proxy = this.conf.grpcProxy : delete process.env.grpc_proxy;
@@ -13805,7 +13811,7 @@ class Kn {
13805
13811
  get authUser() {
13806
13812
  var e, t;
13807
13813
  if (!this.authenticated) throw new Error("Client is not authenticated");
13808
- return (e = this.authInformation) != null && e.jwtToken ? On((t = this.authInformation) == null ? void 0 : t.jwtToken).user.login : null;
13814
+ return (e = this.authInformation) != null && e.jwtToken ? Mn((t = this.authInformation) == null ? void 0 : t.jwtToken).user.login : null;
13809
13815
  }
13810
13816
  updateStatus(e) {
13811
13817
  process.nextTick(() => {
@@ -13837,11 +13843,11 @@ class Kn {
13837
13843
  }
13838
13844
  /** Detects certain errors and update client status accordingly */
13839
13845
  createErrorInterceptor() {
13840
- return (e, t) => new Hn(t(e), {
13846
+ return (e, t) => new Qn(t(e), {
13841
13847
  start: (i, n, r) => {
13842
13848
  r(i, {
13843
13849
  onReceiveStatus: (c, a) => {
13844
- c.code == Yn.UNAUTHENTICATED && this.updateStatus("Unauthenticated"), c.code == Yn.UNAVAILABLE && this.updateStatus("Disconnected"), a(c);
13850
+ c.code == ei.UNAUTHENTICATED && this.updateStatus("Unauthenticated"), c.code == ei.UNAVAILABLE && this.updateStatus("Disconnected"), a(c);
13845
13851
  }
13846
13852
  });
13847
13853
  }
@@ -13849,7 +13855,7 @@ class Kn {
13849
13855
  }
13850
13856
  /** Injects authentication information if needed */
13851
13857
  createAuthInterceptor() {
13852
- return (e, t) => new Hn(t(e), {
13858
+ return (e, t) => new Qn(t(e), {
13853
13859
  start: (i, n, r) => {
13854
13860
  var c;
13855
13861
  ((c = this.authInformation) == null ? void 0 : c.jwtToken) !== void 0 && (i.set("authorization", "Bearer " + this.authInformation.jwtToken), this.refreshAuthInformationIfNeeded()), r(i, n);
@@ -13885,8 +13891,8 @@ const di = /* @__PURE__ */ new Set(), xu = (l) => {
13885
13891
  case "StreamManager": {
13886
13892
  if (!z(l)) return !1;
13887
13893
  if (l.fields === void 0 || C(l.error)) return !0;
13888
- const e = Zn(l, "downloadable");
13889
- return Zn(l, "stream").value === e.value;
13894
+ const e = ti(l, "downloadable");
13895
+ return ti(l, "stream").value === e.value;
13890
13896
  }
13891
13897
  case "StdMap":
13892
13898
  case "std/map":
@@ -13967,7 +13973,7 @@ class ge {
13967
13973
  y(this, "finalPredicate");
13968
13974
  /** Resource data cache, to minimize redundant data rereading from remote db */
13969
13975
  y(this, "resourceDataCache");
13970
- this.buildLLPlClient = (r) => new Kn(e, { auth: t, ...i, shouldUseGzip: r }), this._ll = this.buildLLPlClient(!1);
13976
+ this.buildLLPlClient = (r) => new Gn(e, { auth: t, ...i, shouldUseGzip: r }), this._ll = this.buildLLPlClient(!1);
13971
13977
  const n = this._ll.conf;
13972
13978
  switch (this.txDelay = n.txDelay, this.forceSync = n.forceSync, this.finalPredicate = i.finalPredicate ?? xu, this.resourceDataCache = new lr({
13973
13979
  maxSize: n.maxCacheBytes,
@@ -14045,7 +14051,7 @@ class ge {
14045
14051
  async init() {
14046
14052
  if (this.initialized) throw new Error("Already initialized");
14047
14053
  const e = this._ll.authUser, t = e === null ? Wu : Ri("sha256").update(e).digest("hex");
14048
- this._serverInfo = await this.ping(), this._serverInfo.compression === En.GZIP && (await this._ll.close(), this._ll = this.buildLLPlClient(!0)), this._clientRoot = await this._withTx("initialization", !0, S, async (i) => {
14054
+ this._serverInfo = await this.ping(), this._serverInfo.compression === Cn.GZIP && (await this._ll.close(), this._ll = this.buildLLPlClient(!0)), this._clientRoot = await this._withTx("initialization", !0, S, async (i) => {
14049
14055
  let n;
14050
14056
  if (await i.checkResourceNameExists(t) ? n = await i.getResourceByName(t) : (n = i.createRoot(Ln), i.setResourceName(t, n)), this.conf.alternativeRoot === void 0)
14051
14057
  return await i.commit(), await hu(n);
@@ -14081,19 +14087,19 @@ class ge {
14081
14087
  this.finalPredicate,
14082
14088
  this.resourceDataCache
14083
14089
  );
14084
- let s = !1, u, Vn;
14090
+ let s = !1, u, zn;
14085
14091
  try {
14086
14092
  u = await n(o), this._txCommittedStat = G(this._txCommittedStat, o.stat), s = !0;
14087
- } catch (Mn) {
14088
- if (Mn instanceof qi)
14093
+ } catch (Hn) {
14094
+ if (Hn instanceof qi)
14089
14095
  this._txConflictStat = G(this._txConflictStat, o.stat);
14090
14096
  else
14091
- throw this._txErrorStat = G(this._txErrorStat, o.stat), Mn;
14097
+ throw this._txErrorStat = G(this._txErrorStat, o.stat), Hn;
14092
14098
  } finally {
14093
- await o.complete(), await o.await(), Vn = await o.getGlobalTxId();
14099
+ await o.complete(), await o.await(), zn = await o.getGlobalTxId();
14094
14100
  }
14095
14101
  if (s)
14096
- return ((r == null ? void 0 : r.sync) === void 0 ? this.forceSync : r != null && r.sync) && await this._ll.grpcPl.get().txSync({ txId: Vn }), t && this.txDelay > 0 && await Pn.setTimeout(this.txDelay, void 0, { signal: r == null ? void 0 : r.abortSignal }), u;
14102
+ return ((r == null ? void 0 : r.sync) === void 0 ? this.forceSync : r != null && r.sync) && await this._ll.grpcPl.get().txSync({ txId: zn }), t && this.txDelay > 0 && await Pn.setTimeout(this.txDelay, void 0, { signal: r == null ? void 0 : r.abortSignal }), u;
14097
14103
  await Pn.setTimeout(c.nextDelay, void 0, { signal: r == null ? void 0 : r.abortSignal }), c = Ti(c);
14098
14104
  }
14099
14105
  }
@@ -14121,13 +14127,13 @@ class ge {
14121
14127
  return await n.init(), n;
14122
14128
  }
14123
14129
  }
14124
- function _f(l, e) {
14130
+ function Lf(l, e) {
14125
14131
  return e = e ?? {}, e.meta = e.meta ?? {}, e.meta.resourceType = `${l.name}:${l.version}`, e;
14126
14132
  }
14127
14133
  class Yi {
14128
14134
  constructor(e) {
14129
14135
  y(this, "ll");
14130
- this.ll = new Kn(e);
14136
+ this.ll = new Gn(e);
14131
14137
  }
14132
14138
  async ping() {
14133
14139
  return (await this.ll.grpcPl.get().ping({})).response;
@@ -14151,11 +14157,11 @@ class Yi {
14151
14157
  if (n === "") throw new Error("empty token");
14152
14158
  return { jwtToken: n };
14153
14159
  } catch (i) {
14154
- throw i.code === "UNAUTHENTICATED" ? new Sn(i.message) : new Error(i);
14160
+ throw i.code === "UNAUTHENTICATED" ? new qn(i.message) : new Error(i);
14155
14161
  }
14156
14162
  }
14157
14163
  }
14158
- const Su = "pl.json", Cu = $n.join(Pi.homedir(), ".pl.json"), Du = "pl.yaml", vu = $n.join(Pi.homedir(), ".pl.yaml"), qu = [
14164
+ const Su = "pl.json", Cu = xn.join(Pi.homedir(), ".pl.json"), Du = "pl.yaml", vu = xn.join(Pi.homedir(), ".pl.yaml"), qu = [
14159
14165
  Su,
14160
14166
  Du,
14161
14167
  Cu,
@@ -14197,7 +14203,7 @@ function ju(l, e) {
14197
14203
  const pi = () => {
14198
14204
  E.rmSync(Z);
14199
14205
  };
14200
- async function Lf() {
14206
+ async function Af() {
14201
14207
  let l;
14202
14208
  if (process.env.PL_ADDRESS !== void 0)
14203
14209
  l = ye(process.env.PL_ADDRESS);
@@ -14246,7 +14252,7 @@ async function Lf() {
14246
14252
  onAuthError: pi
14247
14253
  });
14248
14254
  }
14249
- async function Af(l, e) {
14255
+ async function Bf(l, e) {
14250
14256
  const t = {
14251
14257
  valueId: e.value,
14252
14258
  errorId: e.error,
@@ -14343,7 +14349,7 @@ const Ju = {
14343
14349
  backoffStep: 10,
14344
14350
  initialDelay: 10
14345
14351
  };
14346
- async function Bf(l, e, t = Ju, i = "polling") {
14352
+ async function $f(l, e, t = Ju, i = "polling") {
14347
14353
  let n = bi(t);
14348
14354
  for (; ; ) {
14349
14355
  try {
@@ -14357,7 +14363,7 @@ async function Bf(l, e, t = Ju, i = "polling") {
14357
14363
  const X = "test_config.json";
14358
14364
  let In;
14359
14365
  function W() {
14360
- return In === void 0 && (In = $n.resolve(".test_auth.json")), In;
14366
+ return In === void 0 && (In = xn.resolve(".test_auth.json")), In;
14361
14367
  }
14362
14368
  function Zi() {
14363
14369
  let l = {};
@@ -14386,7 +14392,7 @@ function yi(l) {
14386
14392
  const wi = () => {
14387
14393
  console.warn(`Removing: ${W()}`), U.rmSync(W());
14388
14394
  };
14389
- async function jn() {
14395
+ async function Jn() {
14390
14396
  const l = Zi();
14391
14397
  let e;
14392
14398
  if (U.existsSync(W()))
@@ -14418,11 +14424,11 @@ async function jn() {
14418
14424
  };
14419
14425
  }
14420
14426
  async function zu(l = {}) {
14421
- const { conf: e, auth: t } = await jn();
14422
- return new Kn({ ...e, ...l }, { auth: t });
14427
+ const { conf: e, auth: t } = await Jn();
14428
+ return new Gn({ ...e, ...l }, { auth: t });
14423
14429
  }
14424
- async function An(l) {
14425
- const { conf: e, auth: t } = await jn();
14430
+ async function Fn(l) {
14431
+ const { conf: e, auth: t } = await Jn();
14426
14432
  if (l !== void 0 && e.alternativeRoot !== void 0)
14427
14433
  throw new Error("test pl address configured with alternative root");
14428
14434
  return await ge.init({ ...e, alternativeRoot: l }, t);
@@ -14431,68 +14437,69 @@ async function Hu(l) {
14431
14437
  const e = `test_${Date.now()}_${Ii()}`;
14432
14438
  let t = S;
14433
14439
  try {
14434
- const i = await An(e);
14440
+ const i = await Fn(e);
14435
14441
  t = i.clientRoot;
14436
14442
  const n = await l(i);
14437
- return await (await An()).deleteAlternativeRoot(e), n;
14443
+ return await (await Fn()).deleteAlternativeRoot(e), n;
14438
14444
  } catch (i) {
14439
14445
  throw console.log(`ALTERNATIVE ROOT: ${e} (${we(t)})`), new Error(i.message, { cause: i });
14440
14446
  }
14441
14447
  }
14442
- const $f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
14448
+ const Uf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
14443
14449
  __proto__: null,
14444
- getTestClient: An,
14445
- getTestClientConf: jn,
14450
+ getTestClient: Fn,
14451
+ getTestClientConf: Jn,
14446
14452
  getTestConfig: Zi,
14447
14453
  getTestLLClient: zu,
14448
14454
  withTempRoot: Hu
14449
14455
  }, Symbol.toStringTag, { value: "Module" }));
14450
14456
  export {
14451
- Pf as AnonymousAuthInformation,
14457
+ Nf as AnonymousAuthInformation,
14452
14458
  H as ContinuePolling,
14453
- ri as DEFAULT_AUTH_MAX_REFRESH,
14454
- si as DEFAULT_MAX_CACHE_BYTES,
14455
- ei as DEFAULT_REQUEST_TIMEOUT,
14456
- oi as DEFAULT_RETRY_BACKOFF_ALGORITHM,
14457
- ci as DEFAULT_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER,
14458
- li as DEFAULT_RETRY_INITIAL_DELAY,
14459
- fi as DEFAULT_RETRY_JITTER,
14460
- ui as DEFAULT_RETRY_LINEAR_BACKOFF_STEP,
14461
- ai as DEFAULT_RETRY_MAX_ATTEMPTS,
14462
- ti as DEFAULT_RO_TX_TIMEOUT,
14463
- ni as DEFAULT_RW_TX_TIMEOUT,
14464
- ii as DEFAULT_TOKEN_TTL_SECONDS,
14459
+ li as DEFAULT_AUTH_MAX_REFRESH,
14460
+ ci as DEFAULT_MAX_CACHE_BYTES,
14461
+ ri as DEFAULT_REQUEST_TIMEOUT,
14462
+ ui as DEFAULT_RETRY_BACKOFF_ALGORITHM,
14463
+ $n as DEFAULT_RETRY_EXPONENTIAL_BACKOFF_MULTIPLIER,
14464
+ Bn as DEFAULT_RETRY_INITIAL_DELAY,
14465
+ Un as DEFAULT_RETRY_JITTER,
14466
+ fi as DEFAULT_RETRY_LINEAR_BACKOFF_STEP,
14467
+ An as DEFAULT_RETRY_MAX_ATTEMPTS,
14468
+ si as DEFAULT_RO_TX_TIMEOUT,
14469
+ oi as DEFAULT_RW_TX_TIMEOUT,
14470
+ ai as DEFAULT_TOKEN_TTL_SECONDS,
14465
14471
  xu as DefaultFinalResourceDataPredicate,
14466
14472
  Ju as DefaultPollingRetryOptions,
14473
+ Pf as DefaultRetryOptions,
14467
14474
  Wi as DisconnectedError,
14468
14475
  Li as MaxLocalId,
14469
- Fn as MaxTxId,
14476
+ Sn as MaxTxId,
14470
14477
  S as NullResourceId,
14471
14478
  If as Pl,
14472
14479
  ge as PlClient,
14473
14480
  Ei as PlError,
14474
- xn as PlErrorCodeNotFound,
14481
+ Dn as PlErrorCodeNotFound,
14475
14482
  _n as PlTransaction,
14476
14483
  Mu as PollResourceAccessor,
14477
14484
  Gu as PollTxAccessor,
14478
- Wn as RecoverablePlError,
14479
- $f as TestHelpers,
14485
+ vn as RecoverablePlError,
14486
+ Uf as TestHelpers,
14480
14487
  qi as TxCommitConflict,
14481
- Sn as UnauthenticatedError,
14488
+ qn as UnauthenticatedError,
14482
14489
  Yi as UnauthenticatedPlClient,
14483
14490
  iu as UnrecoverablePlError,
14484
- _f as addRTypeToMetadata,
14491
+ Lf as addRTypeToMetadata,
14485
14492
  gf as bigintToResourceId,
14486
14493
  wf as checkLocalityOfResourceId,
14487
14494
  yr as createGlobalResourceId,
14488
14495
  Ai as createLocalResourceId,
14489
- Lf as defaultPlClient,
14496
+ Af as defaultPlClient,
14490
14497
  Nn as ensureResourceIdNotNull,
14491
- Nf as expirationFromAuthInformation,
14498
+ _f as expirationFromAuthInformation,
14492
14499
  fr as extractBasicResourceData,
14493
14500
  Bi as extractTxId,
14494
- Cn as field,
14495
- Zn as getField,
14501
+ On as field,
14502
+ ti as getField,
14496
14503
  Q as inferAuthRefreshTime,
14497
14504
  uf as isAnyResourceId,
14498
14505
  $i as isConnectionProblem,
@@ -14505,12 +14512,12 @@ export {
14505
14512
  du as isResource,
14506
14513
  Tf as isResourceId,
14507
14514
  M as isResourceRef,
14508
- Xn as isRootResourceId,
14515
+ ni as isRootResourceId,
14509
14516
  Fi as isTimeoutOrCancelError,
14510
14517
  Ui as isUnauthenticated,
14511
14518
  pf as jsonToData,
14512
14519
  ye as plAddressToConfig,
14513
- Bf as poll,
14520
+ $f as poll,
14514
14521
  yf as resDataToJson,
14515
14522
  mf as resourceIdFromString,
14516
14523
  we as resourceIdToString,
@@ -14525,6 +14532,6 @@ export {
14525
14532
  hu as toGlobalResourceId,
14526
14533
  T as toResourceId,
14527
14534
  Ku as tryGetFileConfig,
14528
- Af as valErr
14535
+ Bf as valErr
14529
14536
  };
14530
14537
  //# sourceMappingURL=index.mjs.map