@milaboratories/pl-client 2.9.3 → 2.10.1
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/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 +192 -179
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/core/error_resource.ts +10 -0
- package/src/core/transaction.ts +13 -0
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
|
}
|
|
@@ -12295,7 +12295,7 @@ function Yn(l) {
|
|
|
12295
12295
|
return Yc(l) && Jc("resource deleted"), {
|
|
12296
12296
|
id: l.id,
|
|
12297
12297
|
originalResourceId: l.originalResourceId,
|
|
12298
|
-
type:
|
|
12298
|
+
type: R(l.type),
|
|
12299
12299
|
data: l.data,
|
|
12300
12300
|
inputsLocked: l.inputsLocked,
|
|
12301
12301
|
outputsLocked: l.outputsLocked,
|
|
@@ -12325,7 +12325,7 @@ function Xc(l) {
|
|
|
12325
12325
|
function xi(l) {
|
|
12326
12326
|
var e;
|
|
12327
12327
|
return {
|
|
12328
|
-
name:
|
|
12328
|
+
name: R((e = l.id) == null ? void 0 : e.fieldName),
|
|
12329
12329
|
type: Qc(l.type),
|
|
12330
12330
|
status: eu(l.valueStatus),
|
|
12331
12331
|
value: l.value,
|
|
@@ -12441,13 +12441,17 @@ function G(l, e) {
|
|
|
12441
12441
|
kvGetBytes: l.kvGetBytes + e.kvGetBytes
|
|
12442
12442
|
};
|
|
12443
12443
|
}
|
|
12444
|
-
|
|
12444
|
+
const nu = {
|
|
12445
|
+
name: "json/resourceError",
|
|
12446
|
+
version: "1"
|
|
12447
|
+
};
|
|
12448
|
+
function uf(l) {
|
|
12445
12449
|
return l.hasOwnProperty("resourceId") && l.hasOwnProperty("fieldName");
|
|
12446
12450
|
}
|
|
12447
|
-
function
|
|
12451
|
+
function iu(l) {
|
|
12448
12452
|
return typeof l == "bigint" || l.hasOwnProperty("globalId") && l.hasOwnProperty("localId");
|
|
12449
12453
|
}
|
|
12450
|
-
function
|
|
12454
|
+
function ff(l) {
|
|
12451
12455
|
return typeof l == "bigint" && !x(l) && !B(l);
|
|
12452
12456
|
}
|
|
12453
12457
|
function Wi(l) {
|
|
@@ -12459,13 +12463,13 @@ function M(l) {
|
|
|
12459
12463
|
function A(l) {
|
|
12460
12464
|
return Wi(l) ? { resourceId: l.resourceId.localId, fieldName: l.fieldName } : l;
|
|
12461
12465
|
}
|
|
12462
|
-
async function
|
|
12466
|
+
async function df(l) {
|
|
12463
12467
|
return Wi(l) ? { resourceId: await l.resourceId.globalId, fieldName: l.fieldName } : l;
|
|
12464
12468
|
}
|
|
12465
|
-
function
|
|
12469
|
+
function T(l) {
|
|
12466
12470
|
return M(l) ? l.localId : l;
|
|
12467
12471
|
}
|
|
12468
|
-
async function
|
|
12472
|
+
async function ru(l) {
|
|
12469
12473
|
return M(l) ? await l.globalId : l;
|
|
12470
12474
|
}
|
|
12471
12475
|
function xn(l, e) {
|
|
@@ -12508,7 +12512,7 @@ const $ = class $ {
|
|
|
12508
12512
|
},
|
|
12509
12513
|
(a) => {
|
|
12510
12514
|
var o;
|
|
12511
|
-
return
|
|
12515
|
+
return R((o = a.txOpen.tx) == null ? void 0 : o.id);
|
|
12512
12516
|
}
|
|
12513
12517
|
), this.globalTxId.catch((a) => {
|
|
12514
12518
|
this.globalTxIdWasAwaited || console.warn(a);
|
|
@@ -12593,7 +12597,7 @@ const $ = class $ {
|
|
|
12593
12597
|
loadFields: t
|
|
12594
12598
|
}
|
|
12595
12599
|
},
|
|
12596
|
-
(i) => Yn(
|
|
12600
|
+
(i) => Yn(R(i.resourceGetSingleton.resource))
|
|
12597
12601
|
);
|
|
12598
12602
|
}
|
|
12599
12603
|
createResource(e, t, i) {
|
|
@@ -12650,10 +12654,13 @@ const $ = class $ {
|
|
|
12650
12654
|
(n) => n.resourceCreateValue.resourceId
|
|
12651
12655
|
);
|
|
12652
12656
|
}
|
|
12657
|
+
createError(e) {
|
|
12658
|
+
return this.createValue(nu, JSON.stringify({ message: e }));
|
|
12659
|
+
}
|
|
12653
12660
|
setResourceName(e, t) {
|
|
12654
12661
|
this.sendVoidAsync({
|
|
12655
12662
|
oneofKind: "resourceNameSet",
|
|
12656
|
-
resourceNameSet: { resourceId:
|
|
12663
|
+
resourceNameSet: { resourceId: T(t), name: e }
|
|
12657
12664
|
});
|
|
12658
12665
|
}
|
|
12659
12666
|
deleteResourceName(e) {
|
|
@@ -12693,9 +12700,9 @@ const $ = class $ {
|
|
|
12693
12700
|
const n = await this.sendSingleAndParse(
|
|
12694
12701
|
{
|
|
12695
12702
|
oneofKind: "resourceGet",
|
|
12696
|
-
resourceGet: { resourceId:
|
|
12703
|
+
resourceGet: { resourceId: T(e), loadFields: t }
|
|
12697
12704
|
},
|
|
12698
|
-
(o) => Yn(
|
|
12705
|
+
(o) => Yn(R(o.resourceGet.resource))
|
|
12699
12706
|
);
|
|
12700
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)) {
|
|
12701
12708
|
jn(n);
|
|
@@ -12733,7 +12740,7 @@ const $ = class $ {
|
|
|
12733
12740
|
lockInputs(e) {
|
|
12734
12741
|
this.stat.inputsLocked++, this.sendVoidAsync({
|
|
12735
12742
|
oneofKind: "resourceLockInputs",
|
|
12736
|
-
resourceLockInputs: { resourceId:
|
|
12743
|
+
resourceLockInputs: { resourceId: T(e) }
|
|
12737
12744
|
});
|
|
12738
12745
|
}
|
|
12739
12746
|
/**
|
|
@@ -12743,12 +12750,18 @@ const $ = class $ {
|
|
|
12743
12750
|
lockOutputs(e) {
|
|
12744
12751
|
this.stat.outputsLocked++, this.sendVoidAsync({
|
|
12745
12752
|
oneofKind: "resourceLockOutputs",
|
|
12746
|
-
resourceLockOutputs: { resourceId:
|
|
12753
|
+
resourceLockOutputs: { resourceId: T(e) }
|
|
12747
12754
|
});
|
|
12748
12755
|
}
|
|
12749
12756
|
lock(e) {
|
|
12750
12757
|
this.lockInputs(e), this.lockOutputs(e);
|
|
12751
12758
|
}
|
|
12759
|
+
setResourceError(e, t) {
|
|
12760
|
+
this.sendVoidAsync({
|
|
12761
|
+
oneofKind: "resourceSetError",
|
|
12762
|
+
resourceSetError: { resourceId: T(e), errorResourceId: T(t) }
|
|
12763
|
+
});
|
|
12764
|
+
}
|
|
12752
12765
|
//
|
|
12753
12766
|
// Fields
|
|
12754
12767
|
//
|
|
@@ -12768,12 +12781,12 @@ const $ = class $ {
|
|
|
12768
12781
|
);
|
|
12769
12782
|
}
|
|
12770
12783
|
setField(e, t) {
|
|
12771
|
-
this.stat.fieldsSet++,
|
|
12784
|
+
this.stat.fieldsSet++, iu(t) ? this.sendVoidAsync({
|
|
12772
12785
|
oneofKind: "fieldSet",
|
|
12773
12786
|
fieldSet: {
|
|
12774
12787
|
field: A(e),
|
|
12775
12788
|
value: {
|
|
12776
|
-
resourceId:
|
|
12789
|
+
resourceId: T(t),
|
|
12777
12790
|
fieldName: ""
|
|
12778
12791
|
// default value, read as undefined
|
|
12779
12792
|
}
|
|
@@ -12789,13 +12802,13 @@ const $ = class $ {
|
|
|
12789
12802
|
setFieldError(e, t) {
|
|
12790
12803
|
this.stat.fieldsSet++, this.sendVoidAsync({
|
|
12791
12804
|
oneofKind: "fieldSetError",
|
|
12792
|
-
fieldSetError: { field: A(e), errResourceId:
|
|
12805
|
+
fieldSetError: { field: A(e), errResourceId: T(t) }
|
|
12793
12806
|
});
|
|
12794
12807
|
}
|
|
12795
12808
|
async getField(e) {
|
|
12796
12809
|
return this.stat.fieldsGet++, await this.sendSingleAndParse(
|
|
12797
12810
|
{ oneofKind: "fieldGet", fieldGet: { field: A(e) } },
|
|
12798
|
-
(t) => xi(
|
|
12811
|
+
(t) => xi(R(t.fieldGet.field))
|
|
12799
12812
|
);
|
|
12800
12813
|
}
|
|
12801
12814
|
async getFieldIfExists(e) {
|
|
@@ -12814,7 +12827,7 @@ const $ = class $ {
|
|
|
12814
12827
|
const t = await this.sendMultiAndParse(
|
|
12815
12828
|
{
|
|
12816
12829
|
oneofKind: "resourceKeyValueList",
|
|
12817
|
-
resourceKeyValueList: { resourceId:
|
|
12830
|
+
resourceKeyValueList: { resourceId: T(e), startFrom: "", limit: 0 }
|
|
12818
12831
|
},
|
|
12819
12832
|
(i) => i.map((n) => n.resourceKeyValueList.record)
|
|
12820
12833
|
);
|
|
@@ -12838,7 +12851,7 @@ const $ = class $ {
|
|
|
12838
12851
|
this.stat.kvSetRequests++, this.stat.kvSetBytes++, this.sendVoidAsync({
|
|
12839
12852
|
oneofKind: "resourceKeyValueSet",
|
|
12840
12853
|
resourceKeyValueSet: {
|
|
12841
|
-
resourceId:
|
|
12854
|
+
resourceId: T(e),
|
|
12842
12855
|
key: t,
|
|
12843
12856
|
value: Gc(i)
|
|
12844
12857
|
}
|
|
@@ -12848,7 +12861,7 @@ const $ = class $ {
|
|
|
12848
12861
|
this.sendVoidAsync({
|
|
12849
12862
|
oneofKind: "resourceKeyValueDelete",
|
|
12850
12863
|
resourceKeyValueDelete: {
|
|
12851
|
-
resourceId:
|
|
12864
|
+
resourceId: T(e),
|
|
12852
12865
|
key: t
|
|
12853
12866
|
}
|
|
12854
12867
|
});
|
|
@@ -12857,7 +12870,7 @@ const $ = class $ {
|
|
|
12857
12870
|
const i = await this.sendSingleAndParse(
|
|
12858
12871
|
{
|
|
12859
12872
|
oneofKind: "resourceKeyValueGet",
|
|
12860
|
-
resourceKeyValueGet: { resourceId:
|
|
12873
|
+
resourceKeyValueGet: { resourceId: T(e), key: t }
|
|
12861
12874
|
},
|
|
12862
12875
|
(n) => n.resourceKeyValueGet.value
|
|
12863
12876
|
);
|
|
@@ -12873,7 +12886,7 @@ const $ = class $ {
|
|
|
12873
12886
|
const i = await this.sendSingleAndParse(
|
|
12874
12887
|
{
|
|
12875
12888
|
oneofKind: "resourceKeyValueGetIfExists",
|
|
12876
|
-
resourceKeyValueGetIfExists: { resourceId:
|
|
12889
|
+
resourceKeyValueGetIfExists: { resourceId: T(e), key: t }
|
|
12877
12890
|
},
|
|
12878
12891
|
(n) => n.resourceKeyValueGetIfExists.exists ? n.resourceKeyValueGetIfExists.value : void 0
|
|
12879
12892
|
);
|
|
@@ -12930,26 +12943,26 @@ const $ = class $ {
|
|
|
12930
12943
|
};
|
|
12931
12944
|
y($, "localTxIdCounter", 0);
|
|
12932
12945
|
let In = $;
|
|
12933
|
-
function
|
|
12946
|
+
function _(l, e) {
|
|
12934
12947
|
return { name: l, version: e };
|
|
12935
12948
|
}
|
|
12936
|
-
const Pn =
|
|
12937
|
-
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) {
|
|
12938
12951
|
return l.createValue(Ki, Buffer.from(JSON.stringify(null)));
|
|
12939
12952
|
}
|
|
12940
|
-
function
|
|
12953
|
+
function cu(l, e) {
|
|
12941
12954
|
return l.createValue(Di, Buffer.from(JSON.stringify(e)));
|
|
12942
12955
|
}
|
|
12943
|
-
function
|
|
12956
|
+
function uu(l, e) {
|
|
12944
12957
|
return l.createValue(qi, Buffer.from(JSON.stringify(e)));
|
|
12945
12958
|
}
|
|
12946
|
-
function
|
|
12959
|
+
function fu(l, e) {
|
|
12947
12960
|
return l.createValue(Ci, Buffer.from(JSON.stringify(e)));
|
|
12948
12961
|
}
|
|
12949
|
-
function
|
|
12962
|
+
function du(l, e) {
|
|
12950
12963
|
return l.createValue(Oi, Buffer.from(JSON.stringify(e)));
|
|
12951
12964
|
}
|
|
12952
|
-
function
|
|
12965
|
+
function hu(l, e) {
|
|
12953
12966
|
return l.createValue(vi, Buffer.from(JSON.stringify(e)));
|
|
12954
12967
|
}
|
|
12955
12968
|
function Cn(l, e) {
|
|
@@ -12958,30 +12971,30 @@ function Cn(l, e) {
|
|
|
12958
12971
|
function ji(l, e) {
|
|
12959
12972
|
return e === void 0 ? Object.entries(l) : e.map((t) => Cn(t, l[t]));
|
|
12960
12973
|
}
|
|
12961
|
-
function
|
|
12974
|
+
function pu(l, e, t, i) {
|
|
12962
12975
|
const n = i ?? (t ? Wn : Sn), r = t ? l.createEphemeral(n) : l.createStruct(n);
|
|
12963
12976
|
for (const [c, a] of Array.isArray(e) ? e : ji(e))
|
|
12964
12977
|
l.createField(xn(r, c), "Input", a);
|
|
12965
12978
|
return l.lock(r), r;
|
|
12966
12979
|
}
|
|
12967
|
-
function
|
|
12980
|
+
function yu(l, e, t, i, n = "") {
|
|
12968
12981
|
return Object.fromEntries(
|
|
12969
12982
|
t.map((r) => Cn(r, l.getFutureFieldValue(e, `${n}${r}`, i)))
|
|
12970
12983
|
);
|
|
12971
12984
|
}
|
|
12972
12985
|
const Vi = Sn, Mi = Wn, me = "ref";
|
|
12973
|
-
function
|
|
12986
|
+
function wu(l, e) {
|
|
12974
12987
|
const t = l.createStruct(Vi), i = xn(t, me);
|
|
12975
12988
|
return l.createField(i, "Input", e), l.lock(t), t;
|
|
12976
12989
|
}
|
|
12977
|
-
function
|
|
12990
|
+
function mu(l, e) {
|
|
12978
12991
|
const t = l.createEphemeral(Mi), i = xn(t, me);
|
|
12979
12992
|
return l.createField(i, "Input", e), l.lock(t), t;
|
|
12980
12993
|
}
|
|
12981
|
-
function
|
|
12994
|
+
function gu(l, e) {
|
|
12982
12995
|
return l.getFutureFieldValue(e, me, "Input");
|
|
12983
12996
|
}
|
|
12984
|
-
const
|
|
12997
|
+
const hf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
12985
12998
|
__proto__: null,
|
|
12986
12999
|
ClientRoot: Pn,
|
|
12987
13000
|
EphHolder: Mi,
|
|
@@ -12994,25 +13007,25 @@ const df = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
12994
13007
|
JsonNumber: qi,
|
|
12995
13008
|
JsonObject: vi,
|
|
12996
13009
|
JsonString: Ci,
|
|
12997
|
-
RNull:
|
|
13010
|
+
RNull: au,
|
|
12998
13011
|
StdMap: Sn,
|
|
12999
|
-
StructTestResource:
|
|
13000
|
-
ValueTestResource:
|
|
13001
|
-
createPlArray:
|
|
13002
|
-
createPlBool:
|
|
13003
|
-
createPlMap:
|
|
13004
|
-
createPlNull:
|
|
13005
|
-
createPlNumber:
|
|
13006
|
-
createPlObject:
|
|
13007
|
-
createPlString:
|
|
13008
|
-
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,
|
|
13009
13022
|
plEntries: ji,
|
|
13010
13023
|
plEntry: Cn,
|
|
13011
|
-
unwrapHolder:
|
|
13012
|
-
wrapInEphHolder:
|
|
13013
|
-
wrapInHolder:
|
|
13024
|
+
unwrapHolder: gu,
|
|
13025
|
+
wrapInEphHolder: mu,
|
|
13026
|
+
wrapInHolder: wu
|
|
13014
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;
|
|
13015
|
-
function
|
|
13028
|
+
function P(l) {
|
|
13016
13029
|
if (!l) return;
|
|
13017
13030
|
const e = Number(l);
|
|
13018
13031
|
if (Number.isNaN(e)) throw new Error(`Can't parse number: ${l}`);
|
|
@@ -13049,29 +13062,29 @@ function ye(l, e = {}) {
|
|
|
13049
13062
|
// this also includes port
|
|
13050
13063
|
alternativeRoot: t.searchParams.get("alternative-root") ?? void 0,
|
|
13051
13064
|
ssl: t.protocol === "https:" || t.protocol === "tls:",
|
|
13052
|
-
defaultRequestTimeout:
|
|
13053
|
-
defaultROTransactionTimeout:
|
|
13054
|
-
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,
|
|
13055
13068
|
authTTLSeconds: ei,
|
|
13056
13069
|
authMaxRefreshSeconds: ti,
|
|
13057
13070
|
grpcProxy: t.searchParams.get("grpc-proxy") ?? void 0,
|
|
13058
13071
|
httpProxy: t.searchParams.get("http-proxy") ?? void 0,
|
|
13059
13072
|
user: t.username === "" ? void 0 : t.username,
|
|
13060
13073
|
password: t.password === "" ? void 0 : t.password,
|
|
13061
|
-
txDelay:
|
|
13074
|
+
txDelay: P(t.searchParams.get("tx-delay")) ?? 0,
|
|
13062
13075
|
forceSync: !!t.searchParams.get("force-sync"),
|
|
13063
|
-
maxCacheBytes:
|
|
13076
|
+
maxCacheBytes: P(t.searchParams.get("max-cache-bytes")) ?? ni,
|
|
13064
13077
|
retryBackoffAlgorithm: t.searchParams.get("retry-backoff-algorithm") ?? ii,
|
|
13065
|
-
retryMaxAttempts:
|
|
13066
|
-
retryInitialDelay:
|
|
13067
|
-
retryExponentialBackoffMultiplier:
|
|
13068
|
-
retryLinearBackoffStep:
|
|
13069
|
-
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,
|
|
13070
13083
|
...e
|
|
13071
13084
|
};
|
|
13072
13085
|
}
|
|
13073
|
-
const
|
|
13074
|
-
class
|
|
13086
|
+
const pf = {};
|
|
13087
|
+
class ku {
|
|
13075
13088
|
constructor(e) {
|
|
13076
13089
|
y(this, "typeName", gn.typeName);
|
|
13077
13090
|
y(this, "methods", gn.methods);
|
|
@@ -13282,10 +13295,10 @@ class gu {
|
|
|
13282
13295
|
return g("unary", this._transport, i, n, e);
|
|
13283
13296
|
}
|
|
13284
13297
|
}
|
|
13285
|
-
function
|
|
13298
|
+
function bu(l, e, t, i) {
|
|
13286
13299
|
return { kind: l, expectMultiResponse: e, resolve: t, reject: i };
|
|
13287
13300
|
}
|
|
13288
|
-
function
|
|
13301
|
+
function Tu(l) {
|
|
13289
13302
|
return l.code === Un;
|
|
13290
13303
|
}
|
|
13291
13304
|
class J extends Error {
|
|
@@ -13293,7 +13306,7 @@ class J extends Error {
|
|
|
13293
13306
|
super("Rethrow error, you should never see this one."), this.rethrowLambda = e;
|
|
13294
13307
|
}
|
|
13295
13308
|
}
|
|
13296
|
-
class
|
|
13309
|
+
class Ru {
|
|
13297
13310
|
constructor(e) {
|
|
13298
13311
|
/** Bidirectional channel through which transaction communicates with the server */
|
|
13299
13312
|
y(this, "stream");
|
|
@@ -13347,7 +13360,7 @@ class Tu {
|
|
|
13347
13360
|
}
|
|
13348
13361
|
if (r.error !== void 0) {
|
|
13349
13362
|
const c = r.error;
|
|
13350
|
-
if (
|
|
13363
|
+
if (Tu(c)) {
|
|
13351
13364
|
if (t.reject(
|
|
13352
13365
|
new J(() => {
|
|
13353
13366
|
throw new Fn(c);
|
|
@@ -13432,7 +13445,7 @@ class Tu {
|
|
|
13432
13445
|
if (this.closed) return Promise.reject(new Error("Transaction already closed"));
|
|
13433
13446
|
const i = new Promise((n, r) => {
|
|
13434
13447
|
this.responseHandlerQueue.push(
|
|
13435
|
-
|
|
13448
|
+
bu(e.oneofKind, t, n, r)
|
|
13436
13449
|
);
|
|
13437
13450
|
});
|
|
13438
13451
|
await this.stream.requests.send({
|
|
@@ -13462,7 +13475,7 @@ function X(l, e) {
|
|
|
13462
13475
|
i + e
|
|
13463
13476
|
) * 1e3;
|
|
13464
13477
|
}
|
|
13465
|
-
function
|
|
13478
|
+
function yf(l) {
|
|
13466
13479
|
return l.jwtToken === void 0 ? void 0 : Dn(l.jwtToken).exp * 1e3;
|
|
13467
13480
|
}
|
|
13468
13481
|
class vn {
|
|
@@ -13511,7 +13524,7 @@ class vn {
|
|
|
13511
13524
|
};
|
|
13512
13525
|
this.conf.grpcProxy ? process.env.grpc_proxy = this.conf.grpcProxy : delete process.env.grpc_proxy;
|
|
13513
13526
|
const n = this._grpcTransport;
|
|
13514
|
-
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();
|
|
13515
13528
|
}
|
|
13516
13529
|
get grpcTransport() {
|
|
13517
13530
|
return this._grpcTransport;
|
|
@@ -13581,7 +13594,7 @@ class vn {
|
|
|
13581
13594
|
});
|
|
13582
13595
|
}
|
|
13583
13596
|
createTx(e, t = {}) {
|
|
13584
|
-
return new
|
|
13597
|
+
return new Ru((i) => {
|
|
13585
13598
|
let n = i;
|
|
13586
13599
|
return t.abortSignal && (n = AbortSignal.any([n, t.abortSignal])), this.grpcPl.tx({
|
|
13587
13600
|
abort: n,
|
|
@@ -13597,14 +13610,14 @@ class vn {
|
|
|
13597
13610
|
function de(l) {
|
|
13598
13611
|
return l.resourceReady || C(l.originalResourceId) || C(l.error);
|
|
13599
13612
|
}
|
|
13600
|
-
function
|
|
13613
|
+
function Iu(l) {
|
|
13601
13614
|
if (!de(l) || !l.outputsLocked) return !1;
|
|
13602
13615
|
if (l.fields === void 0) return !0;
|
|
13603
13616
|
for (const e of l.fields)
|
|
13604
13617
|
if (B(e.error) && (B(e.value) || !e.valueIsFinal)) return !1;
|
|
13605
13618
|
return !0;
|
|
13606
13619
|
}
|
|
13607
|
-
const ci = /* @__PURE__ */ new Set(),
|
|
13620
|
+
const ci = /* @__PURE__ */ new Set(), Pu = (l) => {
|
|
13608
13621
|
switch (l.type.name) {
|
|
13609
13622
|
case "StreamManager": {
|
|
13610
13623
|
if (!de(l)) return !1;
|
|
@@ -13650,7 +13663,7 @@ const ci = /* @__PURE__ */ new Set(), Iu = (l) => {
|
|
|
13650
13663
|
default:
|
|
13651
13664
|
if (l.type.name.startsWith("Blob/")) return !0;
|
|
13652
13665
|
if (l.type.name.startsWith("BlobUpload/") || l.type.name.startsWith("BlobIndex/"))
|
|
13653
|
-
return
|
|
13666
|
+
return Iu(l);
|
|
13654
13667
|
if (l.type.name.startsWith("PColumnData/"))
|
|
13655
13668
|
return de(l);
|
|
13656
13669
|
ci.has(l.type.name) || (console.log("UNKNOWN RESOURCE TYPE: " + l.type.name), ci.add(l.type.name));
|
|
@@ -13658,7 +13671,7 @@ const ci = /* @__PURE__ */ new Set(), Iu = (l) => {
|
|
|
13658
13671
|
return !1;
|
|
13659
13672
|
}, kn = {
|
|
13660
13673
|
sync: !1
|
|
13661
|
-
},
|
|
13674
|
+
}, Nu = "AnonymousRoot";
|
|
13662
13675
|
function ui(l) {
|
|
13663
13676
|
return `alternative_root_${l}`;
|
|
13664
13677
|
}
|
|
@@ -13689,7 +13702,7 @@ class ge {
|
|
|
13689
13702
|
y(this, "resourceDataCache");
|
|
13690
13703
|
this.buildLLPlClient = (r) => new vn(e, { auth: t, ...i, shouldUseGzip: r }), this._ll = this.buildLLPlClient(!1);
|
|
13691
13704
|
const n = this._ll.conf;
|
|
13692
|
-
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({
|
|
13693
13706
|
maxSize: n.maxCacheBytes,
|
|
13694
13707
|
sizeCalculation: (r) => {
|
|
13695
13708
|
var c;
|
|
@@ -13764,11 +13777,11 @@ class ge {
|
|
|
13764
13777
|
/** Currently implements custom logic to emulate future behaviour with single root. */
|
|
13765
13778
|
async init() {
|
|
13766
13779
|
if (this.initialized) throw new Error("Already initialized");
|
|
13767
|
-
const e = this._ll.authUser, t = e === null ?
|
|
13780
|
+
const e = this._ll.authUser, t = e === null ? Nu : ki("sha256").update(e).digest("hex");
|
|
13768
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) => {
|
|
13769
13782
|
let n;
|
|
13770
13783
|
if (await i.checkResourceNameExists(t) ? n = await i.getResourceByName(t) : (n = i.createRoot(Pn), i.setResourceName(t, n)), this.conf.alternativeRoot === void 0)
|
|
13771
|
-
return await i.commit(), await
|
|
13784
|
+
return await i.commit(), await ru(n);
|
|
13772
13785
|
{
|
|
13773
13786
|
const r = {
|
|
13774
13787
|
resourceId: n,
|
|
@@ -13841,7 +13854,7 @@ class ge {
|
|
|
13841
13854
|
return await n.init(), n;
|
|
13842
13855
|
}
|
|
13843
13856
|
}
|
|
13844
|
-
function
|
|
13857
|
+
function wf(l, e) {
|
|
13845
13858
|
return e = e ?? {}, e.meta = e.meta ?? {}, e.meta.resourceType = `${l.name}:${l.version}`, e;
|
|
13846
13859
|
}
|
|
13847
13860
|
class Gi {
|
|
@@ -13867,7 +13880,7 @@ class Gi {
|
|
|
13867
13880
|
authorization: "Basic " + Buffer.from(e + ":" + t).toString("base64")
|
|
13868
13881
|
}
|
|
13869
13882
|
}
|
|
13870
|
-
).response, n =
|
|
13883
|
+
).response, n = R(i.token);
|
|
13871
13884
|
if (n === "") throw new Error("empty token");
|
|
13872
13885
|
return { jwtToken: n };
|
|
13873
13886
|
} catch (i) {
|
|
@@ -13875,12 +13888,12 @@ class Gi {
|
|
|
13875
13888
|
}
|
|
13876
13889
|
}
|
|
13877
13890
|
}
|
|
13878
|
-
const
|
|
13879
|
-
Nu,
|
|
13880
|
-
Lu,
|
|
13891
|
+
const _u = "pl.json", Lu = Ln.join(Ti.homedir(), ".pl.json"), Au = "pl.yaml", Bu = Ln.join(Ti.homedir(), ".pl.yaml"), $u = [
|
|
13881
13892
|
_u,
|
|
13882
|
-
Au
|
|
13883
|
-
|
|
13893
|
+
Au,
|
|
13894
|
+
Lu,
|
|
13895
|
+
Bu
|
|
13896
|
+
], Y = ".pl_auth.json", Uu = [
|
|
13884
13897
|
"grpcProxy",
|
|
13885
13898
|
"httpProxy",
|
|
13886
13899
|
"user",
|
|
@@ -13892,14 +13905,14 @@ const Nu = "pl.json", _u = Ln.join(Ti.homedir(), ".pl.json"), Lu = "pl.yaml", Au
|
|
|
13892
13905
|
"authTTLSeconds",
|
|
13893
13906
|
"authMaxRefreshSeconds"
|
|
13894
13907
|
];
|
|
13895
|
-
function
|
|
13896
|
-
for (const l of
|
|
13908
|
+
function Fu() {
|
|
13909
|
+
for (const l of $u)
|
|
13897
13910
|
if (E.existsSync(l)) {
|
|
13898
13911
|
const e = E.readFileSync(l, { encoding: "utf-8" });
|
|
13899
13912
|
return l.endsWith("json") ? [JSON.parse(e), l] : [rr.parse(e), l];
|
|
13900
13913
|
}
|
|
13901
13914
|
}
|
|
13902
|
-
function
|
|
13915
|
+
function Eu(l, e) {
|
|
13903
13916
|
return (t) => {
|
|
13904
13917
|
E.writeFileSync(
|
|
13905
13918
|
Y,
|
|
@@ -13917,16 +13930,16 @@ function Fu(l, e) {
|
|
|
13917
13930
|
const fi = () => {
|
|
13918
13931
|
E.rmSync(Y);
|
|
13919
13932
|
};
|
|
13920
|
-
async function
|
|
13933
|
+
async function mf() {
|
|
13921
13934
|
let l;
|
|
13922
13935
|
if (process.env.PL_ADDRESS !== void 0)
|
|
13923
13936
|
l = ye(process.env.PL_ADDRESS);
|
|
13924
13937
|
else {
|
|
13925
|
-
const i =
|
|
13938
|
+
const i = Fu();
|
|
13926
13939
|
if (i !== void 0) {
|
|
13927
|
-
const [n, r] = i, c =
|
|
13940
|
+
const [n, r] = i, c = R(n.address, `no pl address in file: ${r}`);
|
|
13928
13941
|
l = ye(c);
|
|
13929
|
-
for (const a of
|
|
13942
|
+
for (const a of Uu)
|
|
13930
13943
|
n[a] !== void 0 && (l[a] = n[a]);
|
|
13931
13944
|
}
|
|
13932
13945
|
}
|
|
@@ -13961,21 +13974,21 @@ async function wf() {
|
|
|
13961
13974
|
}
|
|
13962
13975
|
return await ge.init(l, {
|
|
13963
13976
|
authInformation: t,
|
|
13964
|
-
onUpdate: (i) =>
|
|
13977
|
+
onUpdate: (i) => Eu(e, l.authMaxRefreshSeconds),
|
|
13965
13978
|
onUpdateError: fi,
|
|
13966
13979
|
onAuthError: fi
|
|
13967
13980
|
});
|
|
13968
13981
|
}
|
|
13969
|
-
async function
|
|
13982
|
+
async function gf(l, e) {
|
|
13970
13983
|
const t = {
|
|
13971
13984
|
valueId: e.value,
|
|
13972
13985
|
errorId: e.error,
|
|
13973
13986
|
error: ""
|
|
13974
13987
|
};
|
|
13975
13988
|
if (C(e.error)) {
|
|
13976
|
-
const i = await l.getResourceData(e.error, !0), n = pi(
|
|
13989
|
+
const i = await l.getResourceData(e.error, !0), n = pi(R(i.data));
|
|
13977
13990
|
if (typeof n != "string") {
|
|
13978
|
-
const r =
|
|
13991
|
+
const r = R(i.data).toString();
|
|
13979
13992
|
throw new Error(`Unexpected error structure: ${r.substring(0, Math.min(r.length, 100))}...`);
|
|
13980
13993
|
}
|
|
13981
13994
|
t.error = n;
|
|
@@ -13984,11 +13997,11 @@ async function mf(l, e) {
|
|
|
13984
13997
|
}
|
|
13985
13998
|
class z extends Error {
|
|
13986
13999
|
}
|
|
13987
|
-
const
|
|
14000
|
+
const xu = {
|
|
13988
14001
|
failOnError: !0,
|
|
13989
14002
|
onlyFinal: !1
|
|
13990
14003
|
};
|
|
13991
|
-
class
|
|
14004
|
+
class Wu {
|
|
13992
14005
|
constructor(e, t, i) {
|
|
13993
14006
|
this.tx = e, this.data = t, this.path = i;
|
|
13994
14007
|
}
|
|
@@ -14012,7 +14025,7 @@ class xu {
|
|
|
14012
14025
|
) : new z();
|
|
14013
14026
|
}
|
|
14014
14027
|
async get(e, t = {}) {
|
|
14015
|
-
const { expectedType: i, failOnError: n } = { ...
|
|
14028
|
+
const { expectedType: i, failOnError: n } = { ...xu, ...t }, r = [...this.path, e], c = this.getFieldData(e, i);
|
|
14016
14029
|
if (C(c.error) && (n || B(c.value)) && await this.tx.throwError(c.error, r), B(c.value)) throw new z();
|
|
14017
14030
|
return await this.tx.get(c.value, n, r);
|
|
14018
14031
|
}
|
|
@@ -14039,31 +14052,31 @@ class xu {
|
|
|
14039
14052
|
return JSON.parse(await this.getKValue(e));
|
|
14040
14053
|
}
|
|
14041
14054
|
}
|
|
14042
|
-
class
|
|
14055
|
+
class Su {
|
|
14043
14056
|
constructor(e) {
|
|
14044
14057
|
this.tx = e;
|
|
14045
14058
|
}
|
|
14046
14059
|
async get(e, t = !0, i = []) {
|
|
14047
|
-
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)]);
|
|
14048
14061
|
return t && await r.requireNoError(), r;
|
|
14049
14062
|
}
|
|
14050
14063
|
async throwError(e, t = []) {
|
|
14051
|
-
const i = await this.get(e), n = Buffer.from(
|
|
14064
|
+
const i = await this.get(e), n = Buffer.from(R(i.data.data)).toString();
|
|
14052
14065
|
throw new Error(`${t.join(" -> ")} = ${n}`);
|
|
14053
14066
|
}
|
|
14054
14067
|
}
|
|
14055
|
-
const
|
|
14068
|
+
const Cu = {
|
|
14056
14069
|
type: "linearBackoff",
|
|
14057
14070
|
jitter: 0,
|
|
14058
14071
|
maxAttempts: 100,
|
|
14059
14072
|
backoffStep: 10,
|
|
14060
14073
|
initialDelay: 10
|
|
14061
14074
|
};
|
|
14062
|
-
async function
|
|
14075
|
+
async function kf(l, e, t = Cu, i = "polling") {
|
|
14063
14076
|
let n = mi(t);
|
|
14064
14077
|
for (; ; ) {
|
|
14065
14078
|
try {
|
|
14066
|
-
return await l.withReadTx(i, async (r) => await e(new
|
|
14079
|
+
return await l.withReadTx(i, async (r) => await e(new Su(r)));
|
|
14067
14080
|
} catch (r) {
|
|
14068
14081
|
if (!(r instanceof z)) throw r;
|
|
14069
14082
|
}
|
|
@@ -14133,7 +14146,7 @@ async function On() {
|
|
|
14133
14146
|
}
|
|
14134
14147
|
};
|
|
14135
14148
|
}
|
|
14136
|
-
async function
|
|
14149
|
+
async function Du(l = {}) {
|
|
14137
14150
|
const { conf: e, auth: t } = await On();
|
|
14138
14151
|
return new vn({ ...e, ...l }, { auth: t });
|
|
14139
14152
|
}
|
|
@@ -14143,7 +14156,7 @@ async function Nn(l) {
|
|
|
14143
14156
|
throw new Error("test pl address configured with alternative root");
|
|
14144
14157
|
return await ge.init({ ...e, alternativeRoot: l }, t);
|
|
14145
14158
|
}
|
|
14146
|
-
async function
|
|
14159
|
+
async function vu(l) {
|
|
14147
14160
|
const e = `test_${Date.now()}_${bi()}`;
|
|
14148
14161
|
let t = S;
|
|
14149
14162
|
try {
|
|
@@ -14155,16 +14168,16 @@ async function Du(l) {
|
|
|
14155
14168
|
throw console.log(`ALTERNATIVE ROOT: ${e} (${we(t)})`), new Error(i.message, { cause: i });
|
|
14156
14169
|
}
|
|
14157
14170
|
}
|
|
14158
|
-
const
|
|
14171
|
+
const bf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
14159
14172
|
__proto__: null,
|
|
14160
14173
|
getTestClient: Nn,
|
|
14161
14174
|
getTestClientConf: On,
|
|
14162
14175
|
getTestConfig: Ji,
|
|
14163
|
-
getTestLLClient:
|
|
14164
|
-
withTempRoot:
|
|
14176
|
+
getTestLLClient: Du,
|
|
14177
|
+
withTempRoot: vu
|
|
14165
14178
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
14166
14179
|
export {
|
|
14167
|
-
|
|
14180
|
+
pf as AnonymousAuthInformation,
|
|
14168
14181
|
z as ContinuePolling,
|
|
14169
14182
|
ti as DEFAULT_AUTH_MAX_REFRESH,
|
|
14170
14183
|
ni as DEFAULT_MAX_CACHE_BYTES,
|
|
@@ -14178,69 +14191,69 @@ export {
|
|
|
14178
14191
|
Xn as DEFAULT_RO_TX_TIMEOUT,
|
|
14179
14192
|
Qn as DEFAULT_RW_TX_TIMEOUT,
|
|
14180
14193
|
ei as DEFAULT_TOKEN_TTL_SECONDS,
|
|
14181
|
-
|
|
14182
|
-
|
|
14194
|
+
Pu as DefaultFinalResourceDataPredicate,
|
|
14195
|
+
Cu as DefaultPollingRetryOptions,
|
|
14183
14196
|
Fi as DisconnectedError,
|
|
14184
14197
|
Pi as MaxLocalId,
|
|
14185
14198
|
Bn as MaxTxId,
|
|
14186
14199
|
S as NullResourceId,
|
|
14187
|
-
|
|
14200
|
+
hf as Pl,
|
|
14188
14201
|
ge as PlClient,
|
|
14189
14202
|
$i as PlError,
|
|
14190
14203
|
Un as PlErrorCodeNotFound,
|
|
14191
14204
|
In as PlTransaction,
|
|
14192
|
-
|
|
14193
|
-
|
|
14205
|
+
Wu as PollResourceAccessor,
|
|
14206
|
+
Su as PollTxAccessor,
|
|
14194
14207
|
Fn as RecoverablePlError,
|
|
14195
|
-
|
|
14208
|
+
bf as TestHelpers,
|
|
14196
14209
|
Si as TxCommitConflict,
|
|
14197
14210
|
En as UnauthenticatedError,
|
|
14198
14211
|
Gi as UnauthenticatedPlClient,
|
|
14199
14212
|
zc as UnrecoverablePlError,
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14213
|
+
wf as addRTypeToMetadata,
|
|
14214
|
+
lf as bigintToResourceId,
|
|
14215
|
+
of as checkLocalityOfResourceId,
|
|
14203
14216
|
cr as createGlobalResourceId,
|
|
14204
14217
|
Ni as createLocalResourceId,
|
|
14205
|
-
|
|
14218
|
+
mf as defaultPlClient,
|
|
14206
14219
|
Rn as ensureResourceIdNotNull,
|
|
14207
|
-
|
|
14220
|
+
yf as expirationFromAuthInformation,
|
|
14208
14221
|
sr as extractBasicResourceData,
|
|
14209
14222
|
_i as extractTxId,
|
|
14210
14223
|
xn as field,
|
|
14211
14224
|
zn as getField,
|
|
14212
14225
|
X as inferAuthRefreshTime,
|
|
14213
|
-
|
|
14226
|
+
Qu as isAnyResourceId,
|
|
14214
14227
|
Li as isConnectionProblem,
|
|
14215
|
-
|
|
14228
|
+
uf as isField,
|
|
14216
14229
|
Wi as isFieldRef,
|
|
14217
14230
|
x as isLocalResourceId,
|
|
14218
14231
|
Ui as isNotFoundError,
|
|
14219
14232
|
C as isNotNullResourceId,
|
|
14220
14233
|
B as isNullResourceId,
|
|
14221
|
-
|
|
14222
|
-
|
|
14234
|
+
iu as isResource,
|
|
14235
|
+
ff as isResourceId,
|
|
14223
14236
|
M as isResourceRef,
|
|
14224
14237
|
Hn as isRootResourceId,
|
|
14225
14238
|
Bi as isTimeoutOrCancelError,
|
|
14226
14239
|
Ai as isUnauthenticated,
|
|
14227
|
-
|
|
14240
|
+
rf as jsonToData,
|
|
14228
14241
|
ye as plAddressToConfig,
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
|
|
14242
|
+
kf as poll,
|
|
14243
|
+
sf as resDataToJson,
|
|
14244
|
+
af as resourceIdFromString,
|
|
14232
14245
|
we as resourceIdToString,
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14246
|
+
ef as resourceType,
|
|
14247
|
+
tf as resourceTypeToString,
|
|
14248
|
+
nf as resourceTypesEqual,
|
|
14236
14249
|
Hc as rethrowMeaningfulError,
|
|
14237
|
-
|
|
14250
|
+
cf as stringifyWithResourceId,
|
|
14238
14251
|
Jc as throwPlNotFoundError,
|
|
14239
14252
|
A as toFieldId,
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14253
|
+
df as toGlobalFieldId,
|
|
14254
|
+
ru as toGlobalResourceId,
|
|
14255
|
+
T as toResourceId,
|
|
14256
|
+
Fu as tryGetFileConfig,
|
|
14257
|
+
gf as valErr
|
|
14245
14258
|
};
|
|
14246
14259
|
//# sourceMappingURL=index.mjs.map
|