@milaboratories/pl-client 2.9.2 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/error_resource.d.ts +6 -0
- package/dist/core/error_resource.d.ts.map +1 -0
- package/dist/core/errors.d.ts +5 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/transaction.d.ts +2 -0
- package/dist/core/transaction.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +208 -189
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/error_resource.ts +10 -0
- package/src/core/errors.ts +5 -0
- package/src/core/transaction.ts +13 -0
- package/src/test/test_config.ts +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var zi = Object.defineProperty;
|
|
2
2
|
var Hi = (l, e, t) => e in l ? zi(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
3
|
var y = (l, e, t) => Hi(l, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { cachedDeserialize as pi, notEmpty as
|
|
4
|
+
import { cachedDeserialize as pi, notEmpty as R, Aborted as yi, assertNever as wi, deepFreeze as jn, createRetryState as mi, nextRetryStateOrError as gi } from "@milaboratories/ts-helpers";
|
|
5
5
|
import { ServiceType as Yi, stackIntercept as g } from "@protobuf-ts/runtime-rpc";
|
|
6
6
|
import { MessageType as h, PbLong as F, typeofJsonValue as _n, reflectionMergePartial as p, UnknownFieldHandler as f, WireType as d, jsonWriteOptions as Zi, isJsonObject as Vn } from "@protobuf-ts/runtime";
|
|
7
7
|
import { compressionAlgorithms as Xi, ChannelCredentials as Mn, InterceptingCall as Gn, status as Jn } from "@grpc/grpc-js";
|
|
@@ -28,16 +28,16 @@ function Rn(l) {
|
|
|
28
28
|
if (!C(l)) throw new Error("null resource id");
|
|
29
29
|
return l;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Qu(l) {
|
|
32
32
|
return l !== 0n;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ef(l, e) {
|
|
35
35
|
return { name: l, version: e };
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function tf(l) {
|
|
38
38
|
return `${l.name}:${l.version}`;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function nf(l, e) {
|
|
41
41
|
return l.name === e.name && l.version === e.version;
|
|
42
42
|
}
|
|
43
43
|
function sr(l) {
|
|
@@ -66,9 +66,9 @@ function sr(l) {
|
|
|
66
66
|
final: u
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const rf = (l) => Buffer.from(JSON.stringify(l)), sf = (l) => pi(R(l.data));
|
|
70
70
|
function zn(l, e) {
|
|
71
|
-
return
|
|
71
|
+
return R(l.fields.find((t) => t.name === e));
|
|
72
72
|
}
|
|
73
73
|
const An = 1n << 63n, Ri = 1n << 62n, or = 0x3fffffffffffffffn, Ii = 24n, Pi = 16777215, Bn = 4294967295, ar = BigInt(Bn), lr = BigInt(Pi);
|
|
74
74
|
function Hn(l) {
|
|
@@ -88,7 +88,7 @@ function cr(l, e) {
|
|
|
88
88
|
function _i(l) {
|
|
89
89
|
return Number(l >> Ii & ar);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function of(l, e) {
|
|
92
92
|
if (x(l) && _i(l) !== 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 we(l) {
|
|
|
98
98
|
return B(l) ? "XX:0x0" : x(l) ? (Hn(l) ? "R" : "N") + "L:0x" + (lr & l).toString(16) + "[0x" + _i(l).toString(16) + "]" : (Hn(l) ? "R" : "N") + "G:0x" + (or & l).toString(16);
|
|
99
99
|
}
|
|
100
100
|
const ur = /^(?:(?<xx>XX)|(?<rn>[XRN])(?<lg>[XLG])):0x(?<rid>[0-9a-fA-F]+)(?:\[0x(?<txid>[0-9a-fA-F]+)])?$/;
|
|
101
|
-
function
|
|
101
|
+
function af(l) {
|
|
102
102
|
const e = l.match(ur);
|
|
103
103
|
if (e === null) return;
|
|
104
104
|
const { xx: t, rn: i, lg: n, rid: r, txid: c } = e.groups;
|
|
105
105
|
return t ? S : n === "L" ? Ni(i === "R", Number.parseInt(r, 16), Number.parseInt(c, 16)) : cr(i === "R", BigInt("0x" + r));
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function lf(l) {
|
|
108
108
|
if (x(l))
|
|
109
109
|
throw new Error(`Local resource id: ${we(l)}`);
|
|
110
110
|
if (B(l)) throw new Error("Null resource id.");
|
|
111
111
|
return l;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function cf(l) {
|
|
114
114
|
return JSON.stringify(
|
|
115
115
|
l,
|
|
116
116
|
(e, t) => typeof t == "bigint" ? we(t) : t
|
|
@@ -202,7 +202,7 @@ class fr extends h {
|
|
|
202
202
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
const
|
|
205
|
+
const N = new fr();
|
|
206
206
|
var k = /* @__PURE__ */ ((l) => (l[l.INVALID = 0] = "INVALID", l[l.INPUT = 1] = "INPUT", l[l.OUTPUT = 2] = "OUTPUT", l[l.SERVICE = 6] = "SERVICE", l[l.ONE_TIME_WRITABLE = 4] = "ONE_TIME_WRITABLE", l[l.DYNAMIC = 3] = "DYNAMIC", l[l.MULTIPLE_TIMES_WRITABLE = 5] = "MULTIPLE_TIMES_WRITABLE", l))(k || {});
|
|
207
207
|
class dr extends h {
|
|
208
208
|
constructor() {
|
|
@@ -1204,7 +1204,7 @@ class Rr extends h {
|
|
|
1204
1204
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
|
-
const
|
|
1207
|
+
const I = new Rr();
|
|
1208
1208
|
class Ir extends h {
|
|
1209
1209
|
constructor() {
|
|
1210
1210
|
super("MiLaboratories.PL.API.Resource.Features", [
|
|
@@ -4580,7 +4580,7 @@ const ze = new Rs();
|
|
|
4580
4580
|
class Is extends h {
|
|
4581
4581
|
constructor() {
|
|
4582
4582
|
super("MiLaboratories.PL.API.ResourceAPI.GetSingleton.Response", [
|
|
4583
|
-
{ no: 1, name: "resource", kind: "message", T: () =>
|
|
4583
|
+
{ no: 1, name: "resource", kind: "message", T: () => I }
|
|
4584
4584
|
]);
|
|
4585
4585
|
}
|
|
4586
4586
|
create(e) {
|
|
@@ -4594,7 +4594,7 @@ class Is extends h {
|
|
|
4594
4594
|
switch (a) {
|
|
4595
4595
|
case /* MiLaboratories.PL.API.Resource resource */
|
|
4596
4596
|
1:
|
|
4597
|
-
r.resource =
|
|
4597
|
+
r.resource = I.internalBinaryRead(e, e.uint32(), i, r.resource);
|
|
4598
4598
|
break;
|
|
4599
4599
|
default:
|
|
4600
4600
|
let s = i.readUnknownField;
|
|
@@ -4607,7 +4607,7 @@ class Is extends h {
|
|
|
4607
4607
|
return r;
|
|
4608
4608
|
}
|
|
4609
4609
|
internalBinaryWrite(e, t, i) {
|
|
4610
|
-
e.resource &&
|
|
4610
|
+
e.resource && I.internalBinaryWrite(e.resource, t.tag(1, d.LengthDelimited).fork(), i).join();
|
|
4611
4611
|
let n = i.writeUnknownFields;
|
|
4612
4612
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
4613
4613
|
}
|
|
@@ -5128,7 +5128,7 @@ const rt = new Cs();
|
|
|
5128
5128
|
class Ds extends h {
|
|
5129
5129
|
constructor() {
|
|
5130
5130
|
super("MiLaboratories.PL.API.ResourceAPI.Get.Response", [
|
|
5131
|
-
{ no: 1, name: "resource", kind: "message", T: () =>
|
|
5131
|
+
{ no: 1, name: "resource", kind: "message", T: () => I }
|
|
5132
5132
|
]);
|
|
5133
5133
|
}
|
|
5134
5134
|
create(e) {
|
|
@@ -5142,7 +5142,7 @@ class Ds extends h {
|
|
|
5142
5142
|
switch (a) {
|
|
5143
5143
|
case /* MiLaboratories.PL.API.Resource resource */
|
|
5144
5144
|
1:
|
|
5145
|
-
r.resource =
|
|
5145
|
+
r.resource = I.internalBinaryRead(e, e.uint32(), i, r.resource);
|
|
5146
5146
|
break;
|
|
5147
5147
|
default:
|
|
5148
5148
|
let s = i.readUnknownField;
|
|
@@ -5155,7 +5155,7 @@ class Ds extends h {
|
|
|
5155
5155
|
return r;
|
|
5156
5156
|
}
|
|
5157
5157
|
internalBinaryWrite(e, t, i) {
|
|
5158
|
-
e.resource &&
|
|
5158
|
+
e.resource && I.internalBinaryWrite(e.resource, t.tag(1, d.LengthDelimited).fork(), i).join();
|
|
5159
5159
|
let n = i.writeUnknownFields;
|
|
5160
5160
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
5161
5161
|
}
|
|
@@ -5258,7 +5258,7 @@ const ot = new qs();
|
|
|
5258
5258
|
class Ks extends h {
|
|
5259
5259
|
constructor() {
|
|
5260
5260
|
super("MiLaboratories.PL.API.ResourceAPI.List.ByType.Response", [
|
|
5261
|
-
{ no: 1, name: "resources", kind: "map", K: 4, V: { kind: "message", T: () =>
|
|
5261
|
+
{ no: 1, name: "resources", kind: "map", K: 4, V: { kind: "message", T: () => I } }
|
|
5262
5262
|
]);
|
|
5263
5263
|
}
|
|
5264
5264
|
create(e) {
|
|
@@ -5293,17 +5293,17 @@ class Ks extends h {
|
|
|
5293
5293
|
c = t.uint64().toString();
|
|
5294
5294
|
break;
|
|
5295
5295
|
case 2:
|
|
5296
|
-
a =
|
|
5296
|
+
a = I.internalBinaryRead(t, t.uint32(), i);
|
|
5297
5297
|
break;
|
|
5298
5298
|
default:
|
|
5299
5299
|
throw new globalThis.Error("unknown map entry field for field MiLaboratories.PL.API.ResourceAPI.List.ByType.Response.resources");
|
|
5300
5300
|
}
|
|
5301
5301
|
}
|
|
5302
|
-
e[c ?? "0"] = a ??
|
|
5302
|
+
e[c ?? "0"] = a ?? I.create();
|
|
5303
5303
|
}
|
|
5304
5304
|
internalBinaryWrite(e, t, i) {
|
|
5305
5305
|
for (let r of globalThis.Object.keys(e.resources))
|
|
5306
|
-
t.tag(1, d.LengthDelimited).fork().tag(1, d.Varint).uint64(r), t.tag(2, d.LengthDelimited).fork(),
|
|
5306
|
+
t.tag(1, d.LengthDelimited).fork().tag(1, d.Varint).uint64(r), t.tag(2, d.LengthDelimited).fork(), I.internalBinaryWrite(e.resources[r], t, i), t.join().join();
|
|
5307
5307
|
let n = i.writeUnknownFields;
|
|
5308
5308
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
5309
5309
|
}
|
|
@@ -6085,7 +6085,7 @@ const bt = new co();
|
|
|
6085
6085
|
class uo extends h {
|
|
6086
6086
|
constructor() {
|
|
6087
6087
|
super("MiLaboratories.PL.API.ResourceAPI.Tree.Response", [
|
|
6088
|
-
{ no: 1, name: "resource", kind: "message", T: () =>
|
|
6088
|
+
{ no: 1, name: "resource", kind: "message", T: () => I }
|
|
6089
6089
|
]);
|
|
6090
6090
|
}
|
|
6091
6091
|
create(e) {
|
|
@@ -6099,7 +6099,7 @@ class uo extends h {
|
|
|
6099
6099
|
switch (a) {
|
|
6100
6100
|
case /* MiLaboratories.PL.API.Resource resource */
|
|
6101
6101
|
1:
|
|
6102
|
-
r.resource =
|
|
6102
|
+
r.resource = I.internalBinaryRead(e, e.uint32(), i, r.resource);
|
|
6103
6103
|
break;
|
|
6104
6104
|
default:
|
|
6105
6105
|
let s = i.readUnknownField;
|
|
@@ -6112,7 +6112,7 @@ class uo extends h {
|
|
|
6112
6112
|
return r;
|
|
6113
6113
|
}
|
|
6114
6114
|
internalBinaryWrite(e, t, i) {
|
|
6115
|
-
e.resource &&
|
|
6115
|
+
e.resource && I.internalBinaryWrite(e.resource, t.tag(1, d.LengthDelimited).fork(), i).join();
|
|
6116
6116
|
let n = i.writeUnknownFields;
|
|
6117
6117
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
6118
6118
|
}
|
|
@@ -11029,7 +11029,7 @@ class Ql extends h {
|
|
|
11029
11029
|
constructor() {
|
|
11030
11030
|
super("MiLaboratories.PL.API.CacheAPI.SetToField.Request", [
|
|
11031
11031
|
{ no: 1, name: "id", kind: "message", T: () => m },
|
|
11032
|
-
{ no: 2, name: "period", kind: "message", T: () =>
|
|
11032
|
+
{ no: 2, name: "period", kind: "message", T: () => N }
|
|
11033
11033
|
]);
|
|
11034
11034
|
}
|
|
11035
11035
|
create(e) {
|
|
@@ -11047,7 +11047,7 @@ class Ql extends h {
|
|
|
11047
11047
|
break;
|
|
11048
11048
|
case /* google.protobuf.Duration period */
|
|
11049
11049
|
2:
|
|
11050
|
-
r.period =
|
|
11050
|
+
r.period = N.internalBinaryRead(e, e.uint32(), i, r.period);
|
|
11051
11051
|
break;
|
|
11052
11052
|
default:
|
|
11053
11053
|
let s = i.readUnknownField;
|
|
@@ -11060,7 +11060,7 @@ class Ql extends h {
|
|
|
11060
11060
|
return r;
|
|
11061
11061
|
}
|
|
11062
11062
|
internalBinaryWrite(e, t, i) {
|
|
11063
|
-
e.id && m.internalBinaryWrite(e.id, t.tag(1, d.LengthDelimited).fork(), i).join(), e.period &&
|
|
11063
|
+
e.id && m.internalBinaryWrite(e.id, t.tag(1, d.LengthDelimited).fork(), i).join(), e.period && N.internalBinaryWrite(e.period, t.tag(2, d.LengthDelimited).fork(), i).join();
|
|
11064
11064
|
let n = i.writeUnknownFields;
|
|
11065
11065
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
11066
11066
|
}
|
|
@@ -11280,7 +11280,7 @@ class ac extends h {
|
|
|
11280
11280
|
L: 0
|
|
11281
11281
|
/*LongType.BIGINT*/
|
|
11282
11282
|
},
|
|
11283
|
-
{ no: 3, name: "timeout", kind: "message", T: () =>
|
|
11283
|
+
{ no: 3, name: "timeout", kind: "message", T: () => N },
|
|
11284
11284
|
{
|
|
11285
11285
|
no: 4,
|
|
11286
11286
|
name: "name",
|
|
@@ -11305,7 +11305,7 @@ class ac extends h {
|
|
|
11305
11305
|
break;
|
|
11306
11306
|
case /* google.protobuf.Duration timeout */
|
|
11307
11307
|
3:
|
|
11308
|
-
r.timeout =
|
|
11308
|
+
r.timeout = N.internalBinaryRead(e, e.uint32(), i, r.timeout);
|
|
11309
11309
|
break;
|
|
11310
11310
|
case /* string name */
|
|
11311
11311
|
4:
|
|
@@ -11322,7 +11322,7 @@ class ac extends h {
|
|
|
11322
11322
|
return r;
|
|
11323
11323
|
}
|
|
11324
11324
|
internalBinaryWrite(e, t, i) {
|
|
11325
|
-
e.resourceId !== 0n && t.tag(1, d.Varint).uint64(e.resourceId), e.timeout &&
|
|
11325
|
+
e.resourceId !== 0n && t.tag(1, d.Varint).uint64(e.resourceId), e.timeout && N.internalBinaryWrite(e.timeout, t.tag(3, d.LengthDelimited).fork(), i).join(), e.name !== "" && t.tag(4, d.LengthDelimited).string(e.name);
|
|
11326
11326
|
let n = i.writeUnknownFields;
|
|
11327
11327
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
11328
11328
|
}
|
|
@@ -11417,7 +11417,7 @@ class dc extends h {
|
|
|
11417
11417
|
T: 12
|
|
11418
11418
|
/*ScalarType.BYTES*/
|
|
11419
11419
|
},
|
|
11420
|
-
{ no: 3, name: "timeout", kind: "message", T: () =>
|
|
11420
|
+
{ no: 3, name: "timeout", kind: "message", T: () => N },
|
|
11421
11421
|
{
|
|
11422
11422
|
no: 4,
|
|
11423
11423
|
name: "name",
|
|
@@ -11446,7 +11446,7 @@ class dc extends h {
|
|
|
11446
11446
|
break;
|
|
11447
11447
|
case /* google.protobuf.Duration timeout */
|
|
11448
11448
|
3:
|
|
11449
|
-
r.timeout =
|
|
11449
|
+
r.timeout = N.internalBinaryRead(e, e.uint32(), i, r.timeout);
|
|
11450
11450
|
break;
|
|
11451
11451
|
case /* string name */
|
|
11452
11452
|
4:
|
|
@@ -11463,7 +11463,7 @@ class dc extends h {
|
|
|
11463
11463
|
return r;
|
|
11464
11464
|
}
|
|
11465
11465
|
internalBinaryWrite(e, t, i) {
|
|
11466
|
-
e.resourceId !== 0n && t.tag(1, d.Varint).uint64(e.resourceId), e.leaseId.length && t.tag(2, d.LengthDelimited).bytes(e.leaseId), e.timeout &&
|
|
11466
|
+
e.resourceId !== 0n && t.tag(1, d.Varint).uint64(e.resourceId), e.leaseId.length && t.tag(2, d.LengthDelimited).bytes(e.leaseId), e.timeout && N.internalBinaryWrite(e.timeout, t.tag(3, d.LengthDelimited).fork(), i).join(), e.name !== "" && t.tag(4, d.LengthDelimited).string(e.name);
|
|
11467
11467
|
let n = i.writeUnknownFields;
|
|
11468
11468
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
11469
11469
|
}
|
|
@@ -11847,7 +11847,7 @@ new Ac();
|
|
|
11847
11847
|
class Bc extends h {
|
|
11848
11848
|
constructor() {
|
|
11849
11849
|
super("MiLaboratories.PL.API.AuthAPI.GetJWTToken.Request", [
|
|
11850
|
-
{ no: 1, name: "expiration", kind: "message", T: () =>
|
|
11850
|
+
{ no: 1, name: "expiration", kind: "message", T: () => N }
|
|
11851
11851
|
]);
|
|
11852
11852
|
}
|
|
11853
11853
|
create(e) {
|
|
@@ -11861,7 +11861,7 @@ class Bc extends h {
|
|
|
11861
11861
|
switch (a) {
|
|
11862
11862
|
case /* google.protobuf.Duration expiration */
|
|
11863
11863
|
1:
|
|
11864
|
-
r.expiration =
|
|
11864
|
+
r.expiration = N.internalBinaryRead(e, e.uint32(), i, r.expiration);
|
|
11865
11865
|
break;
|
|
11866
11866
|
default:
|
|
11867
11867
|
let s = i.readUnknownField;
|
|
@@ -11874,7 +11874,7 @@ class Bc extends h {
|
|
|
11874
11874
|
return r;
|
|
11875
11875
|
}
|
|
11876
11876
|
internalBinaryWrite(e, t, i) {
|
|
11877
|
-
e.expiration &&
|
|
11877
|
+
e.expiration && N.internalBinaryWrite(e.expiration, t.tag(1, d.LengthDelimited).fork(), i).join();
|
|
11878
11878
|
let n = i.writeUnknownFields;
|
|
11879
11879
|
return n !== !1 && (n == !0 ? f.onWrite : n)(this.typeName, e, t), t;
|
|
11880
11880
|
}
|
|
@@ -12247,34 +12247,40 @@ function Bi(l, e = !1) {
|
|
|
12247
12247
|
}
|
|
12248
12248
|
const Un = 5;
|
|
12249
12249
|
class $i extends Error {
|
|
12250
|
-
constructor(
|
|
12251
|
-
super(`code=${
|
|
12250
|
+
constructor(t) {
|
|
12251
|
+
super(`code=${t.code} ${t.message}`);
|
|
12252
|
+
y(this, "name", "PlError");
|
|
12253
|
+
this.status = t;
|
|
12252
12254
|
}
|
|
12253
12255
|
}
|
|
12254
12256
|
function Jc(l) {
|
|
12255
12257
|
throw new Fn({ code: Un, message: l, details: [] });
|
|
12256
12258
|
}
|
|
12257
12259
|
class Fn extends $i {
|
|
12258
|
-
constructor(
|
|
12259
|
-
super(
|
|
12260
|
+
constructor(t) {
|
|
12261
|
+
super(t);
|
|
12262
|
+
y(this, "name", "RecoverablePlError");
|
|
12260
12263
|
}
|
|
12261
12264
|
}
|
|
12262
12265
|
class zc extends $i {
|
|
12263
|
-
constructor(
|
|
12264
|
-
super(
|
|
12266
|
+
constructor(t) {
|
|
12267
|
+
super(t);
|
|
12268
|
+
y(this, "name", "UnrecoverablePlError");
|
|
12265
12269
|
}
|
|
12266
12270
|
}
|
|
12267
12271
|
function Ui(l, e = !1) {
|
|
12268
12272
|
return l.name == "RpcError" && l.code == "NOT_FOUND" ? !0 : l.cause !== void 0 && !e ? Ui(l.cause, !0) : l instanceof Fn && l.status.code === Un;
|
|
12269
12273
|
}
|
|
12270
12274
|
class En extends Error {
|
|
12271
|
-
constructor(
|
|
12272
|
-
super("LoginFailed: " +
|
|
12275
|
+
constructor(t) {
|
|
12276
|
+
super("LoginFailed: " + t);
|
|
12277
|
+
y(this, "name", "UnauthenticatedError");
|
|
12273
12278
|
}
|
|
12274
12279
|
}
|
|
12275
12280
|
class Fi extends Error {
|
|
12276
|
-
constructor(
|
|
12277
|
-
super("Disconnected: " +
|
|
12281
|
+
constructor(t) {
|
|
12282
|
+
super("Disconnected: " + t);
|
|
12283
|
+
y(this, "name", "DisconnectedError");
|
|
12278
12284
|
}
|
|
12279
12285
|
}
|
|
12280
12286
|
function Hc(l, e = !1) {
|
|
@@ -12289,7 +12295,7 @@ function Yn(l) {
|
|
|
12289
12295
|
return Yc(l) && Jc("resource deleted"), {
|
|
12290
12296
|
id: l.id,
|
|
12291
12297
|
originalResourceId: l.originalResourceId,
|
|
12292
|
-
type:
|
|
12298
|
+
type: R(l.type),
|
|
12293
12299
|
data: l.data,
|
|
12294
12300
|
inputsLocked: l.inputsLocked,
|
|
12295
12301
|
outputsLocked: l.outputsLocked,
|
|
@@ -12319,7 +12325,7 @@ function Xc(l) {
|
|
|
12319
12325
|
function xi(l) {
|
|
12320
12326
|
var e;
|
|
12321
12327
|
return {
|
|
12322
|
-
name:
|
|
12328
|
+
name: R((e = l.id) == null ? void 0 : e.fieldName),
|
|
12323
12329
|
type: Qc(l.type),
|
|
12324
12330
|
status: eu(l.valueStatus),
|
|
12325
12331
|
value: l.value,
|
|
@@ -12435,13 +12441,17 @@ function G(l, e) {
|
|
|
12435
12441
|
kvGetBytes: l.kvGetBytes + e.kvGetBytes
|
|
12436
12442
|
};
|
|
12437
12443
|
}
|
|
12438
|
-
|
|
12444
|
+
const nu = {
|
|
12445
|
+
name: "json/resourceError",
|
|
12446
|
+
version: "1"
|
|
12447
|
+
};
|
|
12448
|
+
function uf(l) {
|
|
12439
12449
|
return l.hasOwnProperty("resourceId") && l.hasOwnProperty("fieldName");
|
|
12440
12450
|
}
|
|
12441
|
-
function
|
|
12451
|
+
function iu(l) {
|
|
12442
12452
|
return typeof l == "bigint" || l.hasOwnProperty("globalId") && l.hasOwnProperty("localId");
|
|
12443
12453
|
}
|
|
12444
|
-
function
|
|
12454
|
+
function ff(l) {
|
|
12445
12455
|
return typeof l == "bigint" && !x(l) && !B(l);
|
|
12446
12456
|
}
|
|
12447
12457
|
function Wi(l) {
|
|
@@ -12453,13 +12463,13 @@ function M(l) {
|
|
|
12453
12463
|
function A(l) {
|
|
12454
12464
|
return Wi(l) ? { resourceId: l.resourceId.localId, fieldName: l.fieldName } : l;
|
|
12455
12465
|
}
|
|
12456
|
-
async function
|
|
12466
|
+
async function df(l) {
|
|
12457
12467
|
return Wi(l) ? { resourceId: await l.resourceId.globalId, fieldName: l.fieldName } : l;
|
|
12458
12468
|
}
|
|
12459
|
-
function
|
|
12469
|
+
function T(l) {
|
|
12460
12470
|
return M(l) ? l.localId : l;
|
|
12461
12471
|
}
|
|
12462
|
-
async function
|
|
12472
|
+
async function ru(l) {
|
|
12463
12473
|
return M(l) ? await l.globalId : l;
|
|
12464
12474
|
}
|
|
12465
12475
|
function xn(l, e) {
|
|
@@ -12502,7 +12512,7 @@ const $ = class $ {
|
|
|
12502
12512
|
},
|
|
12503
12513
|
(a) => {
|
|
12504
12514
|
var o;
|
|
12505
|
-
return
|
|
12515
|
+
return R((o = a.txOpen.tx) == null ? void 0 : o.id);
|
|
12506
12516
|
}
|
|
12507
12517
|
), this.globalTxId.catch((a) => {
|
|
12508
12518
|
this.globalTxIdWasAwaited || console.warn(a);
|
|
@@ -12587,7 +12597,7 @@ const $ = class $ {
|
|
|
12587
12597
|
loadFields: t
|
|
12588
12598
|
}
|
|
12589
12599
|
},
|
|
12590
|
-
(i) => Yn(
|
|
12600
|
+
(i) => Yn(R(i.resourceGetSingleton.resource))
|
|
12591
12601
|
);
|
|
12592
12602
|
}
|
|
12593
12603
|
createResource(e, t, i) {
|
|
@@ -12644,10 +12654,13 @@ const $ = class $ {
|
|
|
12644
12654
|
(n) => n.resourceCreateValue.resourceId
|
|
12645
12655
|
);
|
|
12646
12656
|
}
|
|
12657
|
+
createError(e) {
|
|
12658
|
+
return this.createValue(nu, JSON.stringify({ message: e }));
|
|
12659
|
+
}
|
|
12647
12660
|
setResourceName(e, t) {
|
|
12648
12661
|
this.sendVoidAsync({
|
|
12649
12662
|
oneofKind: "resourceNameSet",
|
|
12650
|
-
resourceNameSet: { resourceId:
|
|
12663
|
+
resourceNameSet: { resourceId: T(t), name: e }
|
|
12651
12664
|
});
|
|
12652
12665
|
}
|
|
12653
12666
|
deleteResourceName(e) {
|
|
@@ -12687,9 +12700,9 @@ const $ = class $ {
|
|
|
12687
12700
|
const n = await this.sendSingleAndParse(
|
|
12688
12701
|
{
|
|
12689
12702
|
oneofKind: "resourceGet",
|
|
12690
|
-
resourceGet: { resourceId:
|
|
12703
|
+
resourceGet: { resourceId: T(e), loadFields: t }
|
|
12691
12704
|
},
|
|
12692
|
-
(o) => Yn(
|
|
12705
|
+
(o) => Yn(R(o.resourceGet.resource))
|
|
12693
12706
|
);
|
|
12694
12707
|
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)) {
|
|
12695
12708
|
jn(n);
|
|
@@ -12727,7 +12740,7 @@ const $ = class $ {
|
|
|
12727
12740
|
lockInputs(e) {
|
|
12728
12741
|
this.stat.inputsLocked++, this.sendVoidAsync({
|
|
12729
12742
|
oneofKind: "resourceLockInputs",
|
|
12730
|
-
resourceLockInputs: { resourceId:
|
|
12743
|
+
resourceLockInputs: { resourceId: T(e) }
|
|
12731
12744
|
});
|
|
12732
12745
|
}
|
|
12733
12746
|
/**
|
|
@@ -12737,12 +12750,18 @@ const $ = class $ {
|
|
|
12737
12750
|
lockOutputs(e) {
|
|
12738
12751
|
this.stat.outputsLocked++, this.sendVoidAsync({
|
|
12739
12752
|
oneofKind: "resourceLockOutputs",
|
|
12740
|
-
resourceLockOutputs: { resourceId:
|
|
12753
|
+
resourceLockOutputs: { resourceId: T(e) }
|
|
12741
12754
|
});
|
|
12742
12755
|
}
|
|
12743
12756
|
lock(e) {
|
|
12744
12757
|
this.lockInputs(e), this.lockOutputs(e);
|
|
12745
12758
|
}
|
|
12759
|
+
setResourceError(e, t) {
|
|
12760
|
+
this.sendVoidAsync({
|
|
12761
|
+
oneofKind: "resourceSetError",
|
|
12762
|
+
resourceSetError: { resourceId: T(e), errorResourceId: T(t) }
|
|
12763
|
+
});
|
|
12764
|
+
}
|
|
12746
12765
|
//
|
|
12747
12766
|
// Fields
|
|
12748
12767
|
//
|
|
@@ -12762,12 +12781,12 @@ const $ = class $ {
|
|
|
12762
12781
|
);
|
|
12763
12782
|
}
|
|
12764
12783
|
setField(e, t) {
|
|
12765
|
-
this.stat.fieldsSet++,
|
|
12784
|
+
this.stat.fieldsSet++, iu(t) ? this.sendVoidAsync({
|
|
12766
12785
|
oneofKind: "fieldSet",
|
|
12767
12786
|
fieldSet: {
|
|
12768
12787
|
field: A(e),
|
|
12769
12788
|
value: {
|
|
12770
|
-
resourceId:
|
|
12789
|
+
resourceId: T(t),
|
|
12771
12790
|
fieldName: ""
|
|
12772
12791
|
// default value, read as undefined
|
|
12773
12792
|
}
|
|
@@ -12783,13 +12802,13 @@ const $ = class $ {
|
|
|
12783
12802
|
setFieldError(e, t) {
|
|
12784
12803
|
this.stat.fieldsSet++, this.sendVoidAsync({
|
|
12785
12804
|
oneofKind: "fieldSetError",
|
|
12786
|
-
fieldSetError: { field: A(e), errResourceId:
|
|
12805
|
+
fieldSetError: { field: A(e), errResourceId: T(t) }
|
|
12787
12806
|
});
|
|
12788
12807
|
}
|
|
12789
12808
|
async getField(e) {
|
|
12790
12809
|
return this.stat.fieldsGet++, await this.sendSingleAndParse(
|
|
12791
12810
|
{ oneofKind: "fieldGet", fieldGet: { field: A(e) } },
|
|
12792
|
-
(t) => xi(
|
|
12811
|
+
(t) => xi(R(t.fieldGet.field))
|
|
12793
12812
|
);
|
|
12794
12813
|
}
|
|
12795
12814
|
async getFieldIfExists(e) {
|
|
@@ -12808,7 +12827,7 @@ const $ = class $ {
|
|
|
12808
12827
|
const t = await this.sendMultiAndParse(
|
|
12809
12828
|
{
|
|
12810
12829
|
oneofKind: "resourceKeyValueList",
|
|
12811
|
-
resourceKeyValueList: { resourceId:
|
|
12830
|
+
resourceKeyValueList: { resourceId: T(e), startFrom: "", limit: 0 }
|
|
12812
12831
|
},
|
|
12813
12832
|
(i) => i.map((n) => n.resourceKeyValueList.record)
|
|
12814
12833
|
);
|
|
@@ -12832,7 +12851,7 @@ const $ = class $ {
|
|
|
12832
12851
|
this.stat.kvSetRequests++, this.stat.kvSetBytes++, this.sendVoidAsync({
|
|
12833
12852
|
oneofKind: "resourceKeyValueSet",
|
|
12834
12853
|
resourceKeyValueSet: {
|
|
12835
|
-
resourceId:
|
|
12854
|
+
resourceId: T(e),
|
|
12836
12855
|
key: t,
|
|
12837
12856
|
value: Gc(i)
|
|
12838
12857
|
}
|
|
@@ -12842,7 +12861,7 @@ const $ = class $ {
|
|
|
12842
12861
|
this.sendVoidAsync({
|
|
12843
12862
|
oneofKind: "resourceKeyValueDelete",
|
|
12844
12863
|
resourceKeyValueDelete: {
|
|
12845
|
-
resourceId:
|
|
12864
|
+
resourceId: T(e),
|
|
12846
12865
|
key: t
|
|
12847
12866
|
}
|
|
12848
12867
|
});
|
|
@@ -12851,7 +12870,7 @@ const $ = class $ {
|
|
|
12851
12870
|
const i = await this.sendSingleAndParse(
|
|
12852
12871
|
{
|
|
12853
12872
|
oneofKind: "resourceKeyValueGet",
|
|
12854
|
-
resourceKeyValueGet: { resourceId:
|
|
12873
|
+
resourceKeyValueGet: { resourceId: T(e), key: t }
|
|
12855
12874
|
},
|
|
12856
12875
|
(n) => n.resourceKeyValueGet.value
|
|
12857
12876
|
);
|
|
@@ -12867,7 +12886,7 @@ const $ = class $ {
|
|
|
12867
12886
|
const i = await this.sendSingleAndParse(
|
|
12868
12887
|
{
|
|
12869
12888
|
oneofKind: "resourceKeyValueGetIfExists",
|
|
12870
|
-
resourceKeyValueGetIfExists: { resourceId:
|
|
12889
|
+
resourceKeyValueGetIfExists: { resourceId: T(e), key: t }
|
|
12871
12890
|
},
|
|
12872
12891
|
(n) => n.resourceKeyValueGetIfExists.exists ? n.resourceKeyValueGetIfExists.value : void 0
|
|
12873
12892
|
);
|
|
@@ -12924,26 +12943,26 @@ const $ = class $ {
|
|
|
12924
12943
|
};
|
|
12925
12944
|
y($, "localTxIdCounter", 0);
|
|
12926
12945
|
let In = $;
|
|
12927
|
-
function
|
|
12946
|
+
function _(l, e) {
|
|
12928
12947
|
return { name: l, version: e };
|
|
12929
12948
|
}
|
|
12930
|
-
const Pn =
|
|
12931
|
-
function
|
|
12949
|
+
const Pn = _("ClientRoot", "1"), su = _("StructTest", "1"), ou = _("ValueTest", "1"), Ci = _("json/string", "1"), Di = _("json/bool", "1"), vi = _("json/object", "1"), Oi = _("json/array", "1"), qi = _("json/number", "1"), Ki = _("json/null", "1"), au = _("Null", "1"), Wn = _("EphStdMap", "1"), Sn = _("StdMap", "1");
|
|
12950
|
+
function lu(l) {
|
|
12932
12951
|
return l.createValue(Ki, Buffer.from(JSON.stringify(null)));
|
|
12933
12952
|
}
|
|
12934
|
-
function
|
|
12953
|
+
function cu(l, e) {
|
|
12935
12954
|
return l.createValue(Di, Buffer.from(JSON.stringify(e)));
|
|
12936
12955
|
}
|
|
12937
|
-
function
|
|
12956
|
+
function uu(l, e) {
|
|
12938
12957
|
return l.createValue(qi, Buffer.from(JSON.stringify(e)));
|
|
12939
12958
|
}
|
|
12940
|
-
function
|
|
12959
|
+
function fu(l, e) {
|
|
12941
12960
|
return l.createValue(Ci, Buffer.from(JSON.stringify(e)));
|
|
12942
12961
|
}
|
|
12943
|
-
function
|
|
12962
|
+
function du(l, e) {
|
|
12944
12963
|
return l.createValue(Oi, Buffer.from(JSON.stringify(e)));
|
|
12945
12964
|
}
|
|
12946
|
-
function
|
|
12965
|
+
function hu(l, e) {
|
|
12947
12966
|
return l.createValue(vi, Buffer.from(JSON.stringify(e)));
|
|
12948
12967
|
}
|
|
12949
12968
|
function Cn(l, e) {
|
|
@@ -12952,30 +12971,30 @@ function Cn(l, e) {
|
|
|
12952
12971
|
function ji(l, e) {
|
|
12953
12972
|
return e === void 0 ? Object.entries(l) : e.map((t) => Cn(t, l[t]));
|
|
12954
12973
|
}
|
|
12955
|
-
function
|
|
12974
|
+
function pu(l, e, t, i) {
|
|
12956
12975
|
const n = i ?? (t ? Wn : Sn), r = t ? l.createEphemeral(n) : l.createStruct(n);
|
|
12957
12976
|
for (const [c, a] of Array.isArray(e) ? e : ji(e))
|
|
12958
12977
|
l.createField(xn(r, c), "Input", a);
|
|
12959
12978
|
return l.lock(r), r;
|
|
12960
12979
|
}
|
|
12961
|
-
function
|
|
12980
|
+
function yu(l, e, t, i, n = "") {
|
|
12962
12981
|
return Object.fromEntries(
|
|
12963
12982
|
t.map((r) => Cn(r, l.getFutureFieldValue(e, `${n}${r}`, i)))
|
|
12964
12983
|
);
|
|
12965
12984
|
}
|
|
12966
12985
|
const Vi = Sn, Mi = Wn, me = "ref";
|
|
12967
|
-
function
|
|
12986
|
+
function wu(l, e) {
|
|
12968
12987
|
const t = l.createStruct(Vi), i = xn(t, me);
|
|
12969
12988
|
return l.createField(i, "Input", e), l.lock(t), t;
|
|
12970
12989
|
}
|
|
12971
|
-
function
|
|
12990
|
+
function mu(l, e) {
|
|
12972
12991
|
const t = l.createEphemeral(Mi), i = xn(t, me);
|
|
12973
12992
|
return l.createField(i, "Input", e), l.lock(t), t;
|
|
12974
12993
|
}
|
|
12975
|
-
function
|
|
12994
|
+
function gu(l, e) {
|
|
12976
12995
|
return l.getFutureFieldValue(e, me, "Input");
|
|
12977
12996
|
}
|
|
12978
|
-
const
|
|
12997
|
+
const hf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
12979
12998
|
__proto__: null,
|
|
12980
12999
|
ClientRoot: Pn,
|
|
12981
13000
|
EphHolder: Mi,
|
|
@@ -12988,25 +13007,25 @@ const df = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
12988
13007
|
JsonNumber: qi,
|
|
12989
13008
|
JsonObject: vi,
|
|
12990
13009
|
JsonString: Ci,
|
|
12991
|
-
RNull:
|
|
13010
|
+
RNull: au,
|
|
12992
13011
|
StdMap: Sn,
|
|
12993
|
-
StructTestResource:
|
|
12994
|
-
ValueTestResource:
|
|
12995
|
-
createPlArray:
|
|
12996
|
-
createPlBool:
|
|
12997
|
-
createPlMap:
|
|
12998
|
-
createPlNull:
|
|
12999
|
-
createPlNumber:
|
|
13000
|
-
createPlObject:
|
|
13001
|
-
createPlString:
|
|
13002
|
-
futureRecord:
|
|
13012
|
+
StructTestResource: su,
|
|
13013
|
+
ValueTestResource: ou,
|
|
13014
|
+
createPlArray: du,
|
|
13015
|
+
createPlBool: cu,
|
|
13016
|
+
createPlMap: pu,
|
|
13017
|
+
createPlNull: lu,
|
|
13018
|
+
createPlNumber: uu,
|
|
13019
|
+
createPlObject: hu,
|
|
13020
|
+
createPlString: fu,
|
|
13021
|
+
futureRecord: yu,
|
|
13003
13022
|
plEntries: ji,
|
|
13004
13023
|
plEntry: Cn,
|
|
13005
|
-
unwrapHolder:
|
|
13006
|
-
wrapInEphHolder:
|
|
13007
|
-
wrapInHolder:
|
|
13024
|
+
unwrapHolder: gu,
|
|
13025
|
+
wrapInEphHolder: mu,
|
|
13026
|
+
wrapInHolder: wu
|
|
13008
13027
|
}, Symbol.toStringTag, { value: "Module" })), Zn = 5e3, Xn = 3e5, Qn = 6e4, ei = 31 * 24 * 60 * 60, ti = 12 * 24 * 60 * 60, ni = 128e6, ii = "exponential", ri = 16, si = 14, oi = 1.5, ai = 50, li = 0.3;
|
|
13009
|
-
function
|
|
13028
|
+
function P(l) {
|
|
13010
13029
|
if (!l) return;
|
|
13011
13030
|
const e = Number(l);
|
|
13012
13031
|
if (Number.isNaN(e)) throw new Error(`Can't parse number: ${l}`);
|
|
@@ -13043,29 +13062,29 @@ function ye(l, e = {}) {
|
|
|
13043
13062
|
// this also includes port
|
|
13044
13063
|
alternativeRoot: t.searchParams.get("alternative-root") ?? void 0,
|
|
13045
13064
|
ssl: t.protocol === "https:" || t.protocol === "tls:",
|
|
13046
|
-
defaultRequestTimeout:
|
|
13047
|
-
defaultROTransactionTimeout:
|
|
13048
|
-
defaultRWTransactionTimeout:
|
|
13065
|
+
defaultRequestTimeout: P(t.searchParams.get("request-timeout")) ?? Zn,
|
|
13066
|
+
defaultROTransactionTimeout: P(t.searchParams.get("ro-tx-timeout")) ?? P(t.searchParams.get("tx-timeout")) ?? Xn,
|
|
13067
|
+
defaultRWTransactionTimeout: P(t.searchParams.get("rw-tx-timeout")) ?? P(t.searchParams.get("tx-timeout")) ?? Qn,
|
|
13049
13068
|
authTTLSeconds: ei,
|
|
13050
13069
|
authMaxRefreshSeconds: ti,
|
|
13051
13070
|
grpcProxy: t.searchParams.get("grpc-proxy") ?? void 0,
|
|
13052
13071
|
httpProxy: t.searchParams.get("http-proxy") ?? void 0,
|
|
13053
13072
|
user: t.username === "" ? void 0 : t.username,
|
|
13054
13073
|
password: t.password === "" ? void 0 : t.password,
|
|
13055
|
-
txDelay:
|
|
13074
|
+
txDelay: P(t.searchParams.get("tx-delay")) ?? 0,
|
|
13056
13075
|
forceSync: !!t.searchParams.get("force-sync"),
|
|
13057
|
-
maxCacheBytes:
|
|
13076
|
+
maxCacheBytes: P(t.searchParams.get("max-cache-bytes")) ?? ni,
|
|
13058
13077
|
retryBackoffAlgorithm: t.searchParams.get("retry-backoff-algorithm") ?? ii,
|
|
13059
|
-
retryMaxAttempts:
|
|
13060
|
-
retryInitialDelay:
|
|
13061
|
-
retryExponentialBackoffMultiplier:
|
|
13062
|
-
retryLinearBackoffStep:
|
|
13063
|
-
retryJitter:
|
|
13078
|
+
retryMaxAttempts: P(t.searchParams.get("retry-max-attempts")) ?? ri,
|
|
13079
|
+
retryInitialDelay: P(t.searchParams.get("retry-initial-delay")) ?? si,
|
|
13080
|
+
retryExponentialBackoffMultiplier: P(t.searchParams.get("retry-exp-backoff-multiplier")) ?? oi,
|
|
13081
|
+
retryLinearBackoffStep: P(t.searchParams.get("retry-linear-backoff-step")) ?? ai,
|
|
13082
|
+
retryJitter: P(t.searchParams.get("retry-backoff-jitter")) ?? li,
|
|
13064
13083
|
...e
|
|
13065
13084
|
};
|
|
13066
13085
|
}
|
|
13067
|
-
const
|
|
13068
|
-
class
|
|
13086
|
+
const pf = {};
|
|
13087
|
+
class ku {
|
|
13069
13088
|
constructor(e) {
|
|
13070
13089
|
y(this, "typeName", gn.typeName);
|
|
13071
13090
|
y(this, "methods", gn.methods);
|
|
@@ -13276,10 +13295,10 @@ class gu {
|
|
|
13276
13295
|
return g("unary", this._transport, i, n, e);
|
|
13277
13296
|
}
|
|
13278
13297
|
}
|
|
13279
|
-
function
|
|
13298
|
+
function bu(l, e, t, i) {
|
|
13280
13299
|
return { kind: l, expectMultiResponse: e, resolve: t, reject: i };
|
|
13281
13300
|
}
|
|
13282
|
-
function
|
|
13301
|
+
function Tu(l) {
|
|
13283
13302
|
return l.code === Un;
|
|
13284
13303
|
}
|
|
13285
13304
|
class J extends Error {
|
|
@@ -13287,7 +13306,7 @@ class J extends Error {
|
|
|
13287
13306
|
super("Rethrow error, you should never see this one."), this.rethrowLambda = e;
|
|
13288
13307
|
}
|
|
13289
13308
|
}
|
|
13290
|
-
class
|
|
13309
|
+
class Ru {
|
|
13291
13310
|
constructor(e) {
|
|
13292
13311
|
/** Bidirectional channel through which transaction communicates with the server */
|
|
13293
13312
|
y(this, "stream");
|
|
@@ -13341,7 +13360,7 @@ class Tu {
|
|
|
13341
13360
|
}
|
|
13342
13361
|
if (r.error !== void 0) {
|
|
13343
13362
|
const c = r.error;
|
|
13344
|
-
if (
|
|
13363
|
+
if (Tu(c)) {
|
|
13345
13364
|
if (t.reject(
|
|
13346
13365
|
new J(() => {
|
|
13347
13366
|
throw new Fn(c);
|
|
@@ -13426,7 +13445,7 @@ class Tu {
|
|
|
13426
13445
|
if (this.closed) return Promise.reject(new Error("Transaction already closed"));
|
|
13427
13446
|
const i = new Promise((n, r) => {
|
|
13428
13447
|
this.responseHandlerQueue.push(
|
|
13429
|
-
|
|
13448
|
+
bu(e.oneofKind, t, n, r)
|
|
13430
13449
|
);
|
|
13431
13450
|
});
|
|
13432
13451
|
await this.stream.requests.send({
|
|
@@ -13456,7 +13475,7 @@ function X(l, e) {
|
|
|
13456
13475
|
i + e
|
|
13457
13476
|
) * 1e3;
|
|
13458
13477
|
}
|
|
13459
|
-
function
|
|
13478
|
+
function yf(l) {
|
|
13460
13479
|
return l.jwtToken === void 0 ? void 0 : Dn(l.jwtToken).exp * 1e3;
|
|
13461
13480
|
}
|
|
13462
13481
|
class vn {
|
|
@@ -13505,7 +13524,7 @@ class vn {
|
|
|
13505
13524
|
};
|
|
13506
13525
|
this.conf.grpcProxy ? process.env.grpc_proxy = this.conf.grpcProxy : delete process.env.grpc_proxy;
|
|
13507
13526
|
const n = this._grpcTransport;
|
|
13508
|
-
this._grpcTransport = new Qi(i), this._grpcPl = new
|
|
13527
|
+
this._grpcTransport = new Qi(i), this._grpcPl = new ku(this._grpcTransport), n !== void 0 && n.close();
|
|
13509
13528
|
}
|
|
13510
13529
|
get grpcTransport() {
|
|
13511
13530
|
return this._grpcTransport;
|
|
@@ -13575,7 +13594,7 @@ class vn {
|
|
|
13575
13594
|
});
|
|
13576
13595
|
}
|
|
13577
13596
|
createTx(e, t = {}) {
|
|
13578
|
-
return new
|
|
13597
|
+
return new Ru((i) => {
|
|
13579
13598
|
let n = i;
|
|
13580
13599
|
return t.abortSignal && (n = AbortSignal.any([n, t.abortSignal])), this.grpcPl.tx({
|
|
13581
13600
|
abort: n,
|
|
@@ -13591,14 +13610,14 @@ class vn {
|
|
|
13591
13610
|
function de(l) {
|
|
13592
13611
|
return l.resourceReady || C(l.originalResourceId) || C(l.error);
|
|
13593
13612
|
}
|
|
13594
|
-
function
|
|
13613
|
+
function Iu(l) {
|
|
13595
13614
|
if (!de(l) || !l.outputsLocked) return !1;
|
|
13596
13615
|
if (l.fields === void 0) return !0;
|
|
13597
13616
|
for (const e of l.fields)
|
|
13598
13617
|
if (B(e.error) && (B(e.value) || !e.valueIsFinal)) return !1;
|
|
13599
13618
|
return !0;
|
|
13600
13619
|
}
|
|
13601
|
-
const ci = /* @__PURE__ */ new Set(),
|
|
13620
|
+
const ci = /* @__PURE__ */ new Set(), Pu = (l) => {
|
|
13602
13621
|
switch (l.type.name) {
|
|
13603
13622
|
case "StreamManager": {
|
|
13604
13623
|
if (!de(l)) return !1;
|
|
@@ -13644,7 +13663,7 @@ const ci = /* @__PURE__ */ new Set(), Iu = (l) => {
|
|
|
13644
13663
|
default:
|
|
13645
13664
|
if (l.type.name.startsWith("Blob/")) return !0;
|
|
13646
13665
|
if (l.type.name.startsWith("BlobUpload/") || l.type.name.startsWith("BlobIndex/"))
|
|
13647
|
-
return
|
|
13666
|
+
return Iu(l);
|
|
13648
13667
|
if (l.type.name.startsWith("PColumnData/"))
|
|
13649
13668
|
return de(l);
|
|
13650
13669
|
ci.has(l.type.name) || (console.log("UNKNOWN RESOURCE TYPE: " + l.type.name), ci.add(l.type.name));
|
|
@@ -13652,7 +13671,7 @@ const ci = /* @__PURE__ */ new Set(), Iu = (l) => {
|
|
|
13652
13671
|
return !1;
|
|
13653
13672
|
}, kn = {
|
|
13654
13673
|
sync: !1
|
|
13655
|
-
},
|
|
13674
|
+
}, Nu = "AnonymousRoot";
|
|
13656
13675
|
function ui(l) {
|
|
13657
13676
|
return `alternative_root_${l}`;
|
|
13658
13677
|
}
|
|
@@ -13683,7 +13702,7 @@ class ge {
|
|
|
13683
13702
|
y(this, "resourceDataCache");
|
|
13684
13703
|
this.buildLLPlClient = (r) => new vn(e, { auth: t, ...i, shouldUseGzip: r }), this._ll = this.buildLLPlClient(!1);
|
|
13685
13704
|
const n = this._ll.conf;
|
|
13686
|
-
switch (this.txDelay = n.txDelay, this.forceSync = n.forceSync, this.finalPredicate = i.finalPredicate ??
|
|
13705
|
+
switch (this.txDelay = n.txDelay, this.forceSync = n.forceSync, this.finalPredicate = i.finalPredicate ?? Pu, this.resourceDataCache = new nr({
|
|
13687
13706
|
maxSize: n.maxCacheBytes,
|
|
13688
13707
|
sizeCalculation: (r) => {
|
|
13689
13708
|
var c;
|
|
@@ -13758,11 +13777,11 @@ class ge {
|
|
|
13758
13777
|
/** Currently implements custom logic to emulate future behaviour with single root. */
|
|
13759
13778
|
async init() {
|
|
13760
13779
|
if (this.initialized) throw new Error("Already initialized");
|
|
13761
|
-
const e = this._ll.authUser, t = e === null ?
|
|
13780
|
+
const e = this._ll.authUser, t = e === null ? Nu : ki("sha256").update(e).digest("hex");
|
|
13762
13781
|
this._serverInfo = await this.ping(), this._serverInfo.compression === $n.GZIP && (await this._ll.close(), this._ll = this.buildLLPlClient(!0)), this._clientRoot = await this._withTx("initialization", !0, S, async (i) => {
|
|
13763
13782
|
let n;
|
|
13764
13783
|
if (await i.checkResourceNameExists(t) ? n = await i.getResourceByName(t) : (n = i.createRoot(Pn), i.setResourceName(t, n)), this.conf.alternativeRoot === void 0)
|
|
13765
|
-
return await i.commit(), await
|
|
13784
|
+
return await i.commit(), await ru(n);
|
|
13766
13785
|
{
|
|
13767
13786
|
const r = {
|
|
13768
13787
|
resourceId: n,
|
|
@@ -13835,7 +13854,7 @@ class ge {
|
|
|
13835
13854
|
return await n.init(), n;
|
|
13836
13855
|
}
|
|
13837
13856
|
}
|
|
13838
|
-
function
|
|
13857
|
+
function wf(l, e) {
|
|
13839
13858
|
return e = e ?? {}, e.meta = e.meta ?? {}, e.meta.resourceType = `${l.name}:${l.version}`, e;
|
|
13840
13859
|
}
|
|
13841
13860
|
class Gi {
|
|
@@ -13861,7 +13880,7 @@ class Gi {
|
|
|
13861
13880
|
authorization: "Basic " + Buffer.from(e + ":" + t).toString("base64")
|
|
13862
13881
|
}
|
|
13863
13882
|
}
|
|
13864
|
-
).response, n =
|
|
13883
|
+
).response, n = R(i.token);
|
|
13865
13884
|
if (n === "") throw new Error("empty token");
|
|
13866
13885
|
return { jwtToken: n };
|
|
13867
13886
|
} catch (i) {
|
|
@@ -13869,12 +13888,12 @@ class Gi {
|
|
|
13869
13888
|
}
|
|
13870
13889
|
}
|
|
13871
13890
|
}
|
|
13872
|
-
const
|
|
13873
|
-
Nu,
|
|
13874
|
-
Lu,
|
|
13891
|
+
const _u = "pl.json", Lu = Ln.join(Ti.homedir(), ".pl.json"), Au = "pl.yaml", Bu = Ln.join(Ti.homedir(), ".pl.yaml"), $u = [
|
|
13875
13892
|
_u,
|
|
13876
|
-
Au
|
|
13877
|
-
|
|
13893
|
+
Au,
|
|
13894
|
+
Lu,
|
|
13895
|
+
Bu
|
|
13896
|
+
], Y = ".pl_auth.json", Uu = [
|
|
13878
13897
|
"grpcProxy",
|
|
13879
13898
|
"httpProxy",
|
|
13880
13899
|
"user",
|
|
@@ -13886,14 +13905,14 @@ const Nu = "pl.json", _u = Ln.join(Ti.homedir(), ".pl.json"), Lu = "pl.yaml", Au
|
|
|
13886
13905
|
"authTTLSeconds",
|
|
13887
13906
|
"authMaxRefreshSeconds"
|
|
13888
13907
|
];
|
|
13889
|
-
function
|
|
13890
|
-
for (const l of
|
|
13908
|
+
function Fu() {
|
|
13909
|
+
for (const l of $u)
|
|
13891
13910
|
if (E.existsSync(l)) {
|
|
13892
13911
|
const e = E.readFileSync(l, { encoding: "utf-8" });
|
|
13893
13912
|
return l.endsWith("json") ? [JSON.parse(e), l] : [rr.parse(e), l];
|
|
13894
13913
|
}
|
|
13895
13914
|
}
|
|
13896
|
-
function
|
|
13915
|
+
function Eu(l, e) {
|
|
13897
13916
|
return (t) => {
|
|
13898
13917
|
E.writeFileSync(
|
|
13899
13918
|
Y,
|
|
@@ -13911,16 +13930,16 @@ function Fu(l, e) {
|
|
|
13911
13930
|
const fi = () => {
|
|
13912
13931
|
E.rmSync(Y);
|
|
13913
13932
|
};
|
|
13914
|
-
async function
|
|
13933
|
+
async function mf() {
|
|
13915
13934
|
let l;
|
|
13916
13935
|
if (process.env.PL_ADDRESS !== void 0)
|
|
13917
13936
|
l = ye(process.env.PL_ADDRESS);
|
|
13918
13937
|
else {
|
|
13919
|
-
const i =
|
|
13938
|
+
const i = Fu();
|
|
13920
13939
|
if (i !== void 0) {
|
|
13921
|
-
const [n, r] = i, c =
|
|
13940
|
+
const [n, r] = i, c = R(n.address, `no pl address in file: ${r}`);
|
|
13922
13941
|
l = ye(c);
|
|
13923
|
-
for (const a of
|
|
13942
|
+
for (const a of Uu)
|
|
13924
13943
|
n[a] !== void 0 && (l[a] = n[a]);
|
|
13925
13944
|
}
|
|
13926
13945
|
}
|
|
@@ -13955,21 +13974,21 @@ async function wf() {
|
|
|
13955
13974
|
}
|
|
13956
13975
|
return await ge.init(l, {
|
|
13957
13976
|
authInformation: t,
|
|
13958
|
-
onUpdate: (i) =>
|
|
13977
|
+
onUpdate: (i) => Eu(e, l.authMaxRefreshSeconds),
|
|
13959
13978
|
onUpdateError: fi,
|
|
13960
13979
|
onAuthError: fi
|
|
13961
13980
|
});
|
|
13962
13981
|
}
|
|
13963
|
-
async function
|
|
13982
|
+
async function gf(l, e) {
|
|
13964
13983
|
const t = {
|
|
13965
13984
|
valueId: e.value,
|
|
13966
13985
|
errorId: e.error,
|
|
13967
13986
|
error: ""
|
|
13968
13987
|
};
|
|
13969
13988
|
if (C(e.error)) {
|
|
13970
|
-
const i = await l.getResourceData(e.error, !0), n = pi(
|
|
13989
|
+
const i = await l.getResourceData(e.error, !0), n = pi(R(i.data));
|
|
13971
13990
|
if (typeof n != "string") {
|
|
13972
|
-
const r =
|
|
13991
|
+
const r = R(i.data).toString();
|
|
13973
13992
|
throw new Error(`Unexpected error structure: ${r.substring(0, Math.min(r.length, 100))}...`);
|
|
13974
13993
|
}
|
|
13975
13994
|
t.error = n;
|
|
@@ -13978,11 +13997,11 @@ async function mf(l, e) {
|
|
|
13978
13997
|
}
|
|
13979
13998
|
class z extends Error {
|
|
13980
13999
|
}
|
|
13981
|
-
const
|
|
14000
|
+
const xu = {
|
|
13982
14001
|
failOnError: !0,
|
|
13983
14002
|
onlyFinal: !1
|
|
13984
14003
|
};
|
|
13985
|
-
class
|
|
14004
|
+
class Wu {
|
|
13986
14005
|
constructor(e, t, i) {
|
|
13987
14006
|
this.tx = e, this.data = t, this.path = i;
|
|
13988
14007
|
}
|
|
@@ -14006,7 +14025,7 @@ class xu {
|
|
|
14006
14025
|
) : new z();
|
|
14007
14026
|
}
|
|
14008
14027
|
async get(e, t = {}) {
|
|
14009
|
-
const { expectedType: i, failOnError: n } = { ...
|
|
14028
|
+
const { expectedType: i, failOnError: n } = { ...xu, ...t }, r = [...this.path, e], c = this.getFieldData(e, i);
|
|
14010
14029
|
if (C(c.error) && (n || B(c.value)) && await this.tx.throwError(c.error, r), B(c.value)) throw new z();
|
|
14011
14030
|
return await this.tx.get(c.value, n, r);
|
|
14012
14031
|
}
|
|
@@ -14033,31 +14052,31 @@ class xu {
|
|
|
14033
14052
|
return JSON.parse(await this.getKValue(e));
|
|
14034
14053
|
}
|
|
14035
14054
|
}
|
|
14036
|
-
class
|
|
14055
|
+
class Su {
|
|
14037
14056
|
constructor(e) {
|
|
14038
14057
|
this.tx = e;
|
|
14039
14058
|
}
|
|
14040
14059
|
async get(e, t = !0, i = []) {
|
|
14041
|
-
const n = await this.tx.getResourceData(e, !0), r = new
|
|
14060
|
+
const n = await this.tx.getResourceData(e, !0), r = new Wu(this, n, [...i, we(e)]);
|
|
14042
14061
|
return t && await r.requireNoError(), r;
|
|
14043
14062
|
}
|
|
14044
14063
|
async throwError(e, t = []) {
|
|
14045
|
-
const i = await this.get(e), n = Buffer.from(
|
|
14064
|
+
const i = await this.get(e), n = Buffer.from(R(i.data.data)).toString();
|
|
14046
14065
|
throw new Error(`${t.join(" -> ")} = ${n}`);
|
|
14047
14066
|
}
|
|
14048
14067
|
}
|
|
14049
|
-
const
|
|
14068
|
+
const Cu = {
|
|
14050
14069
|
type: "linearBackoff",
|
|
14051
14070
|
jitter: 0,
|
|
14052
14071
|
maxAttempts: 100,
|
|
14053
14072
|
backoffStep: 10,
|
|
14054
14073
|
initialDelay: 10
|
|
14055
14074
|
};
|
|
14056
|
-
async function
|
|
14075
|
+
async function kf(l, e, t = Cu, i = "polling") {
|
|
14057
14076
|
let n = mi(t);
|
|
14058
14077
|
for (; ; ) {
|
|
14059
14078
|
try {
|
|
14060
|
-
return await l.withReadTx(i, async (r) => await e(new
|
|
14079
|
+
return await l.withReadTx(i, async (r) => await e(new Su(r)));
|
|
14061
14080
|
} catch (r) {
|
|
14062
14081
|
if (!(r instanceof z)) throw r;
|
|
14063
14082
|
}
|
|
@@ -14127,7 +14146,7 @@ async function On() {
|
|
|
14127
14146
|
}
|
|
14128
14147
|
};
|
|
14129
14148
|
}
|
|
14130
|
-
async function
|
|
14149
|
+
async function Du(l = {}) {
|
|
14131
14150
|
const { conf: e, auth: t } = await On();
|
|
14132
14151
|
return new vn({ ...e, ...l }, { auth: t });
|
|
14133
14152
|
}
|
|
@@ -14137,7 +14156,7 @@ async function Nn(l) {
|
|
|
14137
14156
|
throw new Error("test pl address configured with alternative root");
|
|
14138
14157
|
return await ge.init({ ...e, alternativeRoot: l }, t);
|
|
14139
14158
|
}
|
|
14140
|
-
async function
|
|
14159
|
+
async function vu(l) {
|
|
14141
14160
|
const e = `test_${Date.now()}_${bi()}`;
|
|
14142
14161
|
let t = S;
|
|
14143
14162
|
try {
|
|
@@ -14149,16 +14168,16 @@ async function Du(l) {
|
|
|
14149
14168
|
throw console.log(`ALTERNATIVE ROOT: ${e} (${we(t)})`), new Error(i.message, { cause: i });
|
|
14150
14169
|
}
|
|
14151
14170
|
}
|
|
14152
|
-
const
|
|
14171
|
+
const bf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
14153
14172
|
__proto__: null,
|
|
14154
14173
|
getTestClient: Nn,
|
|
14155
14174
|
getTestClientConf: On,
|
|
14156
14175
|
getTestConfig: Ji,
|
|
14157
|
-
getTestLLClient:
|
|
14158
|
-
withTempRoot:
|
|
14176
|
+
getTestLLClient: Du,
|
|
14177
|
+
withTempRoot: vu
|
|
14159
14178
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
14160
14179
|
export {
|
|
14161
|
-
|
|
14180
|
+
pf as AnonymousAuthInformation,
|
|
14162
14181
|
z as ContinuePolling,
|
|
14163
14182
|
ti as DEFAULT_AUTH_MAX_REFRESH,
|
|
14164
14183
|
ni as DEFAULT_MAX_CACHE_BYTES,
|
|
@@ -14172,69 +14191,69 @@ export {
|
|
|
14172
14191
|
Xn as DEFAULT_RO_TX_TIMEOUT,
|
|
14173
14192
|
Qn as DEFAULT_RW_TX_TIMEOUT,
|
|
14174
14193
|
ei as DEFAULT_TOKEN_TTL_SECONDS,
|
|
14175
|
-
|
|
14176
|
-
|
|
14194
|
+
Pu as DefaultFinalResourceDataPredicate,
|
|
14195
|
+
Cu as DefaultPollingRetryOptions,
|
|
14177
14196
|
Fi as DisconnectedError,
|
|
14178
14197
|
Pi as MaxLocalId,
|
|
14179
14198
|
Bn as MaxTxId,
|
|
14180
14199
|
S as NullResourceId,
|
|
14181
|
-
|
|
14200
|
+
hf as Pl,
|
|
14182
14201
|
ge as PlClient,
|
|
14183
14202
|
$i as PlError,
|
|
14184
14203
|
Un as PlErrorCodeNotFound,
|
|
14185
14204
|
In as PlTransaction,
|
|
14186
|
-
|
|
14187
|
-
|
|
14205
|
+
Wu as PollResourceAccessor,
|
|
14206
|
+
Su as PollTxAccessor,
|
|
14188
14207
|
Fn as RecoverablePlError,
|
|
14189
|
-
|
|
14208
|
+
bf as TestHelpers,
|
|
14190
14209
|
Si as TxCommitConflict,
|
|
14191
14210
|
En as UnauthenticatedError,
|
|
14192
14211
|
Gi as UnauthenticatedPlClient,
|
|
14193
14212
|
zc as UnrecoverablePlError,
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14213
|
+
wf as addRTypeToMetadata,
|
|
14214
|
+
lf as bigintToResourceId,
|
|
14215
|
+
of as checkLocalityOfResourceId,
|
|
14197
14216
|
cr as createGlobalResourceId,
|
|
14198
14217
|
Ni as createLocalResourceId,
|
|
14199
|
-
|
|
14218
|
+
mf as defaultPlClient,
|
|
14200
14219
|
Rn as ensureResourceIdNotNull,
|
|
14201
|
-
|
|
14220
|
+
yf as expirationFromAuthInformation,
|
|
14202
14221
|
sr as extractBasicResourceData,
|
|
14203
14222
|
_i as extractTxId,
|
|
14204
14223
|
xn as field,
|
|
14205
14224
|
zn as getField,
|
|
14206
14225
|
X as inferAuthRefreshTime,
|
|
14207
|
-
|
|
14226
|
+
Qu as isAnyResourceId,
|
|
14208
14227
|
Li as isConnectionProblem,
|
|
14209
|
-
|
|
14228
|
+
uf as isField,
|
|
14210
14229
|
Wi as isFieldRef,
|
|
14211
14230
|
x as isLocalResourceId,
|
|
14212
14231
|
Ui as isNotFoundError,
|
|
14213
14232
|
C as isNotNullResourceId,
|
|
14214
14233
|
B as isNullResourceId,
|
|
14215
|
-
|
|
14216
|
-
|
|
14234
|
+
iu as isResource,
|
|
14235
|
+
ff as isResourceId,
|
|
14217
14236
|
M as isResourceRef,
|
|
14218
14237
|
Hn as isRootResourceId,
|
|
14219
14238
|
Bi as isTimeoutOrCancelError,
|
|
14220
14239
|
Ai as isUnauthenticated,
|
|
14221
|
-
|
|
14240
|
+
rf as jsonToData,
|
|
14222
14241
|
ye as plAddressToConfig,
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14242
|
+
kf as poll,
|
|
14243
|
+
sf as resDataToJson,
|
|
14244
|
+
af as resourceIdFromString,
|
|
14226
14245
|
we as resourceIdToString,
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14246
|
+
ef as resourceType,
|
|
14247
|
+
tf as resourceTypeToString,
|
|
14248
|
+
nf as resourceTypesEqual,
|
|
14230
14249
|
Hc as rethrowMeaningfulError,
|
|
14231
|
-
|
|
14250
|
+
cf as stringifyWithResourceId,
|
|
14232
14251
|
Jc as throwPlNotFoundError,
|
|
14233
14252
|
A as toFieldId,
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14253
|
+
df as toGlobalFieldId,
|
|
14254
|
+
ru as toGlobalResourceId,
|
|
14255
|
+
T as toResourceId,
|
|
14256
|
+
Fu as tryGetFileConfig,
|
|
14257
|
+
gf as valErr
|
|
14239
14258
|
};
|
|
14240
14259
|
//# sourceMappingURL=index.mjs.map
|