@milaboratories/pl-client 3.7.0 → 3.8.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.
Files changed (79) hide show
  1. package/dist/core/capabilities.cjs +9 -0
  2. package/dist/core/capabilities.cjs.map +1 -0
  3. package/dist/core/capabilities.d.ts +24 -0
  4. package/dist/core/capabilities.d.ts.map +1 -0
  5. package/dist/core/capabilities.js +9 -0
  6. package/dist/core/capabilities.js.map +1 -0
  7. package/dist/core/client.cjs +7 -25
  8. package/dist/core/client.cjs.map +1 -1
  9. package/dist/core/client.d.ts +2 -3
  10. package/dist/core/client.d.ts.map +1 -1
  11. package/dist/core/client.js +7 -25
  12. package/dist/core/client.js.map +1 -1
  13. package/dist/core/ll_client.cjs +153 -7
  14. package/dist/core/ll_client.cjs.map +1 -1
  15. package/dist/core/ll_client.d.ts +26 -0
  16. package/dist/core/ll_client.d.ts.map +1 -1
  17. package/dist/core/ll_client.js +153 -7
  18. package/dist/core/ll_client.js.map +1 -1
  19. package/dist/core/transaction.cjs +4 -2
  20. package/dist/core/transaction.cjs.map +1 -1
  21. package/dist/core/transaction.d.ts.map +1 -1
  22. package/dist/core/transaction.js +4 -2
  23. package/dist/core/transaction.js.map +1 -1
  24. package/dist/core/unauth_client.cjs +33 -1
  25. package/dist/core/unauth_client.cjs.map +1 -1
  26. package/dist/core/unauth_client.d.ts +19 -0
  27. package/dist/core/unauth_client.d.ts.map +1 -1
  28. package/dist/core/unauth_client.js +33 -1
  29. package/dist/core/unauth_client.js.map +1 -1
  30. package/dist/index.cjs +2 -0
  31. package/dist/index.d.ts +2 -1
  32. package/dist/index.js +2 -1
  33. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.cjs.map +1 -1
  34. package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.js.map +1 -1
  35. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +1101 -135
  36. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -1
  37. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +49 -10
  38. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -1
  39. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +61 -1
  40. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -1
  41. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +49 -10
  42. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -1
  43. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +414 -12
  44. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
  45. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js +1101 -135
  46. package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -1
  47. package/dist/proto-grpc/google/protobuf/timestamp.cjs.map +1 -1
  48. package/dist/proto-grpc/google/protobuf/timestamp.d.ts +8 -9
  49. package/dist/proto-grpc/google/protobuf/timestamp.d.ts.map +1 -1
  50. package/dist/proto-grpc/google/protobuf/timestamp.js.map +1 -1
  51. package/dist/proto-grpc/google/rpc/code.cjs.map +1 -1
  52. package/dist/proto-grpc/google/rpc/code.js.map +1 -1
  53. package/dist/proto-rest/plapi.d.ts +247 -12
  54. package/dist/proto-rest/plapi.d.ts.map +1 -1
  55. package/dist/util/pl.cjs.map +1 -1
  56. package/dist/util/pl.js.map +1 -1
  57. package/package.json +4 -4
  58. package/src/core/capabilities.ts +26 -0
  59. package/src/core/client.ts +11 -29
  60. package/src/core/ll_client.test.ts +16 -3
  61. package/src/core/ll_client.ts +187 -8
  62. package/src/core/ll_transaction.test.ts +15 -9
  63. package/src/core/transaction.ts +2 -0
  64. package/src/core/unauth_client.ts +42 -3
  65. package/src/core/unauth_client_branch.test.ts +69 -0
  66. package/src/index.ts +1 -0
  67. package/src/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.ts +1 -1
  68. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +85 -10
  69. package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.ts +1313 -101
  70. package/src/proto-grpc/google/api/http.ts +1 -1
  71. package/src/proto-grpc/google/protobuf/descriptor.ts +7 -240
  72. package/src/proto-grpc/google/protobuf/timestamp.ts +8 -9
  73. package/src/proto-grpc/google/protobuf/wrappers.ts +4 -38
  74. package/src/proto-grpc/google/rpc/code.ts +1 -1
  75. package/src/proto-grpc/google/rpc/error_details.ts +5 -5
  76. package/src/proto-grpc/google/rpc/http.ts +1 -1
  77. package/src/proto-grpc/google/rpc/status.ts +1 -1
  78. package/src/proto-rest/plapi.ts +263 -12
  79. package/src/util/pl.ts +5 -0
@@ -2,7 +2,7 @@
2
2
  // @generated from protobuf file "google/rpc/error_details.proto" (package "google.rpc", syntax proto3)
3
3
  // tslint:disable
4
4
  //
5
- // Copyright 2026 Google LLC
5
+ // Copyright 2025 Google LLC
6
6
  //
7
7
  // Licensed under the Apache License, Version 2.0 (the "License");
8
8
  // you may not use this file except in compliance with the License.
@@ -368,17 +368,17 @@ export interface BadRequest_FieldViolation {
368
368
  * In this example, in proto `field` could take one of the following values:
369
369
  *
370
370
  * * `full_name` for a violation in the `full_name` value
371
- * * `email_addresses[0].email` for a violation in the `email` field of the
371
+ * * `email_addresses[1].email` for a violation in the `email` field of the
372
372
  * first `email_addresses` message
373
- * * `email_addresses[2].type[1]` for a violation in the second `type`
373
+ * * `email_addresses[3].type[2]` for a violation in the second `type`
374
374
  * value in the third `email_addresses` message.
375
375
  *
376
376
  * In JSON, the same values are represented as:
377
377
  *
378
378
  * * `fullName` for a violation in the `fullName` value
379
- * * `emailAddresses[0].email` for a violation in the `email` field of the
379
+ * * `emailAddresses[1].email` for a violation in the `email` field of the
380
380
  * first `emailAddresses` message
381
- * * `emailAddresses[2].type[1]` for a violation in the second `type`
381
+ * * `emailAddresses[3].type[2]` for a violation in the second `type`
382
382
  * value in the third `emailAddresses` message.
383
383
  *
384
384
  * @generated from protobuf field: string field = 1
@@ -2,7 +2,7 @@
2
2
  // @generated from protobuf file "google/rpc/http.proto" (package "google.rpc", syntax proto3)
3
3
  // tslint:disable
4
4
  //
5
- // Copyright 2026 Google LLC
5
+ // Copyright 2025 Google LLC
6
6
  //
7
7
  // Licensed under the Apache License, Version 2.0 (the "License");
8
8
  // you may not use this file except in compliance with the License.
@@ -2,7 +2,7 @@
2
2
  // @generated from protobuf file "google/rpc/status.proto" (package "google.rpc", syntax proto3)
3
3
  // tslint:disable
4
4
  //
5
- // Copyright 2026 Google LLC
5
+ // Copyright 2025 Google LLC
6
6
  //
7
7
  // Licensed under the Apache License, Version 2.0 (the "License");
8
8
  // you may not use this file except in compliance with the License.
@@ -29,6 +29,11 @@ export interface paths {
29
29
  };
30
30
  get?: never;
31
31
  put?: never;
32
+ /**
33
+ * @description Deprecated: Use Login for session creation and role transitions,
34
+ * and RefreshToken for token renewal. Backends implementing this API always return
35
+ * codes.Unimplemented. Kept here so clients can still call old backends.
36
+ */
32
37
  post: operations["Platform_GetJWTToken"];
33
38
  delete?: never;
34
39
  options?: never;
@@ -36,6 +41,27 @@ export interface paths {
36
41
  patch?: never;
37
42
  trace?: never;
38
43
  };
44
+ "/v1/auth/login": {
45
+ parameters: {
46
+ query?: never;
47
+ header?: never;
48
+ path?: never;
49
+ cookie?: never;
50
+ };
51
+ get?: never;
52
+ put?: never;
53
+ /**
54
+ * @description Login authenticates with the given credentials and returns a new Platforma JWT.
55
+ * Every Login call creates a new session. Use RefreshToken to renew an existing one.
56
+ * This method is public: no Authorization header is required.
57
+ */
58
+ post: operations["Platform_Login"];
59
+ delete?: never;
60
+ options?: never;
61
+ head?: never;
62
+ patch?: never;
63
+ trace?: never;
64
+ };
39
65
  "/v1/auth/methods": {
40
66
  parameters: {
41
67
  query?: never;
@@ -74,6 +100,28 @@ export interface paths {
74
100
  patch?: never;
75
101
  trace?: never;
76
102
  };
103
+ "/v1/auth/refresh": {
104
+ parameters: {
105
+ query?: never;
106
+ header?: never;
107
+ path?: never;
108
+ cookie?: never;
109
+ };
110
+ get?: never;
111
+ put?: never;
112
+ /**
113
+ * @description RefreshToken accepts a valid Platforma JWT and re-issues it with the same
114
+ * session ID and role. Only the token expiration may be changed.
115
+ * Workflow-scoped tokens cannot be refreshed; call Login instead.
116
+ * This method is public: no Authorization header is required.
117
+ */
118
+ post: operations["Platform_RefreshToken"];
119
+ delete?: never;
120
+ options?: never;
121
+ head?: never;
122
+ patch?: never;
123
+ trace?: never;
124
+ };
77
125
  "/v1/auth/revoke-access": {
78
126
  parameters: {
79
127
  query?: never;
@@ -106,6 +154,27 @@ export interface paths {
106
154
  patch?: never;
107
155
  trace?: never;
108
156
  };
157
+ "/v1/auth/sso/begin-login": {
158
+ parameters: {
159
+ query?: never;
160
+ header?: never;
161
+ path?: never;
162
+ cookie?: never;
163
+ };
164
+ get?: never;
165
+ put?: never;
166
+ /**
167
+ * @description BeginSSOLogin returns a fresh one-time nonce that the desktop must place
168
+ * into the OIDC auth-request before redirecting to the IdP. Used by the SSO
169
+ * login flow. This method is public: no Authorization header is required.
170
+ */
171
+ post: operations["Platform_BeginSSOLogin"];
172
+ delete?: never;
173
+ options?: never;
174
+ head?: never;
175
+ patch?: never;
176
+ trace?: never;
177
+ };
109
178
  "/v1/auth/user-root": {
110
179
  parameters: {
111
180
  query?: never;
@@ -503,6 +572,15 @@ export interface paths {
503
572
  export type webhooks = Record<string, never>;
504
573
  export interface components {
505
574
  schemas: {
575
+ AuthAPI_BeginSSOLogin_PublicPKCE: {
576
+ nonce: string;
577
+ /** Format: date-time */
578
+ expiresAt: string;
579
+ };
580
+ AuthAPI_BeginSSOLogin_Request: Record<string, never>;
581
+ AuthAPI_BeginSSOLogin_Response: {
582
+ publicPkce: components["schemas"]["AuthAPI_BeginSSOLogin_PublicPKCE"];
583
+ };
506
584
  AuthAPI_GetJWTToken_Request: {
507
585
  expiration: string;
508
586
  /** Format: enum */
@@ -546,16 +624,76 @@ export interface components {
546
624
  AuthAPI_Grant_Permissions: {
547
625
  writable: boolean;
548
626
  };
627
+ AuthAPI_ListMethods_BasicAuthMethod: Record<string, never>;
549
628
  AuthAPI_ListMethods_MethodInfo: {
550
- type: string;
551
- name: string;
552
- info: {
553
- [key: string]: string;
554
- };
629
+ /**
630
+ * @description id is the stable, machine-readable identifier of the login method
631
+ * instance. Unique across the entire server.
632
+ */
633
+ id: string;
634
+ /** @description description is the human-readable label in case we'd like to render it in UI. */
635
+ description: string;
636
+ basic: components["schemas"]["AuthAPI_ListMethods_BasicAuthMethod"];
637
+ token: components["schemas"]["AuthAPI_ListMethods_TokenAuthMethod"];
638
+ sso: components["schemas"]["AuthAPI_ListMethods_SSOAuthMethod"];
555
639
  };
556
640
  AuthAPI_ListMethods_Response: {
557
641
  methods: components["schemas"]["AuthAPI_ListMethods_MethodInfo"][];
558
642
  };
643
+ /**
644
+ * @description SSOAuthMethod advertises an external IdP-based login flow. The desktop
645
+ * app uses the contents to drive the PKCE exchange locally, then hands the
646
+ * resulting IdP token-response back via Login.SSOCredentials.
647
+ */
648
+ AuthAPI_ListMethods_SSOAuthMethod: {
649
+ issuer: string;
650
+ clientId: string;
651
+ scopes: string;
652
+ resource: string;
653
+ prompt: string;
654
+ redirectPorts: number[];
655
+ subjectTokenSource: string;
656
+ userIdClaim: string;
657
+ groupsClaim: string;
658
+ /** Format: enum */
659
+ flowType: number;
660
+ };
661
+ AuthAPI_ListMethods_TokenAuthMethod: Record<string, never>;
662
+ AuthAPI_Login_BasicCredentials: {
663
+ login: string;
664
+ password: string;
665
+ };
666
+ AuthAPI_Login_Request: {
667
+ basic: components["schemas"]["AuthAPI_Login_BasicCredentials"];
668
+ token: components["schemas"]["AuthAPI_Login_TokenCredentials"];
669
+ sso: components["schemas"]["AuthAPI_Login_SSOCredentials"];
670
+ expiration: string;
671
+ /** Format: enum */
672
+ requestedRole: number;
673
+ };
674
+ AuthAPI_Login_Response: {
675
+ token: string;
676
+ /** Format: bytes */
677
+ sessionId: string;
678
+ /** Format: enum */
679
+ role: number;
680
+ };
681
+ /**
682
+ * @description SSOCredentials carries the raw JSON body returned by the IdP's /token
683
+ * endpoint after the desktop completes a PKCE exchange.
684
+ */
685
+ AuthAPI_Login_SSOCredentials: {
686
+ /** Format: bytes */
687
+ tokenResponse: string;
688
+ };
689
+ /**
690
+ * @description TokenCredentials accepts any opaque bearer-style string: a controller
691
+ * pre-shared secret, an existing Platforma JWT, or a future OIDC id-token.
692
+ */
693
+ AuthAPI_Login_TokenCredentials: {
694
+ /** Format: bytes */
695
+ token: string;
696
+ };
559
697
  AuthAPI_MintSignature_Request: {
560
698
  resourceId: string;
561
699
  /** Format: bytes */
@@ -567,6 +705,17 @@ export interface components {
567
705
  /** Format: bytes */
568
706
  resourceSignature: string;
569
707
  };
708
+ AuthAPI_RefreshToken_Request: {
709
+ token: string;
710
+ expiration: string;
711
+ };
712
+ AuthAPI_RefreshToken_Response: {
713
+ token: string;
714
+ /** Format: bytes */
715
+ sessionId: string;
716
+ /** Format: enum */
717
+ role: number;
718
+ };
570
719
  AuthAPI_RevokeAccess_Request: {
571
720
  resourceId: string;
572
721
  /** Format: bytes */
@@ -808,13 +957,16 @@ export interface components {
808
957
  os: string;
809
958
  arch: string;
810
959
  /**
811
- * @description Opt-in capabilities advertised by this server instance.
812
- * Tokens follow the "<feature>:<version>" format
813
- * (e.g. "treeFilter:v1", "wasm:v1"); current set:
814
- * see pl/platform/api/plapiserver/server_capabilities.go.
815
- * Block manifests declare what they need via
816
- * meta.requiredCapabilities; Desktop matches against this list
817
- * at install time.
960
+ * @description Opt-in capabilities advertised by this server instance, used by
961
+ * clients to pick between fast and fallback code paths without waiting
962
+ * for a failed RPC.
963
+ *
964
+ * Each entry is an opaque token "<feature>:<version>" (e.g.
965
+ * "loadSubtree:v1"). Unrecognized tokens are ignored by the client.
966
+ * The field is unset on servers predating this mechanism, which the
967
+ * client treats as "no optional capabilities advertised".
968
+ *
969
+ * All list see pl/platform/api/plapiserver/server_capabilities.go
818
970
  */
819
971
  capabilities: string[];
820
972
  };
@@ -1047,6 +1199,39 @@ export interface operations {
1047
1199
  };
1048
1200
  };
1049
1201
  };
1202
+ Platform_Login: {
1203
+ parameters: {
1204
+ query?: never;
1205
+ header?: never;
1206
+ path?: never;
1207
+ cookie?: never;
1208
+ };
1209
+ requestBody: {
1210
+ content: {
1211
+ "application/json": components["schemas"]["AuthAPI_Login_Request"];
1212
+ };
1213
+ };
1214
+ responses: {
1215
+ /** @description OK */
1216
+ 200: {
1217
+ headers: {
1218
+ [name: string]: unknown;
1219
+ };
1220
+ content: {
1221
+ "application/json": components["schemas"]["AuthAPI_Login_Response"];
1222
+ };
1223
+ };
1224
+ /** @description Default error response */
1225
+ default: {
1226
+ headers: {
1227
+ [name: string]: unknown;
1228
+ };
1229
+ content: {
1230
+ "application/json": components["schemas"]["Status"];
1231
+ };
1232
+ };
1233
+ };
1234
+ };
1050
1235
  Platform_AuthMethods: {
1051
1236
  parameters: {
1052
1237
  query?: never;
@@ -1109,6 +1294,39 @@ export interface operations {
1109
1294
  };
1110
1295
  };
1111
1296
  };
1297
+ Platform_RefreshToken: {
1298
+ parameters: {
1299
+ query?: never;
1300
+ header?: never;
1301
+ path?: never;
1302
+ cookie?: never;
1303
+ };
1304
+ requestBody: {
1305
+ content: {
1306
+ "application/json": components["schemas"]["AuthAPI_RefreshToken_Request"];
1307
+ };
1308
+ };
1309
+ responses: {
1310
+ /** @description OK */
1311
+ 200: {
1312
+ headers: {
1313
+ [name: string]: unknown;
1314
+ };
1315
+ content: {
1316
+ "application/json": components["schemas"]["AuthAPI_RefreshToken_Response"];
1317
+ };
1318
+ };
1319
+ /** @description Default error response */
1320
+ default: {
1321
+ headers: {
1322
+ [name: string]: unknown;
1323
+ };
1324
+ content: {
1325
+ "application/json": components["schemas"]["Status"];
1326
+ };
1327
+ };
1328
+ };
1329
+ };
1112
1330
  Platform_RevokeAccess: {
1113
1331
  parameters: {
1114
1332
  query?: never;
@@ -1175,6 +1393,39 @@ export interface operations {
1175
1393
  };
1176
1394
  };
1177
1395
  };
1396
+ Platform_BeginSSOLogin: {
1397
+ parameters: {
1398
+ query?: never;
1399
+ header?: never;
1400
+ path?: never;
1401
+ cookie?: never;
1402
+ };
1403
+ requestBody: {
1404
+ content: {
1405
+ "application/json": components["schemas"]["AuthAPI_BeginSSOLogin_Request"];
1406
+ };
1407
+ };
1408
+ responses: {
1409
+ /** @description OK */
1410
+ 200: {
1411
+ headers: {
1412
+ [name: string]: unknown;
1413
+ };
1414
+ content: {
1415
+ "application/json": components["schemas"]["AuthAPI_BeginSSOLogin_Response"];
1416
+ };
1417
+ };
1418
+ /** @description Default error response */
1419
+ default: {
1420
+ headers: {
1421
+ [name: string]: unknown;
1422
+ };
1423
+ content: {
1424
+ "application/json": components["schemas"]["Status"];
1425
+ };
1426
+ };
1427
+ };
1428
+ };
1178
1429
  Platform_GetUserRoot: {
1179
1430
  parameters: {
1180
1431
  query?: never;
package/src/util/pl.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  export type PlJWTPayload = {
2
+ sub: string; // user ID
3
+ iss: string; // backend instance ID
4
+
5
+ // deprecated. Prior backend capability auth:v2. Use uid instead.
2
6
  user: {
3
7
  login: string;
4
8
  };
9
+
5
10
  exp: number;
6
11
  iat: number;
7
12
  };