@milaboratories/pl-client 3.2.5 → 3.3.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.
Files changed (112) hide show
  1. package/dist/core/client.cjs +24 -56
  2. package/dist/core/client.cjs.map +1 -1
  3. package/dist/core/client.d.ts +12 -8
  4. package/dist/core/client.d.ts.map +1 -1
  5. package/dist/core/client.js +26 -58
  6. package/dist/core/client.js.map +1 -1
  7. package/dist/core/errors.cjs +20 -0
  8. package/dist/core/errors.cjs.map +1 -1
  9. package/dist/core/errors.d.ts +6 -1
  10. package/dist/core/errors.d.ts.map +1 -1
  11. package/dist/core/errors.js +19 -1
  12. package/dist/core/errors.js.map +1 -1
  13. package/dist/core/final.cjs +6 -5
  14. package/dist/core/final.cjs.map +1 -1
  15. package/dist/core/final.d.ts.map +1 -1
  16. package/dist/core/final.js +7 -6
  17. package/dist/core/final.js.map +1 -1
  18. package/dist/core/ll_client.cjs +18 -1
  19. package/dist/core/ll_client.cjs.map +1 -1
  20. package/dist/core/ll_client.d.ts +6 -2
  21. package/dist/core/ll_client.d.ts.map +1 -1
  22. package/dist/core/ll_client.js +19 -2
  23. package/dist/core/ll_client.js.map +1 -1
  24. package/dist/core/transaction.cjs +109 -75
  25. package/dist/core/transaction.cjs.map +1 -1
  26. package/dist/core/transaction.d.ts +30 -22
  27. package/dist/core/transaction.d.ts.map +1 -1
  28. package/dist/core/transaction.js +111 -76
  29. package/dist/core/transaction.js.map +1 -1
  30. package/dist/core/type_conversion.cjs +14 -6
  31. package/dist/core/type_conversion.cjs.map +1 -1
  32. package/dist/core/type_conversion.js +14 -6
  33. package/dist/core/type_conversion.js.map +1 -1
  34. package/dist/core/types.cjs +77 -17
  35. package/dist/core/types.cjs.map +1 -1
  36. package/dist/core/types.d.ts +49 -26
  37. package/dist/core/types.d.ts.map +1 -1
  38. package/dist/core/types.js +66 -14
  39. package/dist/core/types.js.map +1 -1
  40. package/dist/core/user_resources.cjs +181 -0
  41. package/dist/core/user_resources.cjs.map +1 -0
  42. package/dist/core/user_resources.d.ts +75 -0
  43. package/dist/core/user_resources.d.ts.map +1 -0
  44. package/dist/core/user_resources.js +180 -0
  45. package/dist/core/user_resources.js.map +1 -0
  46. package/dist/helpers/poll.cjs +4 -4
  47. package/dist/helpers/poll.cjs.map +1 -1
  48. package/dist/helpers/poll.d.ts +3 -3
  49. package/dist/helpers/poll.d.ts.map +1 -1
  50. package/dist/helpers/poll.js +5 -5
  51. package/dist/helpers/poll.js.map +1 -1
  52. package/dist/helpers/tx_helpers.cjs +1 -1
  53. package/dist/helpers/tx_helpers.cjs.map +1 -1
  54. package/dist/helpers/tx_helpers.d.ts +3 -3
  55. package/dist/helpers/tx_helpers.d.ts.map +1 -1
  56. package/dist/helpers/tx_helpers.js +2 -2
  57. package/dist/helpers/tx_helpers.js.map +1 -1
  58. package/dist/index.cjs +16 -5
  59. package/dist/index.d.ts +5 -4
  60. package/dist/index.js +5 -4
  61. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +724 -188
  62. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -1
  63. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +34 -9
  64. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -1
  65. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +37 -5
  66. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -1
  67. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +34 -9
  68. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -1
  69. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +326 -136
  70. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
  71. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js +724 -188
  72. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -1
  73. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs +18 -7
  74. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +1 -1
  75. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +11 -7
  76. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -1
  77. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js +18 -7
  78. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +1 -1
  79. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs +57 -2
  80. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +1 -1
  81. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +26 -3
  82. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -1
  83. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js +57 -3
  84. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +1 -1
  85. package/dist/proto-rest/plapi.d.ts +421 -207
  86. package/dist/proto-rest/plapi.d.ts.map +1 -1
  87. package/dist/test/test_config.cjs +6 -3
  88. package/dist/test/test_config.cjs.map +1 -1
  89. package/dist/test/test_config.d.ts.map +1 -1
  90. package/dist/test/test_config.js +7 -4
  91. package/dist/test/test_config.js.map +1 -1
  92. package/package.json +5 -5
  93. package/src/core/client.ts +58 -103
  94. package/src/core/errors.ts +23 -0
  95. package/src/core/final.ts +16 -6
  96. package/src/core/ll_client.ts +39 -3
  97. package/src/core/ll_transaction.test.ts +41 -6
  98. package/src/core/transaction.ts +176 -86
  99. package/src/core/type_conversion.ts +24 -9
  100. package/src/core/types.ts +147 -41
  101. package/src/core/user_resources.ts +332 -0
  102. package/src/helpers/poll.ts +15 -8
  103. package/src/helpers/state_helpers.ts +2 -2
  104. package/src/helpers/tx_helpers.ts +5 -5
  105. package/src/index.ts +1 -0
  106. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +61 -14
  107. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.ts +1045 -379
  108. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +33 -18
  109. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +75 -6
  110. package/src/proto-grpc/google/protobuf/descriptor.ts +5 -2
  111. package/src/proto-rest/plapi.ts +447 -225
  112. package/src/test/test_config.ts +8 -5
