@milaboratories/pl-client 2.7.8 → 2.7.10

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
@@ -28,16 +28,16 @@ function mn(o) {
28
28
  if (!$(o)) throw new Error("null resource id");
29
29
  return o;
30
30
  }
31
- function Su(o) {
31
+ function $u(o) {
32
32
  return o !== 0n;
33
33
  }
34
- function $u(o, e) {
34
+ function Cu(o, e) {
35
35
  return { name: o, version: e };
36
36
  }
37
- function Cu(o) {
37
+ function Du(o) {
38
38
  return `${o.name}:${o.version}`;
39
39
  }
40
- function Du(o, e) {
40
+ function vu(o, e) {
41
41
  return o.name === e.name && o.version === e.version;
42
42
  }
43
43
  function qn(o) {
@@ -66,7 +66,7 @@ function qn(o) {
66
66
  final: f
67
67
  };
68
68
  }
69
- const vu = (o) => Buffer.from(JSON.stringify(o)), Ou = (o) => JSON.parse(R(o.data).toString());
69
+ const Ou = (o) => Buffer.from(JSON.stringify(o)), qu = (o) => JSON.parse(R(o.data).toString());
70
70
  function Kn(o, e) {
71
71
  return R(o.fields.find((t) => t.name === e));
72
72
  }
@@ -88,7 +88,7 @@ function er(o, e) {
88
88
  function bi(o) {
89
89
  return Number(o >> gi & Xi);
90
90
  }
91
- function qu(o, e) {
91
+ function Ku(o, e) {
92
92
  if (O(o) && bi(o) !== e)
93
93
  throw Error(
94
94
  "local id from another transaction, globalize id before leaking it from the transaction"
@@ -98,19 +98,19 @@ function ye(o) {
98
98
  return x(o) ? "XX:0x0" : O(o) ? (Vn(o) ? "R" : "N") + "L:0x" + (Qi & o).toString(16) + "[0x" + bi(o).toString(16) + "]" : (Vn(o) ? "R" : "N") + "G:0x" + (Zi & o).toString(16);
99
99
  }
100
100
  const tr = /^(?:(?<xx>XX)|(?<rn>[XRN])(?<lg>[XLG])):0x(?<rid>[0-9a-fA-F]+)(?:\[0x(?<txid>[0-9a-fA-F]+)])?$/;
101
- function Ku(o) {
101
+ function Vu(o) {
102
102
  const e = o.match(tr);
103
103
  if (e === null) return;
104
104
  const { xx: t, rn: i, lg: n, rid: r, txid: d } = e.groups;
105
105
  return t ? S : n === "L" ? ki(i === "R", Number.parseInt(r, 16), Number.parseInt(d, 16)) : er(i === "R", BigInt("0x" + r));
106
106
  }
107
- function Vu(o) {
107
+ function ju(o) {
108
108
  if (O(o))
109
109
  throw new Error(`Local resource id: ${ye(o)}`);
110
110
  if (x(o)) throw new Error("Null resource id.");
111
111
  return o;
112
112
  }
113
- function ju(o) {
113
+ function Mu(o) {
114
114
  return JSON.stringify(
115
115
  o,
116
116
  (e, t) => typeof t == "bigint" ? ye(t) : t
@@ -594,7 +594,7 @@ class lr extends h {
594
594
  return n !== !1 && (n == !0 ? u.onWrite : n)(this.typeName, e, t), t;
595
595
  }
596
596
  }
597
- const _ = new lr();
597
+ const L = new lr();
598
598
  class cr extends h {
599
599
  constructor() {
600
600
  super("MiLaboratories.PL.RTypes.NotificationFilter.EventFilter", [
@@ -6535,7 +6535,7 @@ class $o extends h {
6535
6535
  L: 0
6536
6536
  /*LongType.BIGINT*/
6537
6537
  },
6538
- { no: 2, name: "filter", kind: "message", T: () => _ }
6538
+ { no: 2, name: "filter", kind: "message", T: () => L }
6539
6539
  ]);
6540
6540
  }
6541
6541
  create(e) {
@@ -6553,7 +6553,7 @@ class $o extends h {
6553
6553
  break;
6554
6554
  case /* MiLaboratories.PL.RTypes.NotificationFilter filter */
6555
6555
  2:
6556
- r.filter = _.internalBinaryRead(e, e.uint32(), i, r.filter);
6556
+ r.filter = L.internalBinaryRead(e, e.uint32(), i, r.filter);
6557
6557
  break;
6558
6558
  default:
6559
6559
  let s = i.readUnknownField;
@@ -6566,7 +6566,7 @@ class $o extends h {
6566
6566
  return r;
6567
6567
  }
6568
6568
  internalBinaryWrite(e, t, i) {
6569
- e.id !== 0n && t.tag(1, c.Varint).uint64(e.id), e.filter && _.internalBinaryWrite(e.filter, t.tag(2, c.LengthDelimited).fork(), i).join();
6569
+ e.id !== 0n && t.tag(1, c.Varint).uint64(e.id), e.filter && L.internalBinaryWrite(e.filter, t.tag(2, c.LengthDelimited).fork(), i).join();
6570
6570
  let n = i.writeUnknownFields;
6571
6571
  return n !== !1 && (n == !0 ? u.onWrite : n)(this.typeName, e, t), t;
6572
6572
  }
@@ -6978,7 +6978,7 @@ class Yo extends h {
6978
6978
  T: 9
6979
6979
  /*ScalarType.STRING*/
6980
6980
  },
6981
- { no: 2, name: "filters", kind: "map", K: 9, V: { kind: "message", T: () => _ } },
6981
+ { no: 2, name: "filters", kind: "map", K: 9, V: { kind: "message", T: () => L } },
6982
6982
  { no: 3, name: "resource_schemas", kind: "message", repeat: 1, T: () => V }
6983
6983
  ]);
6984
6984
  }
@@ -7022,18 +7022,18 @@ class Yo extends h {
7022
7022
  d = t.string();
7023
7023
  break;
7024
7024
  case 2:
7025
- a = _.internalBinaryRead(t, t.uint32(), i);
7025
+ a = L.internalBinaryRead(t, t.uint32(), i);
7026
7026
  break;
7027
7027
  default:
7028
7028
  throw new globalThis.Error("unknown map entry field for field MiLaboratories.PL.API.ControllerAPI.Register.Request.filters");
7029
7029
  }
7030
7030
  }
7031
- e[d ?? ""] = a ?? _.create();
7031
+ e[d ?? ""] = a ?? L.create();
7032
7032
  }
7033
7033
  internalBinaryWrite(e, t, i) {
7034
7034
  e.controllerType !== "" && t.tag(1, c.LengthDelimited).string(e.controllerType);
7035
7035
  for (let r of globalThis.Object.keys(e.filters))
7036
- t.tag(2, c.LengthDelimited).fork().tag(1, c.LengthDelimited).string(r), t.tag(2, c.LengthDelimited).fork(), _.internalBinaryWrite(e.filters[r], t, i), t.join().join();
7036
+ t.tag(2, c.LengthDelimited).fork().tag(1, c.LengthDelimited).string(r), t.tag(2, c.LengthDelimited).fork(), L.internalBinaryWrite(e.filters[r], t, i), t.join().join();
7037
7037
  for (let r = 0; r < e.resourceSchemas.length; r++)
7038
7038
  V.internalBinaryWrite(e.resourceSchemas[r], t.tag(3, c.LengthDelimited).fork(), i).join();
7039
7039
  let n = i.writeUnknownFields;
@@ -7224,7 +7224,7 @@ class oa extends h {
7224
7224
  T: 9
7225
7225
  /*ScalarType.STRING*/
7226
7226
  },
7227
- { no: 2, name: "filters", kind: "map", K: 9, V: { kind: "message", T: () => _ } },
7227
+ { no: 2, name: "filters", kind: "map", K: 9, V: { kind: "message", T: () => L } },
7228
7228
  { no: 3, name: "resource_schemas", kind: "message", repeat: 1, T: () => V }
7229
7229
  ]);
7230
7230
  }
@@ -7268,18 +7268,18 @@ class oa extends h {
7268
7268
  d = t.string();
7269
7269
  break;
7270
7270
  case 2:
7271
- a = _.internalBinaryRead(t, t.uint32(), i);
7271
+ a = L.internalBinaryRead(t, t.uint32(), i);
7272
7272
  break;
7273
7273
  default:
7274
7274
  throw new globalThis.Error("unknown map entry field for field MiLaboratories.PL.API.ControllerAPI.Update.Request.filters");
7275
7275
  }
7276
7276
  }
7277
- e[d ?? ""] = a ?? _.create();
7277
+ e[d ?? ""] = a ?? L.create();
7278
7278
  }
7279
7279
  internalBinaryWrite(e, t, i) {
7280
7280
  e.controllerType !== "" && t.tag(1, c.LengthDelimited).string(e.controllerType);
7281
7281
  for (let r of globalThis.Object.keys(e.filters))
7282
- t.tag(2, c.LengthDelimited).fork().tag(1, c.LengthDelimited).string(r), t.tag(2, c.LengthDelimited).fork(), _.internalBinaryWrite(e.filters[r], t, i), t.join().join();
7282
+ t.tag(2, c.LengthDelimited).fork().tag(1, c.LengthDelimited).string(r), t.tag(2, c.LengthDelimited).fork(), L.internalBinaryWrite(e.filters[r], t, i), t.join().join();
7283
7283
  for (let r = 0; r < e.resourceSchemas.length; r++)
7284
7284
  V.internalBinaryWrite(e.resourceSchemas[r], t.tag(3, c.LengthDelimited).fork(), i).join();
7285
7285
  let n = i.writeUnknownFields;
@@ -10597,7 +10597,7 @@ function M(o, e) {
10597
10597
  kvGetBytes: o.kvGetBytes + e.kvGetBytes
10598
10598
  };
10599
10599
  }
10600
- function Mu(o) {
10600
+ function Gu(o) {
10601
10601
  return o.hasOwnProperty("resourceId") && o.hasOwnProperty("fieldName");
10602
10602
  }
10603
10603
  function Oc(o) {
@@ -10612,10 +10612,10 @@ function j(o) {
10612
10612
  function B(o) {
10613
10613
  return Bi(o) ? { resourceId: o.resourceId.localId, fieldName: o.fieldName } : o;
10614
10614
  }
10615
- async function Gu(o) {
10615
+ async function Ju(o) {
10616
10616
  return Bi(o) ? { resourceId: await o.resourceId.globalId, fieldName: o.fieldName } : o;
10617
10617
  }
10618
- function P(o) {
10618
+ function _(o) {
10619
10619
  return j(o) ? o.localId : o;
10620
10620
  }
10621
10621
  async function qc(o) {
@@ -10814,7 +10814,7 @@ const N = class N {
10814
10814
  setResourceName(e, t) {
10815
10815
  this.sendVoidAsync({
10816
10816
  oneofKind: "resourceNameSet",
10817
- resourceNameSet: { resourceId: P(t), name: e }
10817
+ resourceNameSet: { resourceId: _(t), name: e }
10818
10818
  });
10819
10819
  }
10820
10820
  deleteResourceName(e) {
@@ -10854,7 +10854,7 @@ const N = class N {
10854
10854
  const n = await this.sendSingleAndParse(
10855
10855
  {
10856
10856
  oneofKind: "resourceGet",
10857
- resourceGet: { resourceId: P(e), loadFields: t }
10857
+ resourceGet: { resourceId: _(e), loadFields: t }
10858
10858
  },
10859
10859
  (l) => jn(R(l.resourceGet.resource))
10860
10860
  );
@@ -10888,7 +10888,7 @@ const N = class N {
10888
10888
  lockInputs(e) {
10889
10889
  this.stat.inputsLocked++, this.sendVoidAsync({
10890
10890
  oneofKind: "resourceLockInputs",
10891
- resourceLockInputs: { resourceId: P(e) }
10891
+ resourceLockInputs: { resourceId: _(e) }
10892
10892
  });
10893
10893
  }
10894
10894
  /**
@@ -10898,7 +10898,7 @@ const N = class N {
10898
10898
  lockOutputs(e) {
10899
10899
  this.stat.outputsLocked++, this.sendVoidAsync({
10900
10900
  oneofKind: "resourceLockOutputs",
10901
- resourceLockOutputs: { resourceId: P(e) }
10901
+ resourceLockOutputs: { resourceId: _(e) }
10902
10902
  });
10903
10903
  }
10904
10904
  lock(e) {
@@ -10928,7 +10928,7 @@ const N = class N {
10928
10928
  fieldSet: {
10929
10929
  field: B(e),
10930
10930
  value: {
10931
- resourceId: P(t),
10931
+ resourceId: _(t),
10932
10932
  fieldName: ""
10933
10933
  // default value, read as undefined
10934
10934
  }
@@ -10944,7 +10944,7 @@ const N = class N {
10944
10944
  setFieldError(e, t) {
10945
10945
  this.stat.fieldsSet++, this.sendVoidAsync({
10946
10946
  oneofKind: "fieldSetError",
10947
- fieldSetError: { field: B(e), errResourceId: P(t) }
10947
+ fieldSetError: { field: B(e), errResourceId: _(t) }
10948
10948
  });
10949
10949
  }
10950
10950
  async getField(e) {
@@ -10969,7 +10969,7 @@ const N = class N {
10969
10969
  const t = await this.sendMultiAndParse(
10970
10970
  {
10971
10971
  oneofKind: "resourceKeyValueList",
10972
- resourceKeyValueList: { resourceId: P(e), startFrom: "", limit: 0 }
10972
+ resourceKeyValueList: { resourceId: _(e), startFrom: "", limit: 0 }
10973
10973
  },
10974
10974
  (i) => i.map((n) => n.resourceKeyValueList.record)
10975
10975
  );
@@ -10993,7 +10993,7 @@ const N = class N {
10993
10993
  this.stat.kvSetRequests++, this.stat.kvSetBytes++, this.sendVoidAsync({
10994
10994
  oneofKind: "resourceKeyValueSet",
10995
10995
  resourceKeyValueSet: {
10996
- resourceId: P(e),
10996
+ resourceId: _(e),
10997
10997
  key: t,
10998
10998
  value: Fc(i)
10999
10999
  }
@@ -11003,7 +11003,7 @@ const N = class N {
11003
11003
  this.sendVoidAsync({
11004
11004
  oneofKind: "resourceKeyValueDelete",
11005
11005
  resourceKeyValueDelete: {
11006
- resourceId: P(e),
11006
+ resourceId: _(e),
11007
11007
  key: t
11008
11008
  }
11009
11009
  });
@@ -11012,7 +11012,7 @@ const N = class N {
11012
11012
  const i = await this.sendSingleAndParse(
11013
11013
  {
11014
11014
  oneofKind: "resourceKeyValueGet",
11015
- resourceKeyValueGet: { resourceId: P(e), key: t }
11015
+ resourceKeyValueGet: { resourceId: _(e), key: t }
11016
11016
  },
11017
11017
  (n) => n.resourceKeyValueGet.value
11018
11018
  );
@@ -11028,7 +11028,7 @@ const N = class N {
11028
11028
  const i = await this.sendSingleAndParse(
11029
11029
  {
11030
11030
  oneofKind: "resourceKeyValueGetIfExists",
11031
- resourceKeyValueGetIfExists: { resourceId: P(e), key: t }
11031
+ resourceKeyValueGetIfExists: { resourceId: _(e), key: t }
11032
11032
  },
11033
11033
  (n) => n.resourceKeyValueGetIfExists.exists ? n.resourceKeyValueGetIfExists.value : void 0
11034
11034
  );
@@ -11085,26 +11085,26 @@ const N = class N {
11085
11085
  };
11086
11086
  y(N, "localTxIdCounter", 0);
11087
11087
  let kn = N;
11088
- function L(o, e) {
11088
+ function P(o, e) {
11089
11089
  return { name: o, version: e };
11090
11090
  }
11091
- const bn = L("ClientRoot", "1"), Kc = L("StructTest", "1"), Vc = L("ValueTest", "1"), Fi = L("json/string", "1"), xi = L("json/bool", "1"), Wi = L("json/object", "1"), Ui = L("json/array", "1"), Ei = L("json/number", "1"), Si = L("json/null", "1"), Nn = L("EphStdMap", "1"), Fn = L("StdMap", "1");
11092
- function jc(o) {
11091
+ const bn = P("ClientRoot", "1"), Kc = P("StructTest", "1"), Vc = P("ValueTest", "1"), Fi = P("json/string", "1"), xi = P("json/bool", "1"), Wi = P("json/object", "1"), Ui = P("json/array", "1"), Ei = P("json/number", "1"), Si = P("json/null", "1"), jc = P("Null", "1"), Nn = P("EphStdMap", "1"), Fn = P("StdMap", "1");
11092
+ function Mc(o) {
11093
11093
  return o.createValue(Si, Buffer.from(JSON.stringify(null)));
11094
11094
  }
11095
- function Mc(o, e) {
11095
+ function Gc(o, e) {
11096
11096
  return o.createValue(xi, Buffer.from(JSON.stringify(e)));
11097
11097
  }
11098
- function Gc(o, e) {
11098
+ function Jc(o, e) {
11099
11099
  return o.createValue(Ei, Buffer.from(JSON.stringify(e)));
11100
11100
  }
11101
- function Jc(o, e) {
11101
+ function Hc(o, e) {
11102
11102
  return o.createValue(Fi, Buffer.from(JSON.stringify(e)));
11103
11103
  }
11104
- function Hc(o, e) {
11104
+ function zc(o, e) {
11105
11105
  return o.createValue(Ui, Buffer.from(JSON.stringify(e)));
11106
11106
  }
11107
- function zc(o, e) {
11107
+ function Yc(o, e) {
11108
11108
  return o.createValue(Wi, Buffer.from(JSON.stringify(e)));
11109
11109
  }
11110
11110
  function xn(o, e) {
@@ -11113,30 +11113,30 @@ function xn(o, e) {
11113
11113
  function $i(o, e) {
11114
11114
  return e === void 0 ? Object.entries(o) : e.map((t) => xn(t, o[t]));
11115
11115
  }
11116
- function Yc(o, e, t, i) {
11116
+ function Zc(o, e, t, i) {
11117
11117
  const n = i ?? (t ? Nn : Fn), r = t ? o.createEphemeral(n) : o.createStruct(n);
11118
11118
  for (const [d, a] of Array.isArray(e) ? e : $i(e))
11119
11119
  o.createField(Bn(r, d), "Input", a);
11120
11120
  return o.lock(r), r;
11121
11121
  }
11122
- function Zc(o, e, t, i, n = "") {
11122
+ function Xc(o, e, t, i, n = "") {
11123
11123
  return Object.fromEntries(
11124
11124
  t.map((r) => xn(r, o.getFutureFieldValue(e, `${n}${r}`, i)))
11125
11125
  );
11126
11126
  }
11127
11127
  const Ci = Fn, Di = Nn, ge = "ref";
11128
- function Xc(o, e) {
11128
+ function Qc(o, e) {
11129
11129
  const t = o.createStruct(Ci), i = Bn(t, ge);
11130
11130
  return o.createField(i, "Input", e), o.lock(t), t;
11131
11131
  }
11132
- function Qc(o, e) {
11132
+ function eu(o, e) {
11133
11133
  const t = o.createEphemeral(Di), i = Bn(t, ge);
11134
11134
  return o.createField(i, "Input", e), o.lock(t), t;
11135
11135
  }
11136
- function eu(o, e) {
11136
+ function tu(o, e) {
11137
11137
  return o.getFutureFieldValue(e, ge, "Input");
11138
11138
  }
11139
- const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11139
+ const Hu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11140
11140
  __proto__: null,
11141
11141
  ClientRoot: bn,
11142
11142
  EphHolder: Di,
@@ -11149,22 +11149,23 @@ const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11149
11149
  JsonNumber: Ei,
11150
11150
  JsonObject: Wi,
11151
11151
  JsonString: Fi,
11152
+ RNull: jc,
11152
11153
  StdMap: Fn,
11153
11154
  StructTestResource: Kc,
11154
11155
  ValueTestResource: Vc,
11155
- createPlArray: Hc,
11156
- createPlBool: Mc,
11157
- createPlMap: Yc,
11158
- createPlNull: jc,
11159
- createPlNumber: Gc,
11160
- createPlObject: zc,
11161
- createPlString: Jc,
11162
- futureRecord: Zc,
11156
+ createPlArray: zc,
11157
+ createPlBool: Gc,
11158
+ createPlMap: Zc,
11159
+ createPlNull: Mc,
11160
+ createPlNumber: Jc,
11161
+ createPlObject: Yc,
11162
+ createPlString: Hc,
11163
+ futureRecord: Xc,
11163
11164
  plEntries: $i,
11164
11165
  plEntry: xn,
11165
- unwrapHolder: eu,
11166
- wrapInEphHolder: Qc,
11167
- wrapInHolder: Xc
11166
+ unwrapHolder: tu,
11167
+ wrapInEphHolder: eu,
11168
+ wrapInHolder: Qc
11168
11169
  }, Symbol.toStringTag, { value: "Module" })), Mn = 5e3, Gn = 3e5, Jn = 6e4, Hn = 31 * 24 * 60 * 60, zn = 12 * 24 * 60 * 60, Yn = 128e6, Zn = "exponential", Xn = 16, Qn = 14, ei = 1.5, ti = 50, ni = 0.3;
11169
11170
  function w(o) {
11170
11171
  if (!o) return;
@@ -11224,8 +11225,8 @@ function pe(o, e = {}) {
11224
11225
  ...e
11225
11226
  };
11226
11227
  }
11227
- const Hu = {};
11228
- class tu {
11228
+ const zu = {};
11229
+ class nu {
11229
11230
  constructor(e) {
11230
11231
  y(this, "typeName", hn.typeName);
11231
11232
  y(this, "methods", hn.methods);
@@ -11436,10 +11437,10 @@ class tu {
11436
11437
  return k("unary", this._transport, i, n, e);
11437
11438
  }
11438
11439
  }
11439
- function nu(o, e, t, i) {
11440
+ function iu(o, e, t, i) {
11440
11441
  return { kind: o, expectMultiResponse: e, resolve: t, reject: i };
11441
11442
  }
11442
- function iu(o) {
11443
+ function ru(o) {
11443
11444
  return o.code === _n;
11444
11445
  }
11445
11446
  class G extends Error {
@@ -11447,7 +11448,7 @@ class G extends Error {
11447
11448
  super("Rethrow error, you should never see this one."), this.rethrowLambda = e;
11448
11449
  }
11449
11450
  }
11450
- class ru {
11451
+ class su {
11451
11452
  constructor(e) {
11452
11453
  /** Bidirectional channel through which transaction communicates with the server */
11453
11454
  y(this, "stream");
@@ -11501,7 +11502,7 @@ class ru {
11501
11502
  }
11502
11503
  if (r.error !== void 0) {
11503
11504
  const d = r.error;
11504
- if (iu(d)) {
11505
+ if (ru(d)) {
11505
11506
  if (t.reject(
11506
11507
  new G(() => {
11507
11508
  throw new Ln(d);
@@ -11586,7 +11587,7 @@ class ru {
11586
11587
  if (this.closed) return Promise.reject(new Error("Transaction already closed"));
11587
11588
  const i = new Promise((n, r) => {
11588
11589
  this.responseHandlerQueue.push(
11589
- nu(e.oneofKind, t, n, r)
11590
+ iu(e.oneofKind, t, n, r)
11590
11591
  );
11591
11592
  });
11592
11593
  await this.stream.requests.send({
@@ -11616,7 +11617,7 @@ function Z(o, e) {
11616
11617
  i + e
11617
11618
  ) * 1e3;
11618
11619
  }
11619
- function zu(o) {
11620
+ function Yu(o) {
11620
11621
  return o.jwtToken === void 0 ? void 0 : Wn(o.jwtToken).exp * 1e3;
11621
11622
  }
11622
11623
  class Un {
@@ -11654,7 +11655,7 @@ class Un {
11654
11655
  interceptors: i
11655
11656
  }
11656
11657
  };
11657
- this.conf.grpcProxy ? process.env.grpc_proxy = this.conf.grpcProxy : delete process.env.grpc_proxy, this.grpcTransport = new Mi(d), this.grpcPl = new tu(this.grpcTransport), this.httpDispatcher = Ji(this.conf.httpProxy), r !== void 0 && (this.statusListener = r, r(this._status));
11658
+ this.conf.grpcProxy ? process.env.grpc_proxy = this.conf.grpcProxy : delete process.env.grpc_proxy, this.grpcTransport = new Mi(d), this.grpcPl = new nu(this.grpcTransport), this.httpDispatcher = Ji(this.conf.httpProxy), r !== void 0 && (this.statusListener = r, r(this._status));
11658
11659
  }
11659
11660
  /** Returns true if client is authenticated. Even with anonymous auth information
11660
11661
  * connection is considered authenticated. Unauthenticated clients are used for
@@ -11718,7 +11719,7 @@ class Un {
11718
11719
  });
11719
11720
  }
11720
11721
  createTx(e, t = {}) {
11721
- return new ru((i) => {
11722
+ return new su((i) => {
11722
11723
  let n = i;
11723
11724
  return t.abortSignal && (n = AbortSignal.any([n, t.abortSignal])), this.grpcPl.tx({
11724
11725
  abort: n,
@@ -11734,14 +11735,14 @@ class Un {
11734
11735
  function de(o) {
11735
11736
  return o.resourceReady || $(o.originalResourceId) || $(o.error);
11736
11737
  }
11737
- function su(o) {
11738
+ function ou(o) {
11738
11739
  if (!de(o) || !o.outputsLocked) return !1;
11739
11740
  if (o.fields === void 0) return !0;
11740
11741
  for (const e of o.fields)
11741
11742
  if (x(e.error) && (x(e.value) || !e.valueIsFinal)) return !1;
11742
11743
  return !0;
11743
11744
  }
11744
- const ii = /* @__PURE__ */ new Set(), ou = (o) => {
11745
+ const ii = /* @__PURE__ */ new Set(), au = (o) => {
11745
11746
  switch (o.type.name) {
11746
11747
  case "StreamManager":
11747
11748
  if (!de(o)) return !1;
@@ -11786,7 +11787,7 @@ const ii = /* @__PURE__ */ new Set(), ou = (o) => {
11786
11787
  default:
11787
11788
  if (o.type.name.startsWith("Blob/")) return !0;
11788
11789
  if (o.type.name.startsWith("BlobUpload/") || o.type.name.startsWith("BlobIndex/"))
11789
- return su(o);
11790
+ return ou(o);
11790
11791
  if (o.type.name.startsWith("PColumnData/"))
11791
11792
  return de(o);
11792
11793
  ii.has(o.type.name) || (console.log("UNKNOWN RESOURCE TYPE: " + o.type.name), ii.add(o.type.name));
@@ -11794,7 +11795,7 @@ const ii = /* @__PURE__ */ new Set(), ou = (o) => {
11794
11795
  return !1;
11795
11796
  }, pn = {
11796
11797
  sync: !1
11797
- }, au = "AnonymousRoot";
11798
+ }, lu = "AnonymousRoot";
11798
11799
  function ri(o) {
11799
11800
  return `alternative_root_${o}`;
11800
11801
  }
@@ -11824,7 +11825,7 @@ class me {
11824
11825
  y(this, "resourceDataCache");
11825
11826
  this.ll = new Un(e, { auth: t, ...i });
11826
11827
  const n = this.ll.conf;
11827
- switch (this.txDelay = n.txDelay, this.forceSync = n.forceSync, this.finalPredicate = i.finalPredicate ?? ou, this.resourceDataCache = new Hi({
11828
+ switch (this.txDelay = n.txDelay, this.forceSync = n.forceSync, this.finalPredicate = i.finalPredicate ?? au, this.resourceDataCache = new Hi({
11828
11829
  maxSize: n.maxCacheBytes,
11829
11830
  sizeCalculation: (r) => {
11830
11831
  var d;
@@ -11896,7 +11897,7 @@ class me {
11896
11897
  /** Currently implements custom logic to emulate future behaviour with single root. */
11897
11898
  async init() {
11898
11899
  if (this.initialized) throw new Error("Already initialized");
11899
- const e = this.ll.authUser, t = e === null ? au : fi("sha256").update(e).digest("hex");
11900
+ const e = this.ll.authUser, t = e === null ? lu : fi("sha256").update(e).digest("hex");
11900
11901
  this._serverInfo = await this.ping(), this._clientRoot = await this._withTx("initialization", !0, S, async (i) => {
11901
11902
  let n;
11902
11903
  if (await i.checkResourceNameExists(t) ? n = await i.getResourceByName(t) : (n = i.createRoot(bn), i.setResourceName(t, n)), this.conf.alternativeRoot === void 0)
@@ -11973,7 +11974,7 @@ class me {
11973
11974
  return await n.init(), n;
11974
11975
  }
11975
11976
  }
11976
- function Yu(o, e) {
11977
+ function Zu(o, e) {
11977
11978
  return e = e ?? {}, e.meta = e.meta ?? {}, e.meta.resourceType = `${o.name}:${o.version}`, e;
11978
11979
  }
11979
11980
  class vi {
@@ -12007,12 +12008,12 @@ class vi {
12007
12008
  }
12008
12009
  }
12009
12010
  }
12010
- const lu = "pl.json", cu = Rn.join(pi.homedir(), ".pl.json"), uu = "pl.yaml", du = Rn.join(pi.homedir(), ".pl.yaml"), fu = [
12011
- lu,
12012
- uu,
12011
+ const cu = "pl.json", uu = Rn.join(pi.homedir(), ".pl.json"), du = "pl.yaml", fu = Rn.join(pi.homedir(), ".pl.yaml"), hu = [
12013
12012
  cu,
12014
- du
12015
- ], z = ".pl_auth.json", hu = [
12013
+ du,
12014
+ uu,
12015
+ fu
12016
+ ], z = ".pl_auth.json", pu = [
12016
12017
  "grpcProxy",
12017
12018
  "httpProxy",
12018
12019
  "user",
@@ -12024,14 +12025,14 @@ const lu = "pl.json", cu = Rn.join(pi.homedir(), ".pl.json"), uu = "pl.yaml", du
12024
12025
  "authTTLSeconds",
12025
12026
  "authMaxRefreshSeconds"
12026
12027
  ];
12027
- function pu() {
12028
- for (const o of fu)
12028
+ function yu() {
12029
+ for (const o of hu)
12029
12030
  if (U.existsSync(o)) {
12030
12031
  const e = U.readFileSync(o, { encoding: "utf-8" });
12031
12032
  return o.endsWith("json") ? [JSON.parse(e), o] : [Yi.parse(e), o];
12032
12033
  }
12033
12034
  }
12034
- function yu(o, e) {
12035
+ function gu(o, e) {
12035
12036
  return (t) => {
12036
12037
  U.writeFileSync(
12037
12038
  z,
@@ -12049,16 +12050,16 @@ function yu(o, e) {
12049
12050
  const si = () => {
12050
12051
  U.rmSync(z);
12051
12052
  };
12052
- async function Zu() {
12053
+ async function Xu() {
12053
12054
  let o;
12054
12055
  if (process.env.PL_ADDRESS !== void 0)
12055
12056
  o = pe(process.env.PL_ADDRESS);
12056
12057
  else {
12057
- const i = pu();
12058
+ const i = yu();
12058
12059
  if (i !== void 0) {
12059
12060
  const [n, r] = i, d = R(n.address, `no pl address in file: ${r}`);
12060
12061
  o = pe(d);
12061
- for (const a of hu)
12062
+ for (const a of pu)
12062
12063
  n[a] !== void 0 && (o[a] = n[a]);
12063
12064
  }
12064
12065
  }
@@ -12093,12 +12094,12 @@ async function Zu() {
12093
12094
  }
12094
12095
  return await me.init(o, {
12095
12096
  authInformation: t,
12096
- onUpdate: (i) => yu(e, o.authMaxRefreshSeconds),
12097
+ onUpdate: (i) => gu(e, o.authMaxRefreshSeconds),
12097
12098
  onUpdateError: si,
12098
12099
  onAuthError: si
12099
12100
  });
12100
12101
  }
12101
- async function Xu(o, e) {
12102
+ async function Qu(o, e) {
12102
12103
  const t = {
12103
12104
  valueId: e.value,
12104
12105
  errorId: e.error,
@@ -12112,11 +12113,11 @@ async function Xu(o, e) {
12112
12113
  }
12113
12114
  class J extends Error {
12114
12115
  }
12115
- const gu = {
12116
+ const mu = {
12116
12117
  failOnError: !0,
12117
12118
  onlyFinal: !1
12118
12119
  };
12119
- class mu {
12120
+ class ku {
12120
12121
  constructor(e, t, i) {
12121
12122
  this.tx = e, this.data = t, this.path = i;
12122
12123
  }
@@ -12139,7 +12140,7 @@ class mu {
12139
12140
  ) : new J();
12140
12141
  }
12141
12142
  async get(e, t = {}) {
12142
- const { expectedType: i, failOnError: n, onlyFinal: r } = { ...gu, ...t }, d = [...this.path, e], a = this.getFieldData(e, i);
12143
+ const { expectedType: i, failOnError: n, onlyFinal: r } = { ...mu, ...t }, d = [...this.path, e], a = this.getFieldData(e, i);
12143
12144
  if ($(a.error) && (n || x(a.value)) && await this.tx.throwError(a.error, d), x(a.value)) throw new J();
12144
12145
  return await this.tx.get(a.value, n, d);
12145
12146
  }
@@ -12166,12 +12167,12 @@ class mu {
12166
12167
  return JSON.parse(await this.getKValue(e));
12167
12168
  }
12168
12169
  }
12169
- class ku {
12170
+ class bu {
12170
12171
  constructor(e) {
12171
12172
  this.tx = e;
12172
12173
  }
12173
12174
  async get(e, t = !0, i = []) {
12174
- const n = await this.tx.getResourceData(e, !0), r = new mu(this, n, [...i, ye(e)]);
12175
+ const n = await this.tx.getResourceData(e, !0), r = new ku(this, n, [...i, ye(e)]);
12175
12176
  return t && await r.requireNoError(), r;
12176
12177
  }
12177
12178
  async throwError(e, t = []) {
@@ -12180,18 +12181,18 @@ class ku {
12180
12181
  throw new Error(`${t.join(" -> ")} = ${n}`);
12181
12182
  }
12182
12183
  }
12183
- const bu = {
12184
+ const wu = {
12184
12185
  type: "linearBackoff",
12185
12186
  jitter: 0,
12186
12187
  maxAttempts: 100,
12187
12188
  backoffStep: 10,
12188
12189
  initialDelay: 10
12189
12190
  };
12190
- async function Qu(o, e, t = bu, i = "polling") {
12191
+ async function ed(o, e, t = wu, i = "polling") {
12191
12192
  let n = ui(t);
12192
12193
  for (; ; ) {
12193
12194
  try {
12194
- return await o.withReadTx(i, async (r) => await e(new ku(r)));
12195
+ return await o.withReadTx(i, async (r) => await e(new bu(r)));
12195
12196
  } catch (r) {
12196
12197
  if (!(r instanceof J)) throw r;
12197
12198
  }
@@ -12261,7 +12262,7 @@ async function En() {
12261
12262
  }
12262
12263
  };
12263
12264
  }
12264
- async function wu(o = {}) {
12265
+ async function Tu(o = {}) {
12265
12266
  const { conf: e, auth: t } = await En();
12266
12267
  return new Un({ ...e, ...o }, { auth: t });
12267
12268
  }
@@ -12271,7 +12272,7 @@ async function wn(o) {
12271
12272
  throw new Error("test pl address configured with alternative root");
12272
12273
  return await me.init({ ...e, alternativeRoot: o }, t);
12273
12274
  }
12274
- async function Tu(o) {
12275
+ async function Ru(o) {
12275
12276
  const e = `test_${Date.now()}_${hi()}`;
12276
12277
  let t = S;
12277
12278
  try {
@@ -12283,16 +12284,16 @@ async function Tu(o) {
12283
12284
  throw console.log(`ALTERNATIVE ROOT: ${e} (${ye(t)})`), new Error(i.message, { cause: i });
12284
12285
  }
12285
12286
  }
12286
- const ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12287
+ const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12287
12288
  __proto__: null,
12288
12289
  getTestClient: wn,
12289
12290
  getTestClientConf: En,
12290
12291
  getTestConfig: Oi,
12291
- getTestLLClient: wu,
12292
- withTempRoot: Tu
12292
+ getTestLLClient: Tu,
12293
+ withTempRoot: Ru
12293
12294
  }, Symbol.toStringTag, { value: "Module" }));
12294
12295
  export {
12295
- Hu as AnonymousAuthInformation,
12296
+ zu as AnonymousAuthInformation,
12296
12297
  J as ContinuePolling,
12297
12298
  zn as DEFAULT_AUTH_MAX_REFRESH,
12298
12299
  Yn as DEFAULT_MAX_CACHE_BYTES,
@@ -12306,41 +12307,41 @@ export {
12306
12307
  Gn as DEFAULT_RO_TX_TIMEOUT,
12307
12308
  Jn as DEFAULT_RW_TX_TIMEOUT,
12308
12309
  Hn as DEFAULT_TOKEN_TTL_SECONDS,
12309
- ou as DefaultFinalResourceDataPredicate,
12310
- bu as DefaultPollingRetryOptions,
12310
+ au as DefaultFinalResourceDataPredicate,
12311
+ wu as DefaultPollingRetryOptions,
12311
12312
  _i as DisconnectedError,
12312
12313
  mi as MaxLocalId,
12313
12314
  Pn as MaxTxId,
12314
12315
  S as NullResourceId,
12315
- Ju as Pl,
12316
+ Hu as Pl,
12316
12317
  me as PlClient,
12317
12318
  Ii as PlError,
12318
12319
  _n as PlErrorCodeNotFound,
12319
12320
  kn as PlTransaction,
12320
- mu as PollResourceAccessor,
12321
- ku as PollTxAccessor,
12321
+ ku as PollResourceAccessor,
12322
+ bu as PollTxAccessor,
12322
12323
  Ln as RecoverablePlError,
12323
- ed as TestHelpers,
12324
+ td as TestHelpers,
12324
12325
  Ni as TxCommitConflict,
12325
12326
  An as UnauthenticatedError,
12326
12327
  vi as UnauthenticatedPlClient,
12327
12328
  Wc as UnrecoverablePlError,
12328
- Yu as addRTypeToMetadata,
12329
- Vu as bigintToResourceId,
12330
- qu as checkLocalityOfResourceId,
12329
+ Zu as addRTypeToMetadata,
12330
+ ju as bigintToResourceId,
12331
+ Ku as checkLocalityOfResourceId,
12331
12332
  er as createGlobalResourceId,
12332
12333
  ki as createLocalResourceId,
12333
- Zu as defaultPlClient,
12334
+ Xu as defaultPlClient,
12334
12335
  mn as ensureResourceIdNotNull,
12335
- zu as expirationFromAuthInformation,
12336
+ Yu as expirationFromAuthInformation,
12336
12337
  qn as extractBasicResourceData,
12337
12338
  bi as extractTxId,
12338
12339
  Bn as field,
12339
12340
  Kn as getField,
12340
12341
  Z as inferAuthRefreshTime,
12341
- Su as isAnyResourceId,
12342
+ $u as isAnyResourceId,
12342
12343
  wi as isConnectionProblem,
12343
- Mu as isField,
12344
+ Gu as isField,
12344
12345
  Bi as isFieldRef,
12345
12346
  O as isLocalResourceId,
12346
12347
  Pi as isNotFoundError,
@@ -12351,23 +12352,23 @@ export {
12351
12352
  Vn as isRootResourceId,
12352
12353
  Ri as isTimeoutOrCancelError,
12353
12354
  Ti as isUnauthenticated,
12354
- vu as jsonToData,
12355
+ Ou as jsonToData,
12355
12356
  pe as plAddressToConfig,
12356
- Qu as poll,
12357
- Ou as resDataToJson,
12358
- Ku as resourceIdFromString,
12357
+ ed as poll,
12358
+ qu as resDataToJson,
12359
+ Vu as resourceIdFromString,
12359
12360
  ye as resourceIdToString,
12360
- $u as resourceType,
12361
- Cu as resourceTypeToString,
12362
- Du as resourceTypesEqual,
12361
+ Cu as resourceType,
12362
+ Du as resourceTypeToString,
12363
+ vu as resourceTypesEqual,
12363
12364
  Uc as rethrowMeaningfulError,
12364
- ju as stringifyWithResourceId,
12365
+ Mu as stringifyWithResourceId,
12365
12366
  xc as throwPlNotFoundError,
12366
12367
  B as toFieldId,
12367
- Gu as toGlobalFieldId,
12368
+ Ju as toGlobalFieldId,
12368
12369
  qc as toGlobalResourceId,
12369
- P as toResourceId,
12370
- pu as tryGetFileConfig,
12371
- Xu as valErr
12370
+ _ as toResourceId,
12371
+ yu as tryGetFileConfig,
12372
+ Qu as valErr
12372
12373
  };
12373
12374
  //# sourceMappingURL=index.mjs.map