@milaboratories/pl-client 2.18.4 → 3.0.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 (52) hide show
  1. package/dist/core/ll_client.cjs +11 -5
  2. package/dist/core/ll_client.cjs.map +1 -1
  3. package/dist/core/ll_client.js +12 -6
  4. package/dist/core/ll_client.js.map +1 -1
  5. package/dist/core/transaction.cjs +2 -2
  6. package/dist/core/transaction.cjs.map +1 -1
  7. package/dist/core/transaction.js +2 -2
  8. package/dist/core/transaction.js.map +1 -1
  9. package/dist/core/type_conversion.cjs +1 -1
  10. package/dist/core/type_conversion.cjs.map +1 -1
  11. package/dist/core/type_conversion.js +1 -1
  12. package/dist/core/type_conversion.js.map +1 -1
  13. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +1957 -256
  14. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -1
  15. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +59 -9
  16. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -1
  17. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +74 -4
  18. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +59 -9
  19. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -1
  20. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +658 -51
  21. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js +1957 -257
  22. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -1
  23. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs +247 -17
  24. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +1 -1
  25. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +104 -10
  26. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js +247 -17
  27. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +1 -1
  28. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs +26 -12
  29. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +1 -1
  30. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +4 -0
  31. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js +26 -12
  32. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +1 -1
  33. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs +11 -0
  34. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +1 -1
  35. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +4 -0
  36. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js +11 -0
  37. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +1 -1
  38. package/dist/proto-rest/plapi.d.ts +281 -28
  39. package/package.json +4 -4
  40. package/src/core/ll_client.ts +9 -2
  41. package/src/core/transaction.ts +33 -8
  42. package/src/core/type_conversion.ts +1 -1
  43. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +119 -15
  44. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.ts +2270 -322
  45. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +276 -20
  46. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +11 -0
  47. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/import.ts +2 -2
  48. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +11 -0
  49. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.ts +3 -3
  50. package/src/proto-grpc/google/protobuf/descriptor.ts +2 -5
  51. package/src/proto-grpc/google/protobuf/struct.ts +1 -1
  52. package/src/proto-rest/plapi.ts +293 -22
@@ -4,6 +4,22 @@
4
4
  * Do not make direct changes to the file.
5
5
  */
6
6
  interface paths {
7
+ "/v1/auth/grant-access": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ get?: never;
15
+ put?: never;
16
+ post: operations["Platform_GrantAccess"];
17
+ delete?: never;
18
+ options?: never;
19
+ head?: never;
20
+ patch?: never;
21
+ trace?: never;
22
+ };
7
23
  "/v1/auth/jwt-token": {
8
24
  parameters: {
9
25
  query?: never;
@@ -36,6 +52,22 @@ interface paths {
36
52
  patch?: never;
37
53
  trace?: never;
38
54
  };
55
+ "/v1/auth/revoke-grant": {
56
+ parameters: {
57
+ query?: never;
58
+ header?: never;
59
+ path?: never;
60
+ cookie?: never;
61
+ };
62
+ get?: never;
63
+ put?: never;
64
+ post: operations["Platform_RevokeGrant"];
65
+ delete?: never;
66
+ options?: never;
67
+ head?: never;
68
+ patch?: never;
69
+ trace?: never;
70
+ };
39
71
  "/v1/controller/aliases-and-urls": {
40
72
  parameters: {
41
73
  query?: never;
@@ -228,7 +260,7 @@ interface paths {
228
260
  patch?: never;
229
261
  trace?: never;
230
262
  };
231
- "/v1/locks/lease": {
263
+ "/v1/locks/lease/create": {
232
264
  parameters: {
233
265
  query?: never;
234
266
  header?: never;
@@ -236,9 +268,78 @@ interface paths {
236
268
  cookie?: never;
237
269
  };
238
270
  get?: never;
239
- put: operations["Platform_UpdateLease"]; /** @description Locks */
271
+ put?: never;
272
+ /**
273
+ * @description LeaseResource creates a lease for a resource. A lease is a temporary lock that needs periodic renewal to stay valid.
274
+ * Leases are a separate mechanism from locks: leases are focused on 'clients', while locks are focused on 'resources'.
275
+ * To keep the lease active, the client needs the lease ID that is generated when a lease is created and used for lease updates.
276
+ */
240
277
  post: operations["Platform_LeaseResource"];
241
- delete: operations["Platform_ReleaseLease"];
278
+ delete?: never;
279
+ options?: never;
280
+ head?: never;
281
+ patch?: never;
282
+ trace?: never;
283
+ };
284
+ "/v1/locks/lease/release": {
285
+ parameters: {
286
+ query?: never;
287
+ header?: never;
288
+ path?: never;
289
+ cookie?: never;
290
+ };
291
+ get?: never;
292
+ put?: never;
293
+ post: operations["Platform_ReleaseLease"];
294
+ delete?: never;
295
+ options?: never;
296
+ head?: never;
297
+ patch?: never;
298
+ trace?: never;
299
+ };
300
+ "/v1/locks/lease/update": {
301
+ parameters: {
302
+ query?: never;
303
+ header?: never;
304
+ path?: never;
305
+ cookie?: never;
306
+ };
307
+ get?: never;
308
+ put?: never;
309
+ post: operations["Platform_UpdateLease"];
310
+ delete?: never;
311
+ options?: never;
312
+ head?: never;
313
+ patch?: never;
314
+ trace?: never;
315
+ };
316
+ "/v1/locks/lock/create": {
317
+ parameters: {
318
+ query?: never;
319
+ header?: never;
320
+ path?: never;
321
+ cookie?: never;
322
+ };
323
+ get?: never;
324
+ put?: never;
325
+ /**
326
+ * @description LockFieldValues gets the resource and obtains a lock on all resolved values of listed fields:
327
+ * - get the resource that will take the lock ('FOR' resource) (lock cannot be obtained 'FOR' or 'ON' deleted resource)
328
+ * - list resource's fields, take fields with names set in request
329
+ * - get resolved values of listed fields (IDs of 'ON' resources).
330
+ * - acquire lock on all 'ON' resources, marking 'FOR' resource as an owner.
331
+ *
332
+ * Lock logic constraints:
333
+ * - Locking is optimistic: if two processes try to obtain a lock on the same resource, one of them
334
+ * succeeds, while the other fails with an error (no long waiting)
335
+ * - Only resolved reference can be locked: to obtain a lock for a particular field's value, the backend needs to know
336
+ * the resource ID this field points to. Unless all listed field references are resolved to a final ID, the lock will fail.
337
+ * - Only an original resource can be locked: if a resource is 'pure' (supports deduplication), it has to pass deduplication before
338
+ * being lockable. An attempt to lock a resource that has not become original will fail.
339
+ * - Locking is a one-way operation: it cannot be 'released' or 'revoked'.
340
+ */
341
+ post: operations["Platform_LockFieldValues"];
342
+ delete?: never;
242
343
  options?: never;
243
344
  head?: never;
244
345
  patch?: never;
@@ -375,7 +476,8 @@ interface components {
375
476
  };
376
477
  DetachFilter_Response: Record<string, never>;
377
478
  Exists_Request: {
378
- resourceId: string;
479
+ resourceId: string; /** Format: bytes */
480
+ resourceSignature: string;
379
481
  };
380
482
  Exists_Response: {
381
483
  exists: boolean;
@@ -385,27 +487,39 @@ interface components {
385
487
  type: number;
386
488
  features: components["schemas"]["Resource_Features"];
387
489
  /**
388
- * @description _resolved_ value of field or _assigned_ if the field was assigned to a resource.
389
- * If field refers to another field, it will get
390
- * value only when this chain of references ends up with direct resource
391
- * reference. At that moment all fields in the chain will get their values
490
+ * @description _resolved_ value of a field or _assigned_ if the field was assigned to a resource.
491
+ * If a field refers to another field, it will get
492
+ * a value only when this chain of references ends up with a direct resource
493
+ * reference. At that moment, all fields in the chain will get their values
392
494
  * resolved and will start to refer to the same resource directly.
393
495
  */
394
496
  value: string;
497
+ /**
498
+ * Format: bytes
499
+ * @description Signature for value resource ID, inheriting the parent resource's color.
500
+ * Populated server-side when the parent resource has a known color in the current TX.
501
+ */
502
+ valueSignature: string;
395
503
  /**
396
504
  * Format: enum
397
- * @description If the value was empty, assigned or finally resolved.
505
+ * @description Whether the value is empty, assigned, or finally resolved.
398
506
  */
399
507
  valueStatus: number; /** @description If the value is in its final state (ready, duplicate or error) */
400
508
  valueIsFinal: boolean;
401
509
  /**
402
- * @description Resource error resource id if any.
403
- * Is intended to report problems _from_ platform to client.
510
+ * @description Error resource ID, if any.
511
+ * Is intended to report problems _from_ the platform to the client.
404
512
  */
405
513
  error: string;
514
+ /**
515
+ * Format: bytes
516
+ * @description Signature for error resource ID, inheriting the parent resource's color.
517
+ */
518
+ errorSignature: string;
406
519
  };
407
520
  FieldRef: {
408
- resourceId: string;
521
+ resourceId: string; /** Format: bytes */
522
+ resourceSignature: string;
409
523
  fieldName: string;
410
524
  };
411
525
  FieldSchema: {
@@ -413,10 +527,12 @@ interface components {
413
527
  name: string;
414
528
  };
415
529
  GetJWTToken_Request: {
416
- expiration: string;
530
+ expiration: string; /** Format: enum */
531
+ requestedRole: number;
417
532
  };
418
533
  GetJWTToken_Response: {
419
- token: string;
534
+ token: string; /** Format: bytes */
535
+ sessionId: string;
420
536
  };
421
537
  GetNotifications_Request: {
422
538
  controllerType: string; /** Format: uint32 */
@@ -433,7 +549,8 @@ interface components {
433
549
  controllerUrl: string;
434
550
  };
435
551
  Get_Request: {
436
- resourceId: string;
552
+ resourceId: string; /** Format: bytes */
553
+ resourceSignature: string;
437
554
  loadFields: boolean;
438
555
  };
439
556
  Get_Response: {
@@ -444,6 +561,16 @@ interface components {
444
561
  } & {
445
562
  [key: string]: unknown;
446
563
  };
564
+ GrantAccess_Request: {
565
+ resourceId: string; /** Format: bytes */
566
+ resourceSignature: string;
567
+ targetUser: string;
568
+ permissions: components["schemas"]["Grant_Permissions"];
569
+ };
570
+ GrantAccess_Response: Record<string, never>; /** @description Permissions describes access level for a grant. */
571
+ Grant_Permissions: {
572
+ writable: boolean;
573
+ };
447
574
  License_Response: {
448
575
  /** Format: int32 */status: number;
449
576
  isOk: boolean;
@@ -490,6 +617,7 @@ interface components {
490
617
  resourceCreated: boolean;
491
618
  resourceDeleted: boolean;
492
619
  resourceReady: boolean;
620
+ resourceRecovered: boolean;
493
621
  resourceDuplicate: boolean;
494
622
  resourceError: boolean; /** @description Field events */
495
623
  inputsLocked: boolean;
@@ -524,6 +652,7 @@ interface components {
524
652
  allOutputsSet: boolean;
525
653
  genericOtwSet: boolean;
526
654
  dynamicChanged: boolean;
655
+ resourceRecovered: boolean;
527
656
  };
528
657
  Notification_FieldChange: {
529
658
  old: components["schemas"]["Field"];
@@ -531,8 +660,7 @@ interface components {
531
660
  };
532
661
  Ping_Response: {
533
662
  coreVersion: string;
534
- coreFullVersion: string;
535
- serverInfo: string; /** Format: enum */
663
+ coreFullVersion: string; /** Format: enum */
536
664
  compression: number;
537
665
  /**
538
666
  * @description instanceID is a unique ID that changes when we reset DB state.
@@ -558,6 +686,7 @@ interface components {
558
686
  };
559
687
  Release_Request: {
560
688
  resourceId: string; /** Format: bytes */
689
+ resourceSignature: string; /** Format: bytes */
561
690
  leaseId: string;
562
691
  };
563
692
  Release_Response: Record<string, never>;
@@ -566,7 +695,8 @@ interface components {
566
695
  };
567
696
  RemoveAliasesAndUrls_Response: Record<string, never>;
568
697
  Resource: {
569
- id: string; /** Format: bytes */
698
+ resourceId: string; /** Format: bytes */
699
+ resourceSignature: string; /** Format: bytes */
570
700
  canonicalId: string; /** Format: enum */
571
701
  kind: number;
572
702
  type: components["schemas"]["ResourceType"]; /** Format: bytes */
@@ -591,7 +721,31 @@ interface components {
591
721
  };
592
722
  ResourceSchema: {
593
723
  type: components["schemas"]["ResourceType"];
594
- fields: components["schemas"]["FieldSchema"][];
724
+ fields: components["schemas"]["FieldSchema"][]; /** @description Access restriction flags for non-controller roles */
725
+ accessFlags: components["schemas"]["ResourceSchema_AccessFlags"];
726
+ freeInputs: boolean;
727
+ freeOutputs: boolean;
728
+ };
729
+ ResourceSchema_AccessFlags: {
730
+ /**
731
+ * @description Deny-list approach: default = allowed (true)
732
+ * Controllers set these to false to restrict non-controller roles (role='u', role='w')
733
+ */
734
+ createResource: boolean; /** @description IMPORTANT: read_fields=false with write_fields=true is a forbidden combination */
735
+ readFields: boolean;
736
+ writeFields: boolean; /** @description IMPORTANT: read_kv=false with write_kv=true is a forbidden combination */
737
+ readKv: boolean;
738
+ writeKv: boolean;
739
+ /**
740
+ * @description Per-field-type overrides (map: field_type → bool)
741
+ * When defined for a field type, overrides resource-level flags
742
+ */
743
+ readByFieldType: {
744
+ [key: string]: boolean;
745
+ };
746
+ writeByFieldType: {
747
+ [key: string]: boolean;
748
+ };
595
749
  };
596
750
  ResourceType: {
597
751
  name: string;
@@ -600,6 +754,12 @@ interface components {
600
754
  Resource_Features: {
601
755
  ephemeral: boolean;
602
756
  };
757
+ RevokeGrant_Request: {
758
+ resourceId: string; /** Format: bytes */
759
+ resourceSignature: string;
760
+ targetUser: string;
761
+ };
762
+ RevokeGrant_Response: Record<string, never>;
603
763
  SetFeatures_Request: {
604
764
  features: components["schemas"]["ResourceAPIFeature"][];
605
765
  };
@@ -646,6 +806,37 @@ interface components {
646
806
  pathItems: never;
647
807
  }
648
808
  interface operations {
809
+ Platform_GrantAccess: {
810
+ parameters: {
811
+ query?: never;
812
+ header?: never;
813
+ path?: never;
814
+ cookie?: never;
815
+ };
816
+ requestBody: {
817
+ content: {
818
+ "application/json": components["schemas"]["GrantAccess_Request"];
819
+ };
820
+ };
821
+ responses: {
822
+ /** @description OK */200: {
823
+ headers: {
824
+ [name: string]: unknown;
825
+ };
826
+ content: {
827
+ "application/json": components["schemas"]["GrantAccess_Response"];
828
+ };
829
+ }; /** @description Default error response */
830
+ default: {
831
+ headers: {
832
+ [name: string]: unknown;
833
+ };
834
+ content: {
835
+ "application/json": components["schemas"]["Status"];
836
+ };
837
+ };
838
+ };
839
+ };
649
840
  Platform_GetJWTToken: {
650
841
  parameters: {
651
842
  query?: never;
@@ -704,6 +895,37 @@ interface operations {
704
895
  };
705
896
  };
706
897
  };
898
+ Platform_RevokeGrant: {
899
+ parameters: {
900
+ query?: never;
901
+ header?: never;
902
+ path?: never;
903
+ cookie?: never;
904
+ };
905
+ requestBody: {
906
+ content: {
907
+ "application/json": components["schemas"]["RevokeGrant_Request"];
908
+ };
909
+ };
910
+ responses: {
911
+ /** @description OK */200: {
912
+ headers: {
913
+ [name: string]: unknown;
914
+ };
915
+ content: {
916
+ "application/json": components["schemas"]["RevokeGrant_Response"];
917
+ };
918
+ }; /** @description Default error response */
919
+ default: {
920
+ headers: {
921
+ [name: string]: unknown;
922
+ };
923
+ content: {
924
+ "application/json": components["schemas"]["Status"];
925
+ };
926
+ };
927
+ };
928
+ };
707
929
  Platform_WriteControllerAliasesAndUrls: {
708
930
  parameters: {
709
931
  query?: never;
@@ -1134,7 +1356,7 @@ interface operations {
1134
1356
  };
1135
1357
  };
1136
1358
  };
1137
- Platform_UpdateLease: {
1359
+ Platform_LeaseResource: {
1138
1360
  parameters: {
1139
1361
  query?: never;
1140
1362
  header?: never;
@@ -1143,7 +1365,7 @@ interface operations {
1143
1365
  };
1144
1366
  requestBody: {
1145
1367
  content: {
1146
- "application/json": components["schemas"]["Update_Request"];
1368
+ "application/json": components["schemas"]["Create_Request"];
1147
1369
  };
1148
1370
  };
1149
1371
  responses: {
@@ -1152,7 +1374,7 @@ interface operations {
1152
1374
  [name: string]: unknown;
1153
1375
  };
1154
1376
  content: {
1155
- "application/json": components["schemas"]["Update_Response"];
1377
+ "application/json": components["schemas"]["Create_Response"];
1156
1378
  };
1157
1379
  }; /** @description Default error response */
1158
1380
  default: {
@@ -1165,7 +1387,7 @@ interface operations {
1165
1387
  };
1166
1388
  };
1167
1389
  };
1168
- Platform_LeaseResource: {
1390
+ Platform_ReleaseLease: {
1169
1391
  parameters: {
1170
1392
  query?: never;
1171
1393
  header?: never;
@@ -1174,7 +1396,7 @@ interface operations {
1174
1396
  };
1175
1397
  requestBody: {
1176
1398
  content: {
1177
- "application/json": components["schemas"]["Create_Request"];
1399
+ "application/json": components["schemas"]["Release_Request"];
1178
1400
  };
1179
1401
  };
1180
1402
  responses: {
@@ -1183,7 +1405,7 @@ interface operations {
1183
1405
  [name: string]: unknown;
1184
1406
  };
1185
1407
  content: {
1186
- "application/json": components["schemas"]["Create_Response"];
1408
+ "application/json": components["schemas"]["Release_Response"];
1187
1409
  };
1188
1410
  }; /** @description Default error response */
1189
1411
  default: {
@@ -1196,7 +1418,7 @@ interface operations {
1196
1418
  };
1197
1419
  };
1198
1420
  };
1199
- Platform_ReleaseLease: {
1421
+ Platform_UpdateLease: {
1200
1422
  parameters: {
1201
1423
  query?: never;
1202
1424
  header?: never;
@@ -1205,7 +1427,7 @@ interface operations {
1205
1427
  };
1206
1428
  requestBody: {
1207
1429
  content: {
1208
- "application/json": components["schemas"]["Release_Request"];
1430
+ "application/json": components["schemas"]["Update_Request"];
1209
1431
  };
1210
1432
  };
1211
1433
  responses: {
@@ -1214,7 +1436,38 @@ interface operations {
1214
1436
  [name: string]: unknown;
1215
1437
  };
1216
1438
  content: {
1217
- "application/json": components["schemas"]["Release_Response"];
1439
+ "application/json": components["schemas"]["Update_Response"];
1440
+ };
1441
+ }; /** @description Default error response */
1442
+ default: {
1443
+ headers: {
1444
+ [name: string]: unknown;
1445
+ };
1446
+ content: {
1447
+ "application/json": components["schemas"]["Status"];
1448
+ };
1449
+ };
1450
+ };
1451
+ };
1452
+ Platform_LockFieldValues: {
1453
+ parameters: {
1454
+ query?: never;
1455
+ header?: never;
1456
+ path?: never;
1457
+ cookie?: never;
1458
+ };
1459
+ requestBody: {
1460
+ content: {
1461
+ "application/json": components["schemas"]["Create_Request"];
1462
+ };
1463
+ };
1464
+ responses: {
1465
+ /** @description OK */200: {
1466
+ headers: {
1467
+ [name: string]: unknown;
1468
+ };
1469
+ content: {
1470
+ "application/json": components["schemas"]["Create_Response"];
1218
1471
  };
1219
1472
  }; /** @description Default error response */
1220
1473
  default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-client",
3
- "version": "2.18.4",
3
+ "version": "3.0.0",
4
4
  "description": "New TS/JS client for Platform API",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -31,8 +31,8 @@
31
31
  "utility-types": "^3.11.0",
32
32
  "yaml": "^2.8.0",
33
33
  "@milaboratories/pl-http": "1.2.4",
34
- "@milaboratories/pl-model-common": "1.31.0",
35
- "@milaboratories/ts-helpers": "1.8.0"
34
+ "@milaboratories/ts-helpers": "1.8.1",
35
+ "@milaboratories/pl-model-common": "1.31.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@protobuf-ts/plugin": "2.11.1",
@@ -41,8 +41,8 @@
41
41
  "openapi-typescript": "^7.10.0",
42
42
  "typescript": "~5.9.3",
43
43
  "vitest": "^4.0.18",
44
- "@milaboratories/ts-builder": "1.3.0",
45
44
  "@milaboratories/build-configs": "1.5.2",
45
+ "@milaboratories/ts-builder": "1.3.0",
46
46
  "@milaboratories/ts-configs": "1.2.2"
47
47
  },
48
48
  "engines": {
@@ -25,6 +25,7 @@ import { defaultHttpDispatcher } from "@milaboratories/pl-http";
25
25
  import type { WireClientProvider, WireClientProviderFactory, WireConnection } from "./wire";
26
26
  import { parseHttpAuth } from "@milaboratories/pl-model-common";
27
27
  import type * as grpcTypes from "../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api";
28
+ import { AuthAPI_GetJWTToken_Role } from "../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api";
28
29
  import {
29
30
  type PlApiPaths,
30
31
  type PlRestClientType,
@@ -470,13 +471,19 @@ export class LLPlClient implements WireClientProviderFactory {
470
471
  const meta: Record<string, string> = {};
471
472
  if (options?.authorization) meta.authorization = options.authorization;
472
473
  return (
473
- await cl.getJWTToken({ expiration: { seconds: ttlSeconds, nanos: 0 } }, { meta }).response
474
+ await cl.getJWTToken(
475
+ {
476
+ expiration: { seconds: ttlSeconds, nanos: 0 },
477
+ requestedRole: AuthAPI_GetJWTToken_Role.USER,
478
+ },
479
+ { meta },
480
+ ).response
474
481
  ).token;
475
482
  } else {
476
483
  const headers: Record<string, string> = {};
477
484
  if (options?.authorization) headers.authorization = options.authorization;
478
485
  const resp = cl.POST("/v1/auth/jwt-token", {
479
- body: { expiration: `${ttlSeconds}s` },
486
+ body: { expiration: `${ttlSeconds}s`, requestedRole: AuthAPI_GetJWTToken_Role.USER },
480
487
  headers,
481
488
  });
482
489
  return notEmpty((await resp).data, "REST: empty response for JWT token request").token;
@@ -518,12 +518,18 @@ export class PlTransaction {
518
518
  }
519
519
 
520
520
  public removeResource(rId: ResourceId): void {
521
- this.sendVoidAsync({ oneofKind: "resourceRemove", resourceRemove: { id: rId } });
521
+ this.sendVoidAsync({
522
+ oneofKind: "resourceRemove",
523
+ resourceRemove: { resourceId: rId },
524
+ });
522
525
  }
523
526
 
524
527
  public resourceExists(rId: ResourceId): Promise<boolean> {
525
528
  return this.sendSingleAndParse(
526
- { oneofKind: "resourceExists", resourceExists: { resourceId: rId } },
529
+ {
530
+ oneofKind: "resourceExists",
531
+ resourceExists: { resourceId: rId },
532
+ },
527
533
  (r) => r.resourceExists.exists,
528
534
  );
529
535
  }
@@ -581,7 +587,10 @@ export class PlTransaction {
581
587
  const result = await this.sendSingleAndParse(
582
588
  {
583
589
  oneofKind: "resourceGet",
584
- resourceGet: { resourceId: toResourceId(rId), loadFields: loadFields },
590
+ resourceGet: {
591
+ resourceId: toResourceId(rId),
592
+ loadFields: loadFields,
593
+ },
585
594
  },
586
595
  (r) => protoToResource(notEmpty(r.resourceGet.resource)),
587
596
  );
@@ -689,7 +698,10 @@ export class PlTransaction {
689
698
  public setResourceError(rId: AnyResourceRef, ref: AnyResourceRef): void {
690
699
  this.sendVoidAsync({
691
700
  oneofKind: "resourceSetError",
692
- resourceSetError: { resourceId: toResourceId(rId), errorResourceId: toResourceId(ref) },
701
+ resourceSetError: {
702
+ resourceId: toResourceId(rId),
703
+ errorResourceId: toResourceId(ref),
704
+ },
693
705
  });
694
706
  }
695
707
 
@@ -743,7 +755,10 @@ export class PlTransaction {
743
755
  this._stat.fieldsSet++;
744
756
  this.sendVoidAsync({
745
757
  oneofKind: "fieldSetError",
746
- fieldSetError: { field: toFieldId(fId), errResourceId: toResourceId(ref) },
758
+ fieldSetError: {
759
+ field: toFieldId(fId),
760
+ errorResourceId: toResourceId(ref),
761
+ },
747
762
  });
748
763
  }
749
764
 
@@ -776,7 +791,11 @@ export class PlTransaction {
776
791
  const result = await this.sendMultiAndParse(
777
792
  {
778
793
  oneofKind: "resourceKeyValueList",
779
- resourceKeyValueList: { resourceId: toResourceId(rId), startFrom: "", limit: 0 },
794
+ resourceKeyValueList: {
795
+ resourceId: toResourceId(rId),
796
+ startFrom: "",
797
+ limit: 0,
798
+ },
780
799
  },
781
800
  (r) => r.map((e) => e.resourceKeyValueList.record!),
782
801
  );
@@ -836,7 +855,10 @@ export class PlTransaction {
836
855
  const result = await this.sendSingleAndParse(
837
856
  {
838
857
  oneofKind: "resourceKeyValueGet",
839
- resourceKeyValueGet: { resourceId: toResourceId(rId), key },
858
+ resourceKeyValueGet: {
859
+ resourceId: toResourceId(rId),
860
+ key,
861
+ },
840
862
  },
841
863
  (r) => r.resourceKeyValueGet.value,
842
864
  );
@@ -864,7 +886,10 @@ export class PlTransaction {
864
886
  const result = await this.sendSingleAndParse(
865
887
  {
866
888
  oneofKind: "resourceKeyValueGetIfExists",
867
- resourceKeyValueGetIfExists: { resourceId: toResourceId(rId), key },
889
+ resourceKeyValueGetIfExists: {
890
+ resourceId: toResourceId(rId),
891
+ key,
892
+ },
868
893
  },
869
894
  (r) =>
870
895
  r.resourceKeyValueGetIfExists.exists ? r.resourceKeyValueGetIfExists.value : undefined,
@@ -30,7 +30,7 @@ function resourceIsDeleted(proto: Resource): boolean {
30
30
  export function protoToResource(proto: Resource): ResourceData {
31
31
  if (resourceIsDeleted(proto)) throwPlNotFoundError("resource deleted");
32
32
  return {
33
- id: proto.id as ResourceId,
33
+ id: proto.resourceId as ResourceId,
34
34
  originalResourceId: proto.originalResourceId as OptionalResourceId,
35
35
  type: notEmpty(proto.type),
36
36
  data: proto.data,