@@ -14,16 +14,18 @@ function isField(ref) {
14
14
  return ref.hasOwnProperty("resourceId") && ref.hasOwnProperty("fieldName");
15
15
  }
16
16
  function isResource(ref) {
17
- return typeof ref === "bigint" || ref.hasOwnProperty("globalId") && ref.hasOwnProperty("localId");
17
+ if (typeof ref === "bigint") return true;
18
+ if (typeof ref === "string") return true;
19
+ return isResourceRef(ref);
18
20
  }
19
21
  function isResourceId(ref) {
20
- return typeof ref === "bigint" && !require_types.isLocalResourceId(ref) && !require_types.isNullResourceId(ref);
22
+ return typeof ref === "string" && require_types.isSignedResourceId(ref);
21
23
  }
22
24
  function isFieldRef(ref) {
23
25
  return isResourceRef(ref.resourceId);
24
26
  }
25
27
  function isResourceRef(ref) {
26
- return ref.hasOwnProperty("globalId") && ref.hasOwnProperty("localId");
28
+ return typeof ref === "object" && ref !== null && ref.hasOwnProperty("globalId") && ref.hasOwnProperty("localId");
27
29
  }
28
30
  function toFieldId(ref) {
29
31
  if (isFieldRef(ref)) return {
@@ -37,15 +39,30 @@ async function toGlobalFieldId(ref) {
37
39
  resourceId: await ref.resourceId.globalId,
38
40
  fieldName: ref.fieldName
39
41
  };
40
- else return ref;
42
+ return ref;
41
43
  }
42
- function toResourceId(ref) {
43
- if (isResourceRef(ref)) return ref.localId;
44
- else return ref;
44
+ const emptySignature = require_types.toResourceSignature(new Uint8Array(0));
45
+ function toResourceIdAndSignature(ref) {
46
+ if (isResourceRef(ref)) return {
47
+ resourceId: ref.localId,
48
+ resourceSignature: emptySignature
49
+ };
50
+ if (isResourceId(ref)) {
51
+ const { globalId, signature } = require_types.parseSignedResourceId(ref);
52
+ return {
53
+ resourceId: globalId,
54
+ resourceSignature: signature
55
+ };
56
+ }
57
+ return {
58
+ resourceId: ref,
59
+ resourceSignature: emptySignature
60
+ };
45
61
  }
46
62
  async function toGlobalResourceId(ref) {
47
63
  if (isResourceRef(ref)) return await ref.globalId;
48
- else return ref;
64
+ if (require_types.isLocalResourceId(ref)) return require_types.createSignedResourceId(ref);
65
+ return ref;
49
66
  }
50
67
  function field(resourceId, fieldName) {
51
68
  return {
@@ -147,6 +164,32 @@ var PlTransaction = class PlTransaction {
147
164
  sendVoidAsync(r) {
148
165
  this.track(this.sendVoidSync(r));
149
166
  }
167
+ /** Set default color proof for subsequent resource creation requests */
168
+ setDefaultColor(colorProof) {
169
+ this.sendVoidAsync({
170
+ oneofKind: "setDefaultColor",
171
+ setDefaultColor: { colorProof }
172
+ });
173
+ }
174
+ toSignedResourceId(rId) {
175
+ return toResourceIdAndSignature(rId);
176
+ }
177
+ toSignedFieldId(fId) {
178
+ const base = toFieldId(fId);
179
+ const signed = toResourceIdAndSignature(base.resourceId);
180
+ return {
181
+ resourceId: signed.resourceId,
182
+ fieldName: base.fieldName,
183
+ resourceSignature: signed.resourceSignature
184
+ };
185
+ }
186
+ toSignedErrorRef(rId) {
187
+ const { resourceId, resourceSignature } = this.toSignedResourceId(rId);
188
+ return {
189
+ errorResourceId: resourceId,
190
+ errorResourceSignature: resourceSignature
191
+ };
192
+ }
150
193
  checkTxOpen() {
151
194
  if (this._completed) throw new Error("Transaction already closed");
152
195
  }
@@ -190,25 +233,19 @@ var PlTransaction = class PlTransaction {
190
233
  await this.ll.await();
191
234
  }
192
235
  get clientRoot() {
193
- return require_types.ensureResourceIdNotNull(this._clientRoot);
236
+ return require_types.ensureSignedResourceIdNotNull(this._clientRoot);
194
237
  }
195
- createSingleton(name, type, errorIfExists = false) {
196
- const localId = this.nextLocalResourceId(false);
197
- const globalId = this.sendSingleAndParse({
238
+ createSingleton(name, type, errorIfExists = false, color) {
239
+ return this.createResource(false, (localId) => ({
198
240
  oneofKind: "resourceCreateSingleton",
199
241
  resourceCreateSingleton: {
200
242
  type,
201
243
  id: localId,
202
244
  data: Buffer.from(name),
203
245
  errorIfExists,
204
- colorProof: new Uint8Array(0)
246
+ colorProof: color ?? emptySignature
205
247
  }
206
- }, (r) => r.resourceCreateSingleton.resourceId);
207
- this.track(globalId);
208
- return {
209
- globalId,
210
- localId
211
- };
248
+ }), (r) => r.resourceCreateSingleton.resourceId, (r) => r.resourceCreateSingleton.resourceSignature);
212
249
  }
213
250
  getSingleton(name, loadFields = true) {
214
251
  return this.sendSingleAndParse({
@@ -219,9 +256,11 @@ var PlTransaction = class PlTransaction {
219
256
  }
220
257
  }, (r) => require_type_conversion.protoToResource((0, _milaboratories_ts_helpers.notEmpty)(r.resourceGetSingleton.resource)));
221
258
  }
222
- createResource(root, req, parser) {
259
+ createResource(root, req, parser, sigExtractor) {
223
260
  const localId = this.nextLocalResourceId(root);
224
- const globalId = this.sendSingleAndParse(req(localId), (r) => parser(r));
261
+ const globalId = this.sendSingleAndParse(req(localId), (r) => {
262
+ return require_types.createSignedResourceId(parser(r), sigExtractor ? require_types.toResourceSignature(sigExtractor(r)) : void 0);
263
+ });
225
264
  this.track(globalId);
226
265
  return {
227
266
  globalId,
@@ -236,9 +275,9 @@ var PlTransaction = class PlTransaction {
236
275
  type,
237
276
  id: localId
238
277
  }
239
- }), (r) => r.resourceCreateRoot.resourceId);
278
+ }), (r) => r.resourceCreateRoot.resourceId, (r) => r.resourceCreateRoot.resourceSignature);
240
279
  }
241
- createStruct(type, data) {
280
+ createStruct(type, data, color) {
242
281
  this._stat.structsCreated++;
243
282
  this._stat.structsCreatedDataBytes += data?.length ?? 0;
244
283
  return this.createResource(false, (localId) => ({
@@ -247,11 +286,11 @@ var PlTransaction = class PlTransaction {
247
286
  type,
248
287
  id: localId,
249
288
  data: data === void 0 ? void 0 : typeof data === "string" ? Buffer.from(data) : data,
250
- colorProof: new Uint8Array(0)
289
+ colorProof: color ?? emptySignature
251
290
  }
252
- }), (r) => r.resourceCreateStruct.resourceId);
291
+ }), (r) => r.resourceCreateStruct.resourceId, (r) => r.resourceCreateStruct.resourceSignature);
253
292
  }
254
- createEphemeral(type, data) {
293
+ createEphemeral(type, data, color) {
255
294
  this._stat.ephemeralsCreated++;
256
295
  this._stat.ephemeralsCreatedDataBytes += data?.length ?? 0;
257
296
  return this.createResource(false, (localId) => ({
@@ -260,11 +299,11 @@ var PlTransaction = class PlTransaction {
260
299
  type,
261
300
  id: localId,
262
301
  data: data === void 0 ? void 0 : typeof data === "string" ? Buffer.from(data) : data,
263
- colorProof: new Uint8Array(0)
302
+ colorProof: color ?? emptySignature
264
303
  }
265
- }), (r) => r.resourceCreateEphemeral.resourceId);
304
+ }), (r) => r.resourceCreateEphemeral.resourceId, (r) => r.resourceCreateEphemeral.resourceSignature);
266
305
  }
267
- createValue(type, data, errorIfExists = false) {
306
+ createValue(type, data, errorIfExists = false, color) {
268
307
  this._stat.valuesCreated++;
269
308
  this._stat.valuesCreatedDataBytes += data?.length ?? 0;
270
309
  return this.createResource(false, (localId) => ({
@@ -274,26 +313,26 @@ var PlTransaction = class PlTransaction {
274
313
  id: localId,
275
314
  data: typeof data === "string" ? Buffer.from(data) : data,
276
315
  errorIfExists,
277
- colorProof: new Uint8Array(0)
316
+ colorProof: color ?? emptySignature
278
317
  }
279
- }), (r) => r.resourceCreateValue.resourceId);
318
+ }), (r) => r.resourceCreateValue.resourceId, (r) => r.resourceCreateValue.resourceSignature);
280
319
  }
281
- createJsonValue(data) {
320
+ createJsonValue(data, color) {
282
321
  const jsonData = (0, _milaboratories_ts_helpers.canonicalJsonBytes)(data);
283
- return this.createValue(require_pl.JsonObject, jsonData, false);
322
+ return this.createValue(require_pl.JsonObject, jsonData, false, color);
284
323
  }
285
- createJsonGzValue(data, minSizeToGzip = 16384) {
324
+ createJsonGzValue(data, minSizeToGzip = 16384, color) {
286
325
  const { data: jsonData, isGzipped } = (0, _milaboratories_ts_helpers.canonicalJsonGzBytes)(data, minSizeToGzip);
287
- return this.createValue(isGzipped ? require_pl.JsonGzObject : require_pl.JsonObject, jsonData, false);
326
+ return this.createValue(isGzipped ? require_pl.JsonGzObject : require_pl.JsonObject, jsonData, false, color);
288
327
  }
289
- createError(message) {
290
- return this.createValue(require_error_resource.ErrorResourceType, JSON.stringify({ message }));
328
+ createError(message, color) {
329
+ return this.createValue(require_error_resource.ErrorResourceType, JSON.stringify({ message }), false, color);
291
330
  }
292
331
  setResourceName(name, rId) {
293
332
  this.sendVoidAsync({
294
333
  oneofKind: "resourceNameSet",
295
334
  resourceNameSet: {
296
- resourceId: toResourceId(rId),
335
+ ...this.toSignedResourceId(rId),
297
336
  name
298
337
  }
299
338
  });
@@ -308,7 +347,11 @@ var PlTransaction = class PlTransaction {
308
347
  return this.sendSingleAndParse({
309
348
  oneofKind: "resourceNameGet",
310
349
  resourceNameGet: { name }
311
- }, (r) => require_types.ensureResourceIdNotNull(r.resourceNameGet.resourceId));
350
+ }, (r) => {
351
+ const rawId = r.resourceNameGet.resourceId;
352
+ if (rawId === 0n) throw new Error("null resource id from getResourceByName");
353
+ return require_types.createSignedResourceId(rawId, require_types.toResourceSignature(r.resourceNameGet.resourceSignature));
354
+ });
312
355
  }
313
356
  checkResourceNameExists(name) {
314
357
  return this.sendSingleAndParse({
@@ -319,18 +362,18 @@ var PlTransaction = class PlTransaction {
319
362
  removeResource(rId) {
320
363
  this.sendVoidAsync({
321
364
  oneofKind: "resourceRemove",
322
- resourceRemove: { resourceId: rId }
365
+ resourceRemove: this.toSignedResourceId(rId)
323
366
  });
324
367
  }
325
368
  resourceExists(rId) {
326
369
  return this.sendSingleAndParse({
327
370
  oneofKind: "resourceExists",
328
- resourceExists: { resourceId: rId }
371
+ resourceExists: this.toSignedResourceId(rId)
329
372
  }, (r) => r.resourceExists.exists);
330
373
  }
331
374
  async getResourceData(rId, loadFields = true, ignoreCache = false) {
332
375
  return this.track(async () => {
333
- if (!ignoreCache && !isResourceRef(rId) && !require_types.isLocalResourceId(rId)) {
376
+ if (!ignoreCache && isResourceId(rId)) {
334
377
  const fromCache = this.sharedResourceDataCache.get(rId);
335
378
  if (fromCache && fromCache.cacheTxOpenTimestamp < this.txOpenTimestamp) {
336
379
  if (!loadFields) {
@@ -348,14 +391,14 @@ var PlTransaction = class PlTransaction {
348
391
  const result = await this.sendSingleAndParse({
349
392
  oneofKind: "resourceGet",
350
393
  resourceGet: {
351
- resourceId: toResourceId(rId),
394
+ ...this.toSignedResourceId(rId),
352
395
  loadFields
353
396
  }
354
397
  }, (r) => require_type_conversion.protoToResource((0, _milaboratories_ts_helpers.notEmpty)(r.resourceGet.resource)));
355
398
  this._stat.rGetDataNetRequests++;
356
399
  this._stat.rGetDataNetBytes += result.data?.length ?? 0;
357
400
  this._stat.rGetDataNetFields += result.fields.length;
358
- if (!isResourceRef(rId) && !require_types.isLocalResourceId(rId) && this.finalPredicate(result)) {
401
+ if (isResourceId(rId) && this.finalPredicate(result)) {
359
402
  (0, _milaboratories_ts_helpers.deepFreeze)(result);
360
403
  const fromCache = this.sharedResourceDataCache.get(rId);
361
404
  if (fromCache) {
@@ -384,7 +427,7 @@ var PlTransaction = class PlTransaction {
384
427
  async getResourceDataIfExists(rId, loadFields = true) {
385
428
  return this.track(async () => {
386
429
  const result = await notFoundToUndefined(async () => await this.getResourceData(rId, loadFields, true));
387
- if (result === void 0 && !isResourceRef(rId) && !require_types.isLocalResourceId(rId)) this.sharedResourceDataCache.delete(rId);
430
+ if (result === void 0 && isResourceId(rId)) this.sharedResourceDataCache.delete(rId);
388
431
  return result;
389
432
  });
390
433
  }
@@ -399,10 +442,7 @@ var PlTransaction = class PlTransaction {
399
442
  this._stat.inputsLocked++;
400
443
  this.sendVoidAsync({
401
444
  oneofKind: "resourceLockInputs",
402
- resourceLockInputs: {
403
- resourceId: toResourceId(rId),
404
- resourceSignature: new Uint8Array(0)
405
- }
445
+ resourceLockInputs: this.toSignedResourceId(rId)
406
446
  });
407
447
  }
408
448
  /**
@@ -413,10 +453,7 @@ var PlTransaction = class PlTransaction {
413
453
  this._stat.outputsLocked++;
414
454
  this.sendVoidAsync({
415
455
  oneofKind: "resourceLockOutputs",
416
- resourceLockOutputs: {
417
- resourceId: toResourceId(rId),
418
- resourceSignature: new Uint8Array(0)
419
- }
456
+ resourceLockOutputs: this.toSignedResourceId(rId)
420
457
  });
421
458
  }
422
459
  lock(rID) {
@@ -427,8 +464,8 @@ var PlTransaction = class PlTransaction {
427
464
  this.sendVoidAsync({
428
465
  oneofKind: "resourceSetError",
429
466
  resourceSetError: {
430
- resourceId: toResourceId(rId),
431
- errorResourceId: toResourceId(ref)
467
+ ...this.toSignedResourceId(rId),
468
+ ...this.toSignedErrorRef(ref)
432
469
  }
433
470
  });
434
471
  }
@@ -438,7 +475,7 @@ var PlTransaction = class PlTransaction {
438
475
  oneofKind: "fieldCreate",
439
476
  fieldCreate: {
440
477
  type: require_type_conversion.fieldTypeToProto(fieldType),
441
- id: toFieldId(fId)
478
+ id: this.toSignedFieldId(fId)
442
479
  }
443
480
  });
444
481
  if (value !== void 0) this.setField(fId, value);
@@ -446,7 +483,7 @@ var PlTransaction = class PlTransaction {
446
483
  fieldExists(fId) {
447
484
  return this.sendSingleAndParse({
448
485
  oneofKind: "fieldExists",
449
- fieldExists: { field: toFieldId(fId) }
486
+ fieldExists: { field: this.toSignedFieldId(fId) }
450
487
  }, (r) => r.fieldExists.exists);
451
488
  }
452
489
  setField(fId, ref) {
@@ -454,9 +491,9 @@ var PlTransaction = class PlTransaction {
454
491
  if (isResource(ref)) this.sendVoidAsync({
455
492
  oneofKind: "fieldSet",
456
493
  fieldSet: {
457
- field: toFieldId(fId),
494
+ field: this.toSignedFieldId(fId),
458
495
  value: {
459
- resourceId: toResourceId(ref),
496
+ ...this.toSignedResourceId(ref),
460
497
  fieldName: ""
461
498
  }
462
499
  }
@@ -464,8 +501,8 @@ var PlTransaction = class PlTransaction {
464
501
  else this.sendVoidAsync({
465
502
  oneofKind: "fieldSet",
466
503
  fieldSet: {
467
- field: toFieldId(fId),
468
- value: toFieldId(ref)
504
+ field: this.toSignedFieldId(fId),
505
+ value: this.toSignedFieldId(ref)
469
506
  }
470
507
  });
471
508
  }
@@ -474,8 +511,8 @@ var PlTransaction = class PlTransaction {
474
511
  this.sendVoidAsync({
475
512
  oneofKind: "fieldSetError",
476
513
  fieldSetError: {
477
- field: toFieldId(fId),
478
- errorResourceId: toResourceId(ref)
514
+ field: this.toSignedFieldId(fId),
515
+ ...this.toSignedErrorRef(ref)
479
516
  }
480
517
  });
481
518
  }
@@ -483,7 +520,7 @@ var PlTransaction = class PlTransaction {
483
520
  this._stat.fieldsGet++;
484
521
  return this.sendSingleAndParse({
485
522
  oneofKind: "fieldGet",
486
- fieldGet: { field: toFieldId(fId) }
523
+ fieldGet: { field: this.toSignedFieldId(fId) }
487
524
  }, (r) => require_type_conversion.protoToField((0, _milaboratories_ts_helpers.notEmpty)(r.fieldGet.field)));
488
525
  }
489
526
  async getFieldIfExists(fId) {
@@ -492,13 +529,13 @@ var PlTransaction = class PlTransaction {
492
529
  resetField(fId) {
493
530
  this.sendVoidAsync({
494
531
  oneofKind: "fieldReset",
495
- fieldReset: { field: toFieldId(fId) }
532
+ fieldReset: { field: this.toSignedFieldId(fId) }
496
533
  });
497
534
  }
498
535
  removeField(fId) {
499
536
  this.sendVoidAsync({
500
537
  oneofKind: "fieldRemove",
501
- fieldRemove: { field: toFieldId(fId) }
538
+ fieldRemove: { field: this.toSignedFieldId(fId) }
502
539
  });
503
540
  }
504
541
  async listKeyValues(rId) {
@@ -506,7 +543,7 @@ var PlTransaction = class PlTransaction {
506
543
  const result = await this.sendMultiAndParse({
507
544
  oneofKind: "resourceKeyValueList",
508
545
  resourceKeyValueList: {
509
- resourceId: toResourceId(rId),
546
+ ...this.toSignedResourceId(rId),
510
547
  startFrom: "",
511
548
  limit: 0
512
549
  }
@@ -535,8 +572,7 @@ var PlTransaction = class PlTransaction {
535
572
  this.sendVoidAsync({
536
573
  oneofKind: "resourceKeyValueSet",
537
574
  resourceKeyValueSet: {
538
- resourceId: toResourceId(rId),
539
- resourceSignature: new Uint8Array(0),
575
+ ...this.toSignedResourceId(rId),
540
576
  key,
541
577
  value: require_util.toBytes(value)
542
578
  }
@@ -546,8 +582,7 @@ var PlTransaction = class PlTransaction {
546
582
  this.sendVoidAsync({
547
583
  oneofKind: "resourceKeyValueDelete",
548
584
  resourceKeyValueDelete: {
549
- resourceId: toResourceId(rId),
550
- resourceSignature: new Uint8Array(0),
585
+ ...this.toSignedResourceId(rId),
551
586
  key
552
587
  }
553
588
  });
@@ -557,7 +592,7 @@ var PlTransaction = class PlTransaction {
557
592
  const result = await this.sendSingleAndParse({
558
593
  oneofKind: "resourceKeyValueGet",
559
594
  resourceKeyValueGet: {
560
- resourceId: toResourceId(rId),
595
+ ...this.toSignedResourceId(rId),
561
596
  key
562
597
  }
563
598
  }, (r) => r.resourceKeyValueGet.value);
@@ -577,7 +612,7 @@ var PlTransaction = class PlTransaction {
577
612
  const result = await this.sendSingleAndParse({
578
613
  oneofKind: "resourceKeyValueGetIfExists",
579
614
  resourceKeyValueGetIfExists: {
580
- resourceId: toResourceId(rId),
615
+ ...this.toSignedResourceId(rId),
581
616
  key
582
617
  }
583
618
  }, (r) => r.resourceKeyValueGetIfExists.exists ? r.resourceKeyValueGetIfExists.value : void 0);
@@ -594,7 +629,7 @@ var PlTransaction = class PlTransaction {
594
629
  }
595
630
  async getKValueJsonIfExists(rId, key) {
596
631
  return this.track(async () => {
597
- const str = await this.getKValueString(rId, key);
632
+ const str = await this.getKValueStringIfExists(rId, key);
598
633
  if (str === void 0) return void 0;
599
634
  return JSON.parse(str);
600
635
  });
@@ -657,6 +692,5 @@ exports.isResourceRef = isResourceRef;
657
692
  exports.toFieldId = toFieldId;
658
693
  exports.toGlobalFieldId = toGlobalFieldId;
659
694
  exports.toGlobalResourceId = toGlobalResourceId;
660
- exports.toResourceId = toResourceId;
661
695
 
662
696
  //# sourceMappingURL=transaction.cjs.map