@conduitplatform/grpc-sdk 0.17.0-alpha.7 → 0.17.0-alpha.9

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/index.cjs CHANGED
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  ColumnExistenceResponse: () => ColumnExistenceResponse,
53
53
  Communications: () => Communications,
54
54
  CommunicationsDefinition: () => CommunicationsDefinition,
55
+ CompatibleIndexType: () => CompatibleIndexType,
55
56
  ConduitAuthorizedResource: () => ConduitAuthorizedResource,
56
57
  ConduitError: () => ConduitError,
57
58
  ConduitGrpcSdk: () => ConduitGrpcSdk,
@@ -85,6 +86,7 @@ __export(index_exports, {
85
86
  DeleteEmbeddingConfigRequest: () => DeleteEmbeddingConfigRequest,
86
87
  DeleteEmbeddingConfigResponse: () => DeleteEmbeddingConfigResponse,
87
88
  DeleteFileResponse: () => DeleteFileResponse,
89
+ DeleteMessageRequest: () => DeleteMessageRequest,
88
90
  DeleteResourceRequest: () => DeleteResourceRequest,
89
91
  DeleteRoomRequest: () => DeleteRoomRequest,
90
92
  DeleteVectorIndexRequest: () => DeleteVectorIndexRequest,
@@ -127,6 +129,7 @@ __export(index_exports, {
127
129
  GetMessageStatusResponse: () => GetMessageStatusResponse,
128
130
  GetNotificationTokensRequest: () => GetNotificationTokensRequest,
129
131
  GetNotificationTokensResponse: () => GetNotificationTokensResponse,
132
+ GetRealmSettingsRequest: () => GetRealmSettingsRequest,
130
133
  GetRedisDetailsResponse: () => GetRedisDetailsResponse,
131
134
  GetRoomResponse: () => GetRoomResponse,
132
135
  GetSchemaRequest: () => GetSchemaRequest,
@@ -135,6 +138,8 @@ __export(index_exports, {
135
138
  GetStatusRequest: () => GetStatusRequest,
136
139
  GetStatusResponse: () => GetStatusResponse,
137
140
  GetTeamRequest: () => GetTeamRequest,
141
+ GetUserRequest: () => GetUserRequest,
142
+ GetUserResponse: () => GetUserResponse,
138
143
  GrpcError: () => GrpcError,
139
144
  HealthCheckRequest: () => HealthCheckRequest,
140
145
  HealthCheckResponse: () => HealthCheckResponse,
@@ -175,6 +180,8 @@ __export(index_exports, {
175
180
  RawQueryRequest_RawQuery: () => RawQueryRequest_RawQuery,
176
181
  RawQueryRequest_RawQuery_MongoQuery: () => RawQueryRequest_RawQuery_MongoQuery,
177
182
  RawQueryRequest_RawQuery_SQLQuery: () => RawQueryRequest_RawQuery_SQLQuery,
183
+ RealmMembershipRequest: () => RealmMembershipRequest,
184
+ RealmResponse: () => RealmResponse,
178
185
  RegisterAdminRouteRequest: () => RegisterAdminRouteRequest,
179
186
  RegisterAdminRouteRequest_ConduitRouteOptions: () => RegisterAdminRouteRequest_ConduitRouteOptions,
180
187
  RegisterAdminRouteRequest_ConduitRouteReturnDefinition: () => RegisterAdminRouteRequest_ConduitRouteReturnDefinition,
@@ -212,6 +219,7 @@ __export(index_exports, {
212
219
  Room: () => Room,
213
220
  Router: () => Router,
214
221
  RouterDefinition: () => RouterDefinition,
222
+ SESSION_REGISTRY_PREFIX: () => SESSION_REGISTRY_PREFIX,
215
223
  SMS: () => SMS,
216
224
  SQLDataType: () => SQLDataType,
217
225
  Schema: () => Schema,
@@ -243,21 +251,31 @@ __export(index_exports, {
243
251
  SendWithFallbackRequest_SendCommunicationParams: () => SendWithFallbackRequest_SendCommunicationParams,
244
252
  SendWithFallbackResponse: () => SendWithFallbackResponse,
245
253
  SendWithFallbackResponse_ChannelResult: () => SendWithFallbackResponse_ChannelResult,
254
+ SessionRegistry: () => SessionRegistry,
246
255
  SetConfigRequest: () => SetConfigRequest,
247
256
  SetConfigResponse: () => SetConfigResponse,
248
257
  SetNotificationTokenRequest: () => SetNotificationTokenRequest,
249
258
  SetNotificationTokenResponse: () => SetNotificationTokenResponse,
259
+ SetTeamRealmRequest: () => SetTeamRealmRequest,
250
260
  SocketData: () => SocketData,
261
+ SocketPushRequest: () => SocketPushRequest,
251
262
  SocketRequest: () => SocketRequest,
252
263
  SocketResponse: () => SocketResponse,
253
264
  StartBackfillRequest: () => StartBackfillRequest,
254
265
  StartBackfillResponse: () => StartBackfillResponse,
255
266
  Storage: () => Storage,
256
267
  StorageDefinition: () => StorageDefinition,
268
+ SubjectPermission: () => SubjectPermission,
269
+ SubjectPermissionsRequest: () => SubjectPermissionsRequest,
270
+ SubjectPermissionsResponse: () => SubjectPermissionsResponse,
257
271
  TYPE: () => TYPE,
258
272
  Team: () => Team,
259
273
  TeamDeleteRequest: () => TeamDeleteRequest,
260
274
  TeamDeleteResponse: () => TeamDeleteResponse,
275
+ USER_CACHE_PREFIX: () => USER_CACHE_PREFIX,
276
+ USER_CACHE_TTL_MS: () => USER_CACHE_TTL_MS,
277
+ UnsetTeamRealmRequest: () => UnsetTeamRealmRequest,
278
+ UnsetTeamRealmResponse: () => UnsetTeamRealmResponse,
261
279
  UpdateCommunicationTemplateRequest: () => UpdateCommunicationTemplateRequest,
262
280
  UpdateConfigRequest: () => UpdateConfigRequest,
263
281
  UpdateConfigResponse: () => UpdateConfigResponse,
@@ -269,6 +287,9 @@ __export(index_exports, {
269
287
  UpdateTemplateRequest: () => UpdateTemplateRequest,
270
288
  UpsertConfigRequest: () => UpsertConfigRequest,
271
289
  UpsertConfigResponse: () => UpsertConfigResponse,
290
+ UserCache: () => UserCache,
291
+ UserChangeEmail: () => UserChangeEmail,
292
+ UserChangeEmailResponse: () => UserChangeEmailResponse,
272
293
  UserChangePass: () => UserChangePass,
273
294
  UserCreateByUsernameRequest: () => UserCreateByUsernameRequest,
274
295
  UserCreateRequest: () => UserCreateRequest,
@@ -311,11 +332,11 @@ var ConduitError = class _ConduitError extends Error {
311
332
  message;
312
333
  name;
313
334
  status;
314
- constructor(name, status2, message) {
335
+ constructor(name, status3, message) {
315
336
  super(message);
316
337
  this.name = name;
317
338
  this.message = message;
318
- this.status = status2;
339
+ this.status = status3;
319
340
  }
320
341
  static unauthorized(message = "Unauthorized") {
321
342
  return new _ConduitError("UNAUTHORIZED", 401, message);
@@ -459,7 +480,7 @@ function validateAccessTokenResponse_StatusToJSON(object) {
459
480
  }
460
481
  }
461
482
  function createBaseUserLoginRequest() {
462
- return { userId: "", clientId: "" };
483
+ return { userId: "", clientId: "", realm: void 0 };
463
484
  }
464
485
  var UserLoginRequest = {
465
486
  encode(message, writer = new import_wire2.BinaryWriter()) {
@@ -469,6 +490,9 @@ var UserLoginRequest = {
469
490
  if (message.clientId !== "") {
470
491
  writer.uint32(18).string(message.clientId);
471
492
  }
493
+ if (message.realm !== void 0) {
494
+ writer.uint32(26).string(message.realm);
495
+ }
472
496
  return writer;
473
497
  },
474
498
  decode(input, length) {
@@ -498,6 +522,13 @@ var UserLoginRequest = {
498
522
  message.clientId = reader.string();
499
523
  continue;
500
524
  }
525
+ case 3: {
526
+ if (tag !== 26) {
527
+ break;
528
+ }
529
+ message.realm = reader.string();
530
+ continue;
531
+ }
501
532
  }
502
533
  if ((tag & 7) === 4 || tag === 0) {
503
534
  break;
@@ -512,7 +543,8 @@ var UserLoginRequest = {
512
543
  fromJSON(object) {
513
544
  return {
514
545
  userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
515
- clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : ""
546
+ clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "",
547
+ realm: isSet(object.realm) ? globalThis.String(object.realm) : void 0
516
548
  };
517
549
  },
518
550
  toJSON(message) {
@@ -523,6 +555,9 @@ var UserLoginRequest = {
523
555
  if (message.clientId !== "") {
524
556
  obj.clientId = message.clientId;
525
557
  }
558
+ if (message.realm !== void 0) {
559
+ obj.realm = message.realm;
560
+ }
526
561
  return obj;
527
562
  },
528
563
  create(base) {
@@ -532,11 +567,19 @@ var UserLoginRequest = {
532
567
  const message = createBaseUserLoginRequest();
533
568
  message.userId = object.userId ?? "";
534
569
  message.clientId = object.clientId ?? "";
570
+ message.realm = object.realm ?? void 0;
535
571
  return message;
536
572
  }
537
573
  };
538
574
  function createBaseUserCreateRequest() {
539
- return { email: "", password: void 0, verify: false, anonymousId: void 0, userData: void 0 };
575
+ return {
576
+ email: "",
577
+ password: void 0,
578
+ verify: false,
579
+ anonymousId: void 0,
580
+ userData: void 0,
581
+ realm: void 0
582
+ };
540
583
  }
541
584
  var UserCreateRequest = {
542
585
  encode(message, writer = new import_wire2.BinaryWriter()) {
@@ -555,6 +598,9 @@ var UserCreateRequest = {
555
598
  if (message.userData !== void 0) {
556
599
  writer.uint32(42).string(message.userData);
557
600
  }
601
+ if (message.realm !== void 0) {
602
+ writer.uint32(50).string(message.realm);
603
+ }
558
604
  return writer;
559
605
  },
560
606
  decode(input, length) {
@@ -605,6 +651,13 @@ var UserCreateRequest = {
605
651
  message.userData = reader.string();
606
652
  continue;
607
653
  }
654
+ case 6: {
655
+ if (tag !== 50) {
656
+ break;
657
+ }
658
+ message.realm = reader.string();
659
+ continue;
660
+ }
608
661
  }
609
662
  if ((tag & 7) === 4 || tag === 0) {
610
663
  break;
@@ -622,7 +675,8 @@ var UserCreateRequest = {
622
675
  password: isSet(object.password) ? globalThis.String(object.password) : void 0,
623
676
  verify: isSet(object.verify) ? globalThis.Boolean(object.verify) : false,
624
677
  anonymousId: isSet(object.anonymousId) ? globalThis.String(object.anonymousId) : void 0,
625
- userData: isSet(object.userData) ? globalThis.String(object.userData) : void 0
678
+ userData: isSet(object.userData) ? globalThis.String(object.userData) : void 0,
679
+ realm: isSet(object.realm) ? globalThis.String(object.realm) : void 0
626
680
  };
627
681
  },
628
682
  toJSON(message) {
@@ -642,6 +696,9 @@ var UserCreateRequest = {
642
696
  if (message.userData !== void 0) {
643
697
  obj.userData = message.userData;
644
698
  }
699
+ if (message.realm !== void 0) {
700
+ obj.realm = message.realm;
701
+ }
645
702
  return obj;
646
703
  },
647
704
  create(base) {
@@ -654,11 +711,12 @@ var UserCreateRequest = {
654
711
  message.verify = object.verify ?? false;
655
712
  message.anonymousId = object.anonymousId ?? void 0;
656
713
  message.userData = object.userData ?? void 0;
714
+ message.realm = object.realm ?? void 0;
657
715
  return message;
658
716
  }
659
717
  };
660
718
  function createBaseUserCreateByUsernameRequest() {
661
- return { username: "", password: void 0, anonymousId: void 0 };
719
+ return { username: "", password: void 0, anonymousId: void 0, realm: void 0 };
662
720
  }
663
721
  var UserCreateByUsernameRequest = {
664
722
  encode(message, writer = new import_wire2.BinaryWriter()) {
@@ -671,6 +729,9 @@ var UserCreateByUsernameRequest = {
671
729
  if (message.anonymousId !== void 0) {
672
730
  writer.uint32(26).string(message.anonymousId);
673
731
  }
732
+ if (message.realm !== void 0) {
733
+ writer.uint32(34).string(message.realm);
734
+ }
674
735
  return writer;
675
736
  },
676
737
  decode(input, length) {
@@ -707,6 +768,13 @@ var UserCreateByUsernameRequest = {
707
768
  message.anonymousId = reader.string();
708
769
  continue;
709
770
  }
771
+ case 4: {
772
+ if (tag !== 34) {
773
+ break;
774
+ }
775
+ message.realm = reader.string();
776
+ continue;
777
+ }
710
778
  }
711
779
  if ((tag & 7) === 4 || tag === 0) {
712
780
  break;
@@ -722,7 +790,8 @@ var UserCreateByUsernameRequest = {
722
790
  return {
723
791
  username: isSet(object.username) ? globalThis.String(object.username) : "",
724
792
  password: isSet(object.password) ? globalThis.String(object.password) : void 0,
725
- anonymousId: isSet(object.anonymousId) ? globalThis.String(object.anonymousId) : void 0
793
+ anonymousId: isSet(object.anonymousId) ? globalThis.String(object.anonymousId) : void 0,
794
+ realm: isSet(object.realm) ? globalThis.String(object.realm) : void 0
726
795
  };
727
796
  },
728
797
  toJSON(message) {
@@ -736,6 +805,9 @@ var UserCreateByUsernameRequest = {
736
805
  if (message.anonymousId !== void 0) {
737
806
  obj.anonymousId = message.anonymousId;
738
807
  }
808
+ if (message.realm !== void 0) {
809
+ obj.realm = message.realm;
810
+ }
739
811
  return obj;
740
812
  },
741
813
  create(base) {
@@ -746,11 +818,12 @@ var UserCreateByUsernameRequest = {
746
818
  message.username = object.username ?? "";
747
819
  message.password = object.password ?? void 0;
748
820
  message.anonymousId = object.anonymousId ?? void 0;
821
+ message.realm = object.realm ?? void 0;
749
822
  return message;
750
823
  }
751
824
  };
752
825
  function createBaseUserChangePass() {
753
- return { email: "", password: void 0 };
826
+ return { email: "", password: void 0, realm: void 0 };
754
827
  }
755
828
  var UserChangePass = {
756
829
  encode(message, writer = new import_wire2.BinaryWriter()) {
@@ -760,6 +833,9 @@ var UserChangePass = {
760
833
  if (message.password !== void 0) {
761
834
  writer.uint32(18).string(message.password);
762
835
  }
836
+ if (message.realm !== void 0) {
837
+ writer.uint32(26).string(message.realm);
838
+ }
763
839
  return writer;
764
840
  },
765
841
  decode(input, length) {
@@ -789,6 +865,13 @@ var UserChangePass = {
789
865
  message.password = reader.string();
790
866
  continue;
791
867
  }
868
+ case 3: {
869
+ if (tag !== 26) {
870
+ break;
871
+ }
872
+ message.realm = reader.string();
873
+ continue;
874
+ }
792
875
  }
793
876
  if ((tag & 7) === 4 || tag === 0) {
794
877
  break;
@@ -803,7 +886,8 @@ var UserChangePass = {
803
886
  fromJSON(object) {
804
887
  return {
805
888
  email: isSet(object.email) ? globalThis.String(object.email) : "",
806
- password: isSet(object.password) ? globalThis.String(object.password) : void 0
889
+ password: isSet(object.password) ? globalThis.String(object.password) : void 0,
890
+ realm: isSet(object.realm) ? globalThis.String(object.realm) : void 0
807
891
  };
808
892
  },
809
893
  toJSON(message) {
@@ -814,6 +898,9 @@ var UserChangePass = {
814
898
  if (message.password !== void 0) {
815
899
  obj.password = message.password;
816
900
  }
901
+ if (message.realm !== void 0) {
902
+ obj.realm = message.realm;
903
+ }
817
904
  return obj;
818
905
  },
819
906
  create(base) {
@@ -823,6 +910,144 @@ var UserChangePass = {
823
910
  const message = createBaseUserChangePass();
824
911
  message.email = object.email ?? "";
825
912
  message.password = object.password ?? void 0;
913
+ message.realm = object.realm ?? void 0;
914
+ return message;
915
+ }
916
+ };
917
+ function createBaseUserChangeEmail() {
918
+ return { userId: "", newEmail: "" };
919
+ }
920
+ var UserChangeEmail = {
921
+ encode(message, writer = new import_wire2.BinaryWriter()) {
922
+ if (message.userId !== "") {
923
+ writer.uint32(10).string(message.userId);
924
+ }
925
+ if (message.newEmail !== "") {
926
+ writer.uint32(18).string(message.newEmail);
927
+ }
928
+ return writer;
929
+ },
930
+ decode(input, length) {
931
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
932
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
933
+ if (previousRecursionDepth >= 100) {
934
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
935
+ }
936
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
937
+ try {
938
+ const end = length === void 0 ? reader.len : reader.pos + length;
939
+ const message = createBaseUserChangeEmail();
940
+ while (reader.pos < end) {
941
+ const tag = reader.uint32();
942
+ switch (tag >>> 3) {
943
+ case 1: {
944
+ if (tag !== 10) {
945
+ break;
946
+ }
947
+ message.userId = reader.string();
948
+ continue;
949
+ }
950
+ case 2: {
951
+ if (tag !== 18) {
952
+ break;
953
+ }
954
+ message.newEmail = reader.string();
955
+ continue;
956
+ }
957
+ }
958
+ if ((tag & 7) === 4 || tag === 0) {
959
+ break;
960
+ }
961
+ reader.skip(tag & 7);
962
+ }
963
+ return message;
964
+ } finally {
965
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
966
+ }
967
+ },
968
+ fromJSON(object) {
969
+ return {
970
+ userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
971
+ newEmail: isSet(object.newEmail) ? globalThis.String(object.newEmail) : ""
972
+ };
973
+ },
974
+ toJSON(message) {
975
+ const obj = {};
976
+ if (message.userId !== "") {
977
+ obj.userId = message.userId;
978
+ }
979
+ if (message.newEmail !== "") {
980
+ obj.newEmail = message.newEmail;
981
+ }
982
+ return obj;
983
+ },
984
+ create(base) {
985
+ return UserChangeEmail.fromPartial(base ?? {});
986
+ },
987
+ fromPartial(object) {
988
+ const message = createBaseUserChangeEmail();
989
+ message.userId = object.userId ?? "";
990
+ message.newEmail = object.newEmail ?? "";
991
+ return message;
992
+ }
993
+ };
994
+ function createBaseUserChangeEmailResponse() {
995
+ return { message: "" };
996
+ }
997
+ var UserChangeEmailResponse = {
998
+ encode(message, writer = new import_wire2.BinaryWriter()) {
999
+ if (message.message !== "") {
1000
+ writer.uint32(10).string(message.message);
1001
+ }
1002
+ return writer;
1003
+ },
1004
+ decode(input, length) {
1005
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
1006
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1007
+ if (previousRecursionDepth >= 100) {
1008
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1009
+ }
1010
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1011
+ try {
1012
+ const end = length === void 0 ? reader.len : reader.pos + length;
1013
+ const message = createBaseUserChangeEmailResponse();
1014
+ while (reader.pos < end) {
1015
+ const tag = reader.uint32();
1016
+ switch (tag >>> 3) {
1017
+ case 1: {
1018
+ if (tag !== 10) {
1019
+ break;
1020
+ }
1021
+ message.message = reader.string();
1022
+ continue;
1023
+ }
1024
+ }
1025
+ if ((tag & 7) === 4 || tag === 0) {
1026
+ break;
1027
+ }
1028
+ reader.skip(tag & 7);
1029
+ }
1030
+ return message;
1031
+ } finally {
1032
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1033
+ }
1034
+ },
1035
+ fromJSON(object) {
1036
+ return { message: isSet(object.message) ? globalThis.String(object.message) : "" };
1037
+ },
1038
+ toJSON(message) {
1039
+ const obj = {};
1040
+ if (message.message !== "") {
1041
+ obj.message = message.message;
1042
+ }
1043
+ return obj;
1044
+ },
1045
+ create(base) {
1046
+ return UserChangeEmailResponse.fromPartial(base ?? {});
1047
+ },
1048
+ fromPartial(object) {
1049
+ const message = createBaseUserChangeEmailResponse();
1050
+ message.message = object.message ?? "";
826
1051
  return message;
827
1052
  }
828
1053
  };
@@ -1296,7 +1521,7 @@ var UserCreateResponse = {
1296
1521
  }
1297
1522
  };
1298
1523
  function createBaseTeam() {
1299
- return { id: "", name: "", parentTeam: "", isDefault: false };
1524
+ return { id: "", name: "", parentTeam: "", isDefault: false, realmEnabled: false, realmSlug: void 0 };
1300
1525
  }
1301
1526
  var Team = {
1302
1527
  encode(message, writer = new import_wire2.BinaryWriter()) {
@@ -1312,6 +1537,12 @@ var Team = {
1312
1537
  if (message.isDefault !== false) {
1313
1538
  writer.uint32(32).bool(message.isDefault);
1314
1539
  }
1540
+ if (message.realmEnabled !== false) {
1541
+ writer.uint32(40).bool(message.realmEnabled);
1542
+ }
1543
+ if (message.realmSlug !== void 0) {
1544
+ writer.uint32(50).string(message.realmSlug);
1545
+ }
1315
1546
  return writer;
1316
1547
  },
1317
1548
  decode(input, length) {
@@ -1355,6 +1586,20 @@ var Team = {
1355
1586
  message.isDefault = reader.bool();
1356
1587
  continue;
1357
1588
  }
1589
+ case 5: {
1590
+ if (tag !== 40) {
1591
+ break;
1592
+ }
1593
+ message.realmEnabled = reader.bool();
1594
+ continue;
1595
+ }
1596
+ case 6: {
1597
+ if (tag !== 50) {
1598
+ break;
1599
+ }
1600
+ message.realmSlug = reader.string();
1601
+ continue;
1602
+ }
1358
1603
  }
1359
1604
  if ((tag & 7) === 4 || tag === 0) {
1360
1605
  break;
@@ -1371,7 +1616,9 @@ var Team = {
1371
1616
  id: isSet(object.id) ? globalThis.String(object.id) : "",
1372
1617
  name: isSet(object.name) ? globalThis.String(object.name) : "",
1373
1618
  parentTeam: isSet(object.parentTeam) ? globalThis.String(object.parentTeam) : "",
1374
- isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false
1619
+ isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false,
1620
+ realmEnabled: isSet(object.realmEnabled) ? globalThis.Boolean(object.realmEnabled) : false,
1621
+ realmSlug: isSet(object.realmSlug) ? globalThis.String(object.realmSlug) : void 0
1375
1622
  };
1376
1623
  },
1377
1624
  toJSON(message) {
@@ -1388,6 +1635,12 @@ var Team = {
1388
1635
  if (message.isDefault !== false) {
1389
1636
  obj.isDefault = message.isDefault;
1390
1637
  }
1638
+ if (message.realmEnabled !== false) {
1639
+ obj.realmEnabled = message.realmEnabled;
1640
+ }
1641
+ if (message.realmSlug !== void 0) {
1642
+ obj.realmSlug = message.realmSlug;
1643
+ }
1391
1644
  return obj;
1392
1645
  },
1393
1646
  create(base) {
@@ -1399,6 +1652,8 @@ var Team = {
1399
1652
  message.name = object.name ?? "";
1400
1653
  message.parentTeam = object.parentTeam ?? "";
1401
1654
  message.isDefault = object.isDefault ?? false;
1655
+ message.realmEnabled = object.realmEnabled ?? false;
1656
+ message.realmSlug = object.realmSlug ?? void 0;
1402
1657
  return message;
1403
1658
  }
1404
1659
  };
@@ -1539,16 +1794,13 @@ var ModifyTeamMembersRequest = {
1539
1794
  return message;
1540
1795
  }
1541
1796
  };
1542
- function createBaseValidateAccessTokenRequest() {
1543
- return { accessToken: "", path: void 0 };
1797
+ function createBaseGetUserRequest() {
1798
+ return { userId: "" };
1544
1799
  }
1545
- var ValidateAccessTokenRequest = {
1800
+ var GetUserRequest = {
1546
1801
  encode(message, writer = new import_wire2.BinaryWriter()) {
1547
- if (message.accessToken !== "") {
1548
- writer.uint32(10).string(message.accessToken);
1549
- }
1550
- if (message.path !== void 0) {
1551
- writer.uint32(18).string(message.path);
1802
+ if (message.userId !== "") {
1803
+ writer.uint32(10).string(message.userId);
1552
1804
  }
1553
1805
  return writer;
1554
1806
  },
@@ -1561,7 +1813,7 @@ var ValidateAccessTokenRequest = {
1561
1813
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1562
1814
  try {
1563
1815
  const end = length === void 0 ? reader.len : reader.pos + length;
1564
- const message = createBaseValidateAccessTokenRequest();
1816
+ const message = createBaseGetUserRequest();
1565
1817
  while (reader.pos < end) {
1566
1818
  const tag = reader.uint32();
1567
1819
  switch (tag >>> 3) {
@@ -1569,14 +1821,7 @@ var ValidateAccessTokenRequest = {
1569
1821
  if (tag !== 10) {
1570
1822
  break;
1571
1823
  }
1572
- message.accessToken = reader.string();
1573
- continue;
1574
- }
1575
- case 2: {
1576
- if (tag !== 18) {
1577
- break;
1578
- }
1579
- message.path = reader.string();
1824
+ message.userId = reader.string();
1580
1825
  continue;
1581
1826
  }
1582
1827
  }
@@ -1591,41 +1836,31 @@ var ValidateAccessTokenRequest = {
1591
1836
  }
1592
1837
  },
1593
1838
  fromJSON(object) {
1594
- return {
1595
- accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "",
1596
- path: isSet(object.path) ? globalThis.String(object.path) : void 0
1597
- };
1839
+ return { userId: isSet(object.userId) ? globalThis.String(object.userId) : "" };
1598
1840
  },
1599
1841
  toJSON(message) {
1600
1842
  const obj = {};
1601
- if (message.accessToken !== "") {
1602
- obj.accessToken = message.accessToken;
1603
- }
1604
- if (message.path !== void 0) {
1605
- obj.path = message.path;
1843
+ if (message.userId !== "") {
1844
+ obj.userId = message.userId;
1606
1845
  }
1607
1846
  return obj;
1608
1847
  },
1609
1848
  create(base) {
1610
- return ValidateAccessTokenRequest.fromPartial(base ?? {});
1849
+ return GetUserRequest.fromPartial(base ?? {});
1611
1850
  },
1612
1851
  fromPartial(object) {
1613
- const message = createBaseValidateAccessTokenRequest();
1614
- message.accessToken = object.accessToken ?? "";
1615
- message.path = object.path ?? void 0;
1852
+ const message = createBaseGetUserRequest();
1853
+ message.userId = object.userId ?? "";
1616
1854
  return message;
1617
1855
  }
1618
1856
  };
1619
- function createBaseValidateAccessTokenResponse() {
1620
- return { status: 0, userId: void 0 };
1857
+ function createBaseGetUserResponse() {
1858
+ return { user: "" };
1621
1859
  }
1622
- var ValidateAccessTokenResponse = {
1860
+ var GetUserResponse = {
1623
1861
  encode(message, writer = new import_wire2.BinaryWriter()) {
1624
- if (message.status !== 0) {
1625
- writer.uint32(8).int32(message.status);
1626
- }
1627
- if (message.userId !== void 0) {
1628
- writer.uint32(18).string(message.userId);
1862
+ if (message.user !== "") {
1863
+ writer.uint32(10).string(message.user);
1629
1864
  }
1630
1865
  return writer;
1631
1866
  },
@@ -1638,22 +1873,15 @@ var ValidateAccessTokenResponse = {
1638
1873
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1639
1874
  try {
1640
1875
  const end = length === void 0 ? reader.len : reader.pos + length;
1641
- const message = createBaseValidateAccessTokenResponse();
1876
+ const message = createBaseGetUserResponse();
1642
1877
  while (reader.pos < end) {
1643
1878
  const tag = reader.uint32();
1644
1879
  switch (tag >>> 3) {
1645
1880
  case 1: {
1646
- if (tag !== 8) {
1647
- break;
1648
- }
1649
- message.status = reader.int32();
1650
- continue;
1651
- }
1652
- case 2: {
1653
- if (tag !== 18) {
1881
+ if (tag !== 10) {
1654
1882
  break;
1655
1883
  }
1656
- message.userId = reader.string();
1884
+ message.user = reader.string();
1657
1885
  continue;
1658
1886
  }
1659
1887
  }
@@ -1668,38 +1896,34 @@ var ValidateAccessTokenResponse = {
1668
1896
  }
1669
1897
  },
1670
1898
  fromJSON(object) {
1671
- return {
1672
- status: isSet(object.status) ? validateAccessTokenResponse_StatusFromJSON(object.status) : 0,
1673
- userId: isSet(object.userId) ? globalThis.String(object.userId) : void 0
1674
- };
1899
+ return { user: isSet(object.user) ? globalThis.String(object.user) : "" };
1675
1900
  },
1676
1901
  toJSON(message) {
1677
1902
  const obj = {};
1678
- if (message.status !== 0) {
1679
- obj.status = validateAccessTokenResponse_StatusToJSON(message.status);
1680
- }
1681
- if (message.userId !== void 0) {
1682
- obj.userId = message.userId;
1903
+ if (message.user !== "") {
1904
+ obj.user = message.user;
1683
1905
  }
1684
1906
  return obj;
1685
1907
  },
1686
1908
  create(base) {
1687
- return ValidateAccessTokenResponse.fromPartial(base ?? {});
1909
+ return GetUserResponse.fromPartial(base ?? {});
1688
1910
  },
1689
1911
  fromPartial(object) {
1690
- const message = createBaseValidateAccessTokenResponse();
1691
- message.status = object.status ?? 0;
1692
- message.userId = object.userId ?? void 0;
1912
+ const message = createBaseGetUserResponse();
1913
+ message.user = object.user ?? "";
1693
1914
  return message;
1694
1915
  }
1695
1916
  };
1696
- function createBaseAnonymousUserCreateRequest() {
1697
- return { clientId: "" };
1917
+ function createBaseValidateAccessTokenRequest() {
1918
+ return { accessToken: "", path: void 0 };
1698
1919
  }
1699
- var AnonymousUserCreateRequest = {
1920
+ var ValidateAccessTokenRequest = {
1700
1921
  encode(message, writer = new import_wire2.BinaryWriter()) {
1701
- if (message.clientId !== "") {
1702
- writer.uint32(10).string(message.clientId);
1922
+ if (message.accessToken !== "") {
1923
+ writer.uint32(10).string(message.accessToken);
1924
+ }
1925
+ if (message.path !== void 0) {
1926
+ writer.uint32(18).string(message.path);
1703
1927
  }
1704
1928
  return writer;
1705
1929
  },
@@ -1712,7 +1936,7 @@ var AnonymousUserCreateRequest = {
1712
1936
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1713
1937
  try {
1714
1938
  const end = length === void 0 ? reader.len : reader.pos + length;
1715
- const message = createBaseAnonymousUserCreateRequest();
1939
+ const message = createBaseValidateAccessTokenRequest();
1716
1940
  while (reader.pos < end) {
1717
1941
  const tag = reader.uint32();
1718
1942
  switch (tag >>> 3) {
@@ -1720,7 +1944,198 @@ var AnonymousUserCreateRequest = {
1720
1944
  if (tag !== 10) {
1721
1945
  break;
1722
1946
  }
1723
- message.clientId = reader.string();
1947
+ message.accessToken = reader.string();
1948
+ continue;
1949
+ }
1950
+ case 2: {
1951
+ if (tag !== 18) {
1952
+ break;
1953
+ }
1954
+ message.path = reader.string();
1955
+ continue;
1956
+ }
1957
+ }
1958
+ if ((tag & 7) === 4 || tag === 0) {
1959
+ break;
1960
+ }
1961
+ reader.skip(tag & 7);
1962
+ }
1963
+ return message;
1964
+ } finally {
1965
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1966
+ }
1967
+ },
1968
+ fromJSON(object) {
1969
+ return {
1970
+ accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "",
1971
+ path: isSet(object.path) ? globalThis.String(object.path) : void 0
1972
+ };
1973
+ },
1974
+ toJSON(message) {
1975
+ const obj = {};
1976
+ if (message.accessToken !== "") {
1977
+ obj.accessToken = message.accessToken;
1978
+ }
1979
+ if (message.path !== void 0) {
1980
+ obj.path = message.path;
1981
+ }
1982
+ return obj;
1983
+ },
1984
+ create(base) {
1985
+ return ValidateAccessTokenRequest.fromPartial(base ?? {});
1986
+ },
1987
+ fromPartial(object) {
1988
+ const message = createBaseValidateAccessTokenRequest();
1989
+ message.accessToken = object.accessToken ?? "";
1990
+ message.path = object.path ?? void 0;
1991
+ return message;
1992
+ }
1993
+ };
1994
+ function createBaseValidateAccessTokenResponse() {
1995
+ return { status: 0, userId: void 0, realm: void 0, homeRealm: void 0 };
1996
+ }
1997
+ var ValidateAccessTokenResponse = {
1998
+ encode(message, writer = new import_wire2.BinaryWriter()) {
1999
+ if (message.status !== 0) {
2000
+ writer.uint32(8).int32(message.status);
2001
+ }
2002
+ if (message.userId !== void 0) {
2003
+ writer.uint32(18).string(message.userId);
2004
+ }
2005
+ if (message.realm !== void 0) {
2006
+ writer.uint32(26).string(message.realm);
2007
+ }
2008
+ if (message.homeRealm !== void 0) {
2009
+ writer.uint32(34).string(message.homeRealm);
2010
+ }
2011
+ return writer;
2012
+ },
2013
+ decode(input, length) {
2014
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
2015
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2016
+ if (previousRecursionDepth >= 100) {
2017
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2018
+ }
2019
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2020
+ try {
2021
+ const end = length === void 0 ? reader.len : reader.pos + length;
2022
+ const message = createBaseValidateAccessTokenResponse();
2023
+ while (reader.pos < end) {
2024
+ const tag = reader.uint32();
2025
+ switch (tag >>> 3) {
2026
+ case 1: {
2027
+ if (tag !== 8) {
2028
+ break;
2029
+ }
2030
+ message.status = reader.int32();
2031
+ continue;
2032
+ }
2033
+ case 2: {
2034
+ if (tag !== 18) {
2035
+ break;
2036
+ }
2037
+ message.userId = reader.string();
2038
+ continue;
2039
+ }
2040
+ case 3: {
2041
+ if (tag !== 26) {
2042
+ break;
2043
+ }
2044
+ message.realm = reader.string();
2045
+ continue;
2046
+ }
2047
+ case 4: {
2048
+ if (tag !== 34) {
2049
+ break;
2050
+ }
2051
+ message.homeRealm = reader.string();
2052
+ continue;
2053
+ }
2054
+ }
2055
+ if ((tag & 7) === 4 || tag === 0) {
2056
+ break;
2057
+ }
2058
+ reader.skip(tag & 7);
2059
+ }
2060
+ return message;
2061
+ } finally {
2062
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2063
+ }
2064
+ },
2065
+ fromJSON(object) {
2066
+ return {
2067
+ status: isSet(object.status) ? validateAccessTokenResponse_StatusFromJSON(object.status) : 0,
2068
+ userId: isSet(object.userId) ? globalThis.String(object.userId) : void 0,
2069
+ realm: isSet(object.realm) ? globalThis.String(object.realm) : void 0,
2070
+ homeRealm: isSet(object.homeRealm) ? globalThis.String(object.homeRealm) : void 0
2071
+ };
2072
+ },
2073
+ toJSON(message) {
2074
+ const obj = {};
2075
+ if (message.status !== 0) {
2076
+ obj.status = validateAccessTokenResponse_StatusToJSON(message.status);
2077
+ }
2078
+ if (message.userId !== void 0) {
2079
+ obj.userId = message.userId;
2080
+ }
2081
+ if (message.realm !== void 0) {
2082
+ obj.realm = message.realm;
2083
+ }
2084
+ if (message.homeRealm !== void 0) {
2085
+ obj.homeRealm = message.homeRealm;
2086
+ }
2087
+ return obj;
2088
+ },
2089
+ create(base) {
2090
+ return ValidateAccessTokenResponse.fromPartial(base ?? {});
2091
+ },
2092
+ fromPartial(object) {
2093
+ const message = createBaseValidateAccessTokenResponse();
2094
+ message.status = object.status ?? 0;
2095
+ message.userId = object.userId ?? void 0;
2096
+ message.realm = object.realm ?? void 0;
2097
+ message.homeRealm = object.homeRealm ?? void 0;
2098
+ return message;
2099
+ }
2100
+ };
2101
+ function createBaseAnonymousUserCreateRequest() {
2102
+ return { clientId: "", realm: void 0 };
2103
+ }
2104
+ var AnonymousUserCreateRequest = {
2105
+ encode(message, writer = new import_wire2.BinaryWriter()) {
2106
+ if (message.clientId !== "") {
2107
+ writer.uint32(10).string(message.clientId);
2108
+ }
2109
+ if (message.realm !== void 0) {
2110
+ writer.uint32(18).string(message.realm);
2111
+ }
2112
+ return writer;
2113
+ },
2114
+ decode(input, length) {
2115
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
2116
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2117
+ if (previousRecursionDepth >= 100) {
2118
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2119
+ }
2120
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2121
+ try {
2122
+ const end = length === void 0 ? reader.len : reader.pos + length;
2123
+ const message = createBaseAnonymousUserCreateRequest();
2124
+ while (reader.pos < end) {
2125
+ const tag = reader.uint32();
2126
+ switch (tag >>> 3) {
2127
+ case 1: {
2128
+ if (tag !== 10) {
2129
+ break;
2130
+ }
2131
+ message.clientId = reader.string();
2132
+ continue;
2133
+ }
2134
+ case 2: {
2135
+ if (tag !== 18) {
2136
+ break;
2137
+ }
2138
+ message.realm = reader.string();
1724
2139
  continue;
1725
2140
  }
1726
2141
  }
@@ -1735,13 +2150,19 @@ var AnonymousUserCreateRequest = {
1735
2150
  }
1736
2151
  },
1737
2152
  fromJSON(object) {
1738
- return { clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "" };
2153
+ return {
2154
+ clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "",
2155
+ realm: isSet(object.realm) ? globalThis.String(object.realm) : void 0
2156
+ };
1739
2157
  },
1740
2158
  toJSON(message) {
1741
2159
  const obj = {};
1742
2160
  if (message.clientId !== "") {
1743
2161
  obj.clientId = message.clientId;
1744
2162
  }
2163
+ if (message.realm !== void 0) {
2164
+ obj.realm = message.realm;
2165
+ }
1745
2166
  return obj;
1746
2167
  },
1747
2168
  create(base) {
@@ -1750,6 +2171,7 @@ var AnonymousUserCreateRequest = {
1750
2171
  fromPartial(object) {
1751
2172
  const message = createBaseAnonymousUserCreateRequest();
1752
2173
  message.clientId = object.clientId ?? "";
2174
+ message.realm = object.realm ?? void 0;
1753
2175
  return message;
1754
2176
  }
1755
2177
  };
@@ -2316,87 +2738,630 @@ var UpdateTeamRequest = {
2316
2738
  return message;
2317
2739
  }
2318
2740
  };
2319
- var AuthenticationDefinition = {
2320
- name: "Authentication",
2321
- fullName: "authentication.Authentication",
2322
- methods: {
2323
- userLogin: {
2324
- name: "UserLogin",
2325
- requestType: UserLoginRequest,
2326
- requestStream: false,
2327
- responseType: UserLoginResponse,
2328
- responseStream: false,
2329
- options: {}
2330
- },
2331
- userCreate: {
2332
- name: "UserCreate",
2333
- requestType: UserCreateRequest,
2334
- requestStream: false,
2335
- responseType: UserCreateResponse,
2336
- responseStream: false,
2337
- options: {}
2338
- },
2339
- userCreateByUsername: {
2340
- name: "UserCreateByUsername",
2341
- requestType: UserCreateByUsernameRequest,
2342
- requestStream: false,
2343
- responseType: UserCreateResponse,
2344
- responseStream: false,
2345
- options: {}
2346
- },
2347
- userModifyStatus: {
2348
- name: "UserModifyStatus",
2349
- requestType: UserModifyStatusRequest,
2350
- requestStream: false,
2351
- responseType: UserModifyStatusResponse,
2352
- responseStream: false,
2353
- options: {}
2354
- },
2355
- anonymousUserCreate: {
2356
- name: "AnonymousUserCreate",
2357
- requestType: AnonymousUserCreateRequest,
2358
- requestStream: false,
2359
- responseType: UserLoginResponse,
2360
- responseStream: false,
2361
- options: {}
2362
- },
2363
- changePass: {
2364
- name: "ChangePass",
2365
- requestType: UserChangePass,
2366
- requestStream: false,
2367
- responseType: UserCreateResponse,
2368
- responseStream: false,
2369
- options: {}
2370
- },
2371
- userDelete: {
2372
- name: "UserDelete",
2373
- requestType: UserDeleteRequest,
2374
- requestStream: false,
2375
- responseType: UserDeleteResponse,
2376
- responseStream: false,
2377
- options: {}
2378
- },
2379
- getTeam: {
2380
- name: "GetTeam",
2381
- requestType: GetTeamRequest,
2382
- requestStream: false,
2383
- responseType: Team,
2384
- responseStream: false,
2385
- options: {}
2386
- },
2387
- createTeam: {
2388
- name: "CreateTeam",
2389
- requestType: CreateTeamRequest,
2390
- requestStream: false,
2391
- responseType: Team,
2392
- responseStream: false,
2393
- options: {}
2394
- },
2395
- teamDelete: {
2396
- name: "TeamDelete",
2397
- requestType: TeamDeleteRequest,
2398
- requestStream: false,
2399
- responseType: TeamDeleteResponse,
2741
+ function createBaseSetTeamRealmRequest() {
2742
+ return { teamId: "", slug: "", settingsJson: void 0, force: false };
2743
+ }
2744
+ var SetTeamRealmRequest = {
2745
+ encode(message, writer = new import_wire2.BinaryWriter()) {
2746
+ if (message.teamId !== "") {
2747
+ writer.uint32(10).string(message.teamId);
2748
+ }
2749
+ if (message.slug !== "") {
2750
+ writer.uint32(18).string(message.slug);
2751
+ }
2752
+ if (message.settingsJson !== void 0) {
2753
+ writer.uint32(26).string(message.settingsJson);
2754
+ }
2755
+ if (message.force !== false) {
2756
+ writer.uint32(32).bool(message.force);
2757
+ }
2758
+ return writer;
2759
+ },
2760
+ decode(input, length) {
2761
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
2762
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2763
+ if (previousRecursionDepth >= 100) {
2764
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2765
+ }
2766
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2767
+ try {
2768
+ const end = length === void 0 ? reader.len : reader.pos + length;
2769
+ const message = createBaseSetTeamRealmRequest();
2770
+ while (reader.pos < end) {
2771
+ const tag = reader.uint32();
2772
+ switch (tag >>> 3) {
2773
+ case 1: {
2774
+ if (tag !== 10) {
2775
+ break;
2776
+ }
2777
+ message.teamId = reader.string();
2778
+ continue;
2779
+ }
2780
+ case 2: {
2781
+ if (tag !== 18) {
2782
+ break;
2783
+ }
2784
+ message.slug = reader.string();
2785
+ continue;
2786
+ }
2787
+ case 3: {
2788
+ if (tag !== 26) {
2789
+ break;
2790
+ }
2791
+ message.settingsJson = reader.string();
2792
+ continue;
2793
+ }
2794
+ case 4: {
2795
+ if (tag !== 32) {
2796
+ break;
2797
+ }
2798
+ message.force = reader.bool();
2799
+ continue;
2800
+ }
2801
+ }
2802
+ if ((tag & 7) === 4 || tag === 0) {
2803
+ break;
2804
+ }
2805
+ reader.skip(tag & 7);
2806
+ }
2807
+ return message;
2808
+ } finally {
2809
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2810
+ }
2811
+ },
2812
+ fromJSON(object) {
2813
+ return {
2814
+ teamId: isSet(object.teamId) ? globalThis.String(object.teamId) : "",
2815
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
2816
+ settingsJson: isSet(object.settingsJson) ? globalThis.String(object.settingsJson) : void 0,
2817
+ force: isSet(object.force) ? globalThis.Boolean(object.force) : false
2818
+ };
2819
+ },
2820
+ toJSON(message) {
2821
+ const obj = {};
2822
+ if (message.teamId !== "") {
2823
+ obj.teamId = message.teamId;
2824
+ }
2825
+ if (message.slug !== "") {
2826
+ obj.slug = message.slug;
2827
+ }
2828
+ if (message.settingsJson !== void 0) {
2829
+ obj.settingsJson = message.settingsJson;
2830
+ }
2831
+ if (message.force !== false) {
2832
+ obj.force = message.force;
2833
+ }
2834
+ return obj;
2835
+ },
2836
+ create(base) {
2837
+ return SetTeamRealmRequest.fromPartial(base ?? {});
2838
+ },
2839
+ fromPartial(object) {
2840
+ const message = createBaseSetTeamRealmRequest();
2841
+ message.teamId = object.teamId ?? "";
2842
+ message.slug = object.slug ?? "";
2843
+ message.settingsJson = object.settingsJson ?? void 0;
2844
+ message.force = object.force ?? false;
2845
+ return message;
2846
+ }
2847
+ };
2848
+ function createBaseGetRealmSettingsRequest() {
2849
+ return { teamId: "" };
2850
+ }
2851
+ var GetRealmSettingsRequest = {
2852
+ encode(message, writer = new import_wire2.BinaryWriter()) {
2853
+ if (message.teamId !== "") {
2854
+ writer.uint32(10).string(message.teamId);
2855
+ }
2856
+ return writer;
2857
+ },
2858
+ decode(input, length) {
2859
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
2860
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2861
+ if (previousRecursionDepth >= 100) {
2862
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2863
+ }
2864
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2865
+ try {
2866
+ const end = length === void 0 ? reader.len : reader.pos + length;
2867
+ const message = createBaseGetRealmSettingsRequest();
2868
+ while (reader.pos < end) {
2869
+ const tag = reader.uint32();
2870
+ switch (tag >>> 3) {
2871
+ case 1: {
2872
+ if (tag !== 10) {
2873
+ break;
2874
+ }
2875
+ message.teamId = reader.string();
2876
+ continue;
2877
+ }
2878
+ }
2879
+ if ((tag & 7) === 4 || tag === 0) {
2880
+ break;
2881
+ }
2882
+ reader.skip(tag & 7);
2883
+ }
2884
+ return message;
2885
+ } finally {
2886
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2887
+ }
2888
+ },
2889
+ fromJSON(object) {
2890
+ return { teamId: isSet(object.teamId) ? globalThis.String(object.teamId) : "" };
2891
+ },
2892
+ toJSON(message) {
2893
+ const obj = {};
2894
+ if (message.teamId !== "") {
2895
+ obj.teamId = message.teamId;
2896
+ }
2897
+ return obj;
2898
+ },
2899
+ create(base) {
2900
+ return GetRealmSettingsRequest.fromPartial(base ?? {});
2901
+ },
2902
+ fromPartial(object) {
2903
+ const message = createBaseGetRealmSettingsRequest();
2904
+ message.teamId = object.teamId ?? "";
2905
+ return message;
2906
+ }
2907
+ };
2908
+ function createBaseRealmResponse() {
2909
+ return { team: void 0, settingsJson: "", homeCount: 0, guestCount: 0 };
2910
+ }
2911
+ var RealmResponse = {
2912
+ encode(message, writer = new import_wire2.BinaryWriter()) {
2913
+ if (message.team !== void 0) {
2914
+ Team.encode(message.team, writer.uint32(10).fork()).join();
2915
+ }
2916
+ if (message.settingsJson !== "") {
2917
+ writer.uint32(18).string(message.settingsJson);
2918
+ }
2919
+ if (message.homeCount !== 0) {
2920
+ writer.uint32(24).int32(message.homeCount);
2921
+ }
2922
+ if (message.guestCount !== 0) {
2923
+ writer.uint32(32).int32(message.guestCount);
2924
+ }
2925
+ return writer;
2926
+ },
2927
+ decode(input, length) {
2928
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
2929
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2930
+ if (previousRecursionDepth >= 100) {
2931
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2932
+ }
2933
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2934
+ try {
2935
+ const end = length === void 0 ? reader.len : reader.pos + length;
2936
+ const message = createBaseRealmResponse();
2937
+ while (reader.pos < end) {
2938
+ const tag = reader.uint32();
2939
+ switch (tag >>> 3) {
2940
+ case 1: {
2941
+ if (tag !== 10) {
2942
+ break;
2943
+ }
2944
+ message.team = Team.decode(reader, reader.uint32());
2945
+ continue;
2946
+ }
2947
+ case 2: {
2948
+ if (tag !== 18) {
2949
+ break;
2950
+ }
2951
+ message.settingsJson = reader.string();
2952
+ continue;
2953
+ }
2954
+ case 3: {
2955
+ if (tag !== 24) {
2956
+ break;
2957
+ }
2958
+ message.homeCount = reader.int32();
2959
+ continue;
2960
+ }
2961
+ case 4: {
2962
+ if (tag !== 32) {
2963
+ break;
2964
+ }
2965
+ message.guestCount = reader.int32();
2966
+ continue;
2967
+ }
2968
+ }
2969
+ if ((tag & 7) === 4 || tag === 0) {
2970
+ break;
2971
+ }
2972
+ reader.skip(tag & 7);
2973
+ }
2974
+ return message;
2975
+ } finally {
2976
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2977
+ }
2978
+ },
2979
+ fromJSON(object) {
2980
+ return {
2981
+ team: isSet(object.team) ? Team.fromJSON(object.team) : void 0,
2982
+ settingsJson: isSet(object.settingsJson) ? globalThis.String(object.settingsJson) : "",
2983
+ homeCount: isSet(object.homeCount) ? globalThis.Number(object.homeCount) : 0,
2984
+ guestCount: isSet(object.guestCount) ? globalThis.Number(object.guestCount) : 0
2985
+ };
2986
+ },
2987
+ toJSON(message) {
2988
+ const obj = {};
2989
+ if (message.team !== void 0) {
2990
+ obj.team = Team.toJSON(message.team);
2991
+ }
2992
+ if (message.settingsJson !== "") {
2993
+ obj.settingsJson = message.settingsJson;
2994
+ }
2995
+ if (message.homeCount !== 0) {
2996
+ obj.homeCount = Math.round(message.homeCount);
2997
+ }
2998
+ if (message.guestCount !== 0) {
2999
+ obj.guestCount = Math.round(message.guestCount);
3000
+ }
3001
+ return obj;
3002
+ },
3003
+ create(base) {
3004
+ return RealmResponse.fromPartial(base ?? {});
3005
+ },
3006
+ fromPartial(object) {
3007
+ const message = createBaseRealmResponse();
3008
+ message.team = object.team !== void 0 && object.team !== null ? Team.fromPartial(object.team) : void 0;
3009
+ message.settingsJson = object.settingsJson ?? "";
3010
+ message.homeCount = object.homeCount ?? 0;
3011
+ message.guestCount = object.guestCount ?? 0;
3012
+ return message;
3013
+ }
3014
+ };
3015
+ function createBaseUnsetTeamRealmRequest() {
3016
+ return { teamId: "", force: false };
3017
+ }
3018
+ var UnsetTeamRealmRequest = {
3019
+ encode(message, writer = new import_wire2.BinaryWriter()) {
3020
+ if (message.teamId !== "") {
3021
+ writer.uint32(10).string(message.teamId);
3022
+ }
3023
+ if (message.force !== false) {
3024
+ writer.uint32(16).bool(message.force);
3025
+ }
3026
+ return writer;
3027
+ },
3028
+ decode(input, length) {
3029
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
3030
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
3031
+ if (previousRecursionDepth >= 100) {
3032
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3033
+ }
3034
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3035
+ try {
3036
+ const end = length === void 0 ? reader.len : reader.pos + length;
3037
+ const message = createBaseUnsetTeamRealmRequest();
3038
+ while (reader.pos < end) {
3039
+ const tag = reader.uint32();
3040
+ switch (tag >>> 3) {
3041
+ case 1: {
3042
+ if (tag !== 10) {
3043
+ break;
3044
+ }
3045
+ message.teamId = reader.string();
3046
+ continue;
3047
+ }
3048
+ case 2: {
3049
+ if (tag !== 16) {
3050
+ break;
3051
+ }
3052
+ message.force = reader.bool();
3053
+ continue;
3054
+ }
3055
+ }
3056
+ if ((tag & 7) === 4 || tag === 0) {
3057
+ break;
3058
+ }
3059
+ reader.skip(tag & 7);
3060
+ }
3061
+ return message;
3062
+ } finally {
3063
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3064
+ }
3065
+ },
3066
+ fromJSON(object) {
3067
+ return {
3068
+ teamId: isSet(object.teamId) ? globalThis.String(object.teamId) : "",
3069
+ force: isSet(object.force) ? globalThis.Boolean(object.force) : false
3070
+ };
3071
+ },
3072
+ toJSON(message) {
3073
+ const obj = {};
3074
+ if (message.teamId !== "") {
3075
+ obj.teamId = message.teamId;
3076
+ }
3077
+ if (message.force !== false) {
3078
+ obj.force = message.force;
3079
+ }
3080
+ return obj;
3081
+ },
3082
+ create(base) {
3083
+ return UnsetTeamRealmRequest.fromPartial(base ?? {});
3084
+ },
3085
+ fromPartial(object) {
3086
+ const message = createBaseUnsetTeamRealmRequest();
3087
+ message.teamId = object.teamId ?? "";
3088
+ message.force = object.force ?? false;
3089
+ return message;
3090
+ }
3091
+ };
3092
+ function createBaseUnsetTeamRealmResponse() {
3093
+ return { message: "", blockedUsers: 0 };
3094
+ }
3095
+ var UnsetTeamRealmResponse = {
3096
+ encode(message, writer = new import_wire2.BinaryWriter()) {
3097
+ if (message.message !== "") {
3098
+ writer.uint32(10).string(message.message);
3099
+ }
3100
+ if (message.blockedUsers !== 0) {
3101
+ writer.uint32(16).int32(message.blockedUsers);
3102
+ }
3103
+ return writer;
3104
+ },
3105
+ decode(input, length) {
3106
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
3107
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
3108
+ if (previousRecursionDepth >= 100) {
3109
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3110
+ }
3111
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3112
+ try {
3113
+ const end = length === void 0 ? reader.len : reader.pos + length;
3114
+ const message = createBaseUnsetTeamRealmResponse();
3115
+ while (reader.pos < end) {
3116
+ const tag = reader.uint32();
3117
+ switch (tag >>> 3) {
3118
+ case 1: {
3119
+ if (tag !== 10) {
3120
+ break;
3121
+ }
3122
+ message.message = reader.string();
3123
+ continue;
3124
+ }
3125
+ case 2: {
3126
+ if (tag !== 16) {
3127
+ break;
3128
+ }
3129
+ message.blockedUsers = reader.int32();
3130
+ continue;
3131
+ }
3132
+ }
3133
+ if ((tag & 7) === 4 || tag === 0) {
3134
+ break;
3135
+ }
3136
+ reader.skip(tag & 7);
3137
+ }
3138
+ return message;
3139
+ } finally {
3140
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3141
+ }
3142
+ },
3143
+ fromJSON(object) {
3144
+ return {
3145
+ message: isSet(object.message) ? globalThis.String(object.message) : "",
3146
+ blockedUsers: isSet(object.blockedUsers) ? globalThis.Number(object.blockedUsers) : 0
3147
+ };
3148
+ },
3149
+ toJSON(message) {
3150
+ const obj = {};
3151
+ if (message.message !== "") {
3152
+ obj.message = message.message;
3153
+ }
3154
+ if (message.blockedUsers !== 0) {
3155
+ obj.blockedUsers = Math.round(message.blockedUsers);
3156
+ }
3157
+ return obj;
3158
+ },
3159
+ create(base) {
3160
+ return UnsetTeamRealmResponse.fromPartial(base ?? {});
3161
+ },
3162
+ fromPartial(object) {
3163
+ const message = createBaseUnsetTeamRealmResponse();
3164
+ message.message = object.message ?? "";
3165
+ message.blockedUsers = object.blockedUsers ?? 0;
3166
+ return message;
3167
+ }
3168
+ };
3169
+ function createBaseRealmMembershipRequest() {
3170
+ return { teamId: "", userId: "", type: "", force: false };
3171
+ }
3172
+ var RealmMembershipRequest = {
3173
+ encode(message, writer = new import_wire2.BinaryWriter()) {
3174
+ if (message.teamId !== "") {
3175
+ writer.uint32(10).string(message.teamId);
3176
+ }
3177
+ if (message.userId !== "") {
3178
+ writer.uint32(18).string(message.userId);
3179
+ }
3180
+ if (message.type !== "") {
3181
+ writer.uint32(26).string(message.type);
3182
+ }
3183
+ if (message.force !== false) {
3184
+ writer.uint32(32).bool(message.force);
3185
+ }
3186
+ return writer;
3187
+ },
3188
+ decode(input, length) {
3189
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
3190
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
3191
+ if (previousRecursionDepth >= 100) {
3192
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3193
+ }
3194
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3195
+ try {
3196
+ const end = length === void 0 ? reader.len : reader.pos + length;
3197
+ const message = createBaseRealmMembershipRequest();
3198
+ while (reader.pos < end) {
3199
+ const tag = reader.uint32();
3200
+ switch (tag >>> 3) {
3201
+ case 1: {
3202
+ if (tag !== 10) {
3203
+ break;
3204
+ }
3205
+ message.teamId = reader.string();
3206
+ continue;
3207
+ }
3208
+ case 2: {
3209
+ if (tag !== 18) {
3210
+ break;
3211
+ }
3212
+ message.userId = reader.string();
3213
+ continue;
3214
+ }
3215
+ case 3: {
3216
+ if (tag !== 26) {
3217
+ break;
3218
+ }
3219
+ message.type = reader.string();
3220
+ continue;
3221
+ }
3222
+ case 4: {
3223
+ if (tag !== 32) {
3224
+ break;
3225
+ }
3226
+ message.force = reader.bool();
3227
+ continue;
3228
+ }
3229
+ }
3230
+ if ((tag & 7) === 4 || tag === 0) {
3231
+ break;
3232
+ }
3233
+ reader.skip(tag & 7);
3234
+ }
3235
+ return message;
3236
+ } finally {
3237
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
3238
+ }
3239
+ },
3240
+ fromJSON(object) {
3241
+ return {
3242
+ teamId: isSet(object.teamId) ? globalThis.String(object.teamId) : "",
3243
+ userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
3244
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
3245
+ force: isSet(object.force) ? globalThis.Boolean(object.force) : false
3246
+ };
3247
+ },
3248
+ toJSON(message) {
3249
+ const obj = {};
3250
+ if (message.teamId !== "") {
3251
+ obj.teamId = message.teamId;
3252
+ }
3253
+ if (message.userId !== "") {
3254
+ obj.userId = message.userId;
3255
+ }
3256
+ if (message.type !== "") {
3257
+ obj.type = message.type;
3258
+ }
3259
+ if (message.force !== false) {
3260
+ obj.force = message.force;
3261
+ }
3262
+ return obj;
3263
+ },
3264
+ create(base) {
3265
+ return RealmMembershipRequest.fromPartial(base ?? {});
3266
+ },
3267
+ fromPartial(object) {
3268
+ const message = createBaseRealmMembershipRequest();
3269
+ message.teamId = object.teamId ?? "";
3270
+ message.userId = object.userId ?? "";
3271
+ message.type = object.type ?? "";
3272
+ message.force = object.force ?? false;
3273
+ return message;
3274
+ }
3275
+ };
3276
+ var AuthenticationDefinition = {
3277
+ name: "Authentication",
3278
+ fullName: "authentication.Authentication",
3279
+ methods: {
3280
+ userLogin: {
3281
+ name: "UserLogin",
3282
+ requestType: UserLoginRequest,
3283
+ requestStream: false,
3284
+ responseType: UserLoginResponse,
3285
+ responseStream: false,
3286
+ options: {}
3287
+ },
3288
+ userCreate: {
3289
+ name: "UserCreate",
3290
+ requestType: UserCreateRequest,
3291
+ requestStream: false,
3292
+ responseType: UserCreateResponse,
3293
+ responseStream: false,
3294
+ options: {}
3295
+ },
3296
+ userCreateByUsername: {
3297
+ name: "UserCreateByUsername",
3298
+ requestType: UserCreateByUsernameRequest,
3299
+ requestStream: false,
3300
+ responseType: UserCreateResponse,
3301
+ responseStream: false,
3302
+ options: {}
3303
+ },
3304
+ userModifyStatus: {
3305
+ name: "UserModifyStatus",
3306
+ requestType: UserModifyStatusRequest,
3307
+ requestStream: false,
3308
+ responseType: UserModifyStatusResponse,
3309
+ responseStream: false,
3310
+ options: {}
3311
+ },
3312
+ anonymousUserCreate: {
3313
+ name: "AnonymousUserCreate",
3314
+ requestType: AnonymousUserCreateRequest,
3315
+ requestStream: false,
3316
+ responseType: UserLoginResponse,
3317
+ responseStream: false,
3318
+ options: {}
3319
+ },
3320
+ changePass: {
3321
+ name: "ChangePass",
3322
+ requestType: UserChangePass,
3323
+ requestStream: false,
3324
+ responseType: UserCreateResponse,
3325
+ responseStream: false,
3326
+ options: {}
3327
+ },
3328
+ changeEmail: {
3329
+ name: "ChangeEmail",
3330
+ requestType: UserChangeEmail,
3331
+ requestStream: false,
3332
+ responseType: UserChangeEmailResponse,
3333
+ responseStream: false,
3334
+ options: {}
3335
+ },
3336
+ userDelete: {
3337
+ name: "UserDelete",
3338
+ requestType: UserDeleteRequest,
3339
+ requestStream: false,
3340
+ responseType: UserDeleteResponse,
3341
+ responseStream: false,
3342
+ options: {}
3343
+ },
3344
+ getTeam: {
3345
+ name: "GetTeam",
3346
+ requestType: GetTeamRequest,
3347
+ requestStream: false,
3348
+ responseType: Team,
3349
+ responseStream: false,
3350
+ options: {}
3351
+ },
3352
+ createTeam: {
3353
+ name: "CreateTeam",
3354
+ requestType: CreateTeamRequest,
3355
+ requestStream: false,
3356
+ responseType: Team,
3357
+ responseStream: false,
3358
+ options: {}
3359
+ },
3360
+ teamDelete: {
3361
+ name: "TeamDelete",
3362
+ requestType: TeamDeleteRequest,
3363
+ requestStream: false,
3364
+ responseType: TeamDeleteResponse,
2400
3365
  responseStream: false,
2401
3366
  options: {}
2402
3367
  },
@@ -2416,6 +3381,14 @@ var AuthenticationDefinition = {
2416
3381
  responseStream: false,
2417
3382
  options: {}
2418
3383
  },
3384
+ getUser: {
3385
+ name: "GetUser",
3386
+ requestType: GetUserRequest,
3387
+ requestStream: false,
3388
+ responseType: GetUserResponse,
3389
+ responseStream: false,
3390
+ options: {}
3391
+ },
2419
3392
  validateAccessToken: {
2420
3393
  name: "ValidateAccessToken",
2421
3394
  requestType: ValidateAccessTokenRequest,
@@ -2447,6 +3420,46 @@ var AuthenticationDefinition = {
2447
3420
  responseType: Team,
2448
3421
  responseStream: false,
2449
3422
  options: {}
3423
+ },
3424
+ setTeamRealm: {
3425
+ name: "SetTeamRealm",
3426
+ requestType: SetTeamRealmRequest,
3427
+ requestStream: false,
3428
+ responseType: RealmResponse,
3429
+ responseStream: false,
3430
+ options: {}
3431
+ },
3432
+ getRealmSettings: {
3433
+ name: "GetRealmSettings",
3434
+ requestType: GetRealmSettingsRequest,
3435
+ requestStream: false,
3436
+ responseType: RealmResponse,
3437
+ responseStream: false,
3438
+ options: {}
3439
+ },
3440
+ unsetTeamRealm: {
3441
+ name: "UnsetTeamRealm",
3442
+ requestType: UnsetTeamRealmRequest,
3443
+ requestStream: false,
3444
+ responseType: UnsetTeamRealmResponse,
3445
+ responseStream: false,
3446
+ options: {}
3447
+ },
3448
+ grantRealmMembership: {
3449
+ name: "GrantRealmMembership",
3450
+ requestType: RealmMembershipRequest,
3451
+ requestStream: false,
3452
+ responseType: Empty,
3453
+ responseStream: false,
3454
+ options: {}
3455
+ },
3456
+ revokeRealmMembership: {
3457
+ name: "RevokeRealmMembership",
3458
+ requestType: RealmMembershipRequest,
3459
+ requestStream: false,
3460
+ responseType: Empty,
3461
+ responseStream: false,
3462
+ options: {}
2450
3463
  }
2451
3464
  }
2452
3465
  };
@@ -3166,7 +4179,230 @@ var FindRelationRequest = {
3166
4179
  if (message.skip !== void 0) {
3167
4180
  writer.uint32(48).int32(message.skip);
3168
4181
  }
3169
- if (message.limit !== void 0) {
4182
+ if (message.limit !== void 0) {
4183
+ writer.uint32(56).int32(message.limit);
4184
+ }
4185
+ return writer;
4186
+ },
4187
+ decode(input, length) {
4188
+ const reader = input instanceof import_wire3.BinaryReader ? input : new import_wire3.BinaryReader(input);
4189
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
4190
+ if (previousRecursionDepth >= 100) {
4191
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
4192
+ }
4193
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
4194
+ try {
4195
+ const end = length === void 0 ? reader.len : reader.pos + length;
4196
+ const message = createBaseFindRelationRequest();
4197
+ while (reader.pos < end) {
4198
+ const tag = reader.uint32();
4199
+ switch (tag >>> 3) {
4200
+ case 1: {
4201
+ if (tag !== 10) {
4202
+ break;
4203
+ }
4204
+ message.subject = reader.string();
4205
+ continue;
4206
+ }
4207
+ case 2: {
4208
+ if (tag !== 18) {
4209
+ break;
4210
+ }
4211
+ message.relation = reader.string();
4212
+ continue;
4213
+ }
4214
+ case 3: {
4215
+ if (tag !== 26) {
4216
+ break;
4217
+ }
4218
+ message.resource = reader.string();
4219
+ continue;
4220
+ }
4221
+ case 4: {
4222
+ if (tag !== 34) {
4223
+ break;
4224
+ }
4225
+ message.subjectType = reader.string();
4226
+ continue;
4227
+ }
4228
+ case 5: {
4229
+ if (tag !== 42) {
4230
+ break;
4231
+ }
4232
+ message.resourceType = reader.string();
4233
+ continue;
4234
+ }
4235
+ case 6: {
4236
+ if (tag !== 48) {
4237
+ break;
4238
+ }
4239
+ message.skip = reader.int32();
4240
+ continue;
4241
+ }
4242
+ case 7: {
4243
+ if (tag !== 56) {
4244
+ break;
4245
+ }
4246
+ message.limit = reader.int32();
4247
+ continue;
4248
+ }
4249
+ }
4250
+ if ((tag & 7) === 4 || tag === 0) {
4251
+ break;
4252
+ }
4253
+ reader.skip(tag & 7);
4254
+ }
4255
+ return message;
4256
+ } finally {
4257
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
4258
+ }
4259
+ },
4260
+ fromJSON(object) {
4261
+ return {
4262
+ subject: isSet2(object.subject) ? globalThis.String(object.subject) : void 0,
4263
+ relation: isSet2(object.relation) ? globalThis.String(object.relation) : void 0,
4264
+ resource: isSet2(object.resource) ? globalThis.String(object.resource) : void 0,
4265
+ subjectType: isSet2(object.subjectType) ? globalThis.String(object.subjectType) : void 0,
4266
+ resourceType: isSet2(object.resourceType) ? globalThis.String(object.resourceType) : void 0,
4267
+ skip: isSet2(object.skip) ? globalThis.Number(object.skip) : void 0,
4268
+ limit: isSet2(object.limit) ? globalThis.Number(object.limit) : void 0
4269
+ };
4270
+ },
4271
+ toJSON(message) {
4272
+ const obj = {};
4273
+ if (message.subject !== void 0) {
4274
+ obj.subject = message.subject;
4275
+ }
4276
+ if (message.relation !== void 0) {
4277
+ obj.relation = message.relation;
4278
+ }
4279
+ if (message.resource !== void 0) {
4280
+ obj.resource = message.resource;
4281
+ }
4282
+ if (message.subjectType !== void 0) {
4283
+ obj.subjectType = message.subjectType;
4284
+ }
4285
+ if (message.resourceType !== void 0) {
4286
+ obj.resourceType = message.resourceType;
4287
+ }
4288
+ if (message.skip !== void 0) {
4289
+ obj.skip = Math.round(message.skip);
4290
+ }
4291
+ if (message.limit !== void 0) {
4292
+ obj.limit = Math.round(message.limit);
4293
+ }
4294
+ return obj;
4295
+ },
4296
+ create(base) {
4297
+ return FindRelationRequest.fromPartial(base ?? {});
4298
+ },
4299
+ fromPartial(object) {
4300
+ const message = createBaseFindRelationRequest();
4301
+ message.subject = object.subject ?? void 0;
4302
+ message.relation = object.relation ?? void 0;
4303
+ message.resource = object.resource ?? void 0;
4304
+ message.subjectType = object.subjectType ?? void 0;
4305
+ message.resourceType = object.resourceType ?? void 0;
4306
+ message.skip = object.skip ?? void 0;
4307
+ message.limit = object.limit ?? void 0;
4308
+ return message;
4309
+ }
4310
+ };
4311
+ function createBaseFindRelationResponse() {
4312
+ return { relations: [], count: 0 };
4313
+ }
4314
+ var FindRelationResponse = {
4315
+ encode(message, writer = new import_wire3.BinaryWriter()) {
4316
+ for (const v of message.relations) {
4317
+ Relation.encode(v, writer.uint32(10).fork()).join();
4318
+ }
4319
+ if (message.count !== 0) {
4320
+ writer.uint32(16).int32(message.count);
4321
+ }
4322
+ return writer;
4323
+ },
4324
+ decode(input, length) {
4325
+ const reader = input instanceof import_wire3.BinaryReader ? input : new import_wire3.BinaryReader(input);
4326
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
4327
+ if (previousRecursionDepth >= 100) {
4328
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
4329
+ }
4330
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
4331
+ try {
4332
+ const end = length === void 0 ? reader.len : reader.pos + length;
4333
+ const message = createBaseFindRelationResponse();
4334
+ while (reader.pos < end) {
4335
+ const tag = reader.uint32();
4336
+ switch (tag >>> 3) {
4337
+ case 1: {
4338
+ if (tag !== 10) {
4339
+ break;
4340
+ }
4341
+ message.relations.push(Relation.decode(reader, reader.uint32()));
4342
+ continue;
4343
+ }
4344
+ case 2: {
4345
+ if (tag !== 16) {
4346
+ break;
4347
+ }
4348
+ message.count = reader.int32();
4349
+ continue;
4350
+ }
4351
+ }
4352
+ if ((tag & 7) === 4 || tag === 0) {
4353
+ break;
4354
+ }
4355
+ reader.skip(tag & 7);
4356
+ }
4357
+ return message;
4358
+ } finally {
4359
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
4360
+ }
4361
+ },
4362
+ fromJSON(object) {
4363
+ return {
4364
+ relations: globalThis.Array.isArray(object?.relations) ? object.relations.map((e) => Relation.fromJSON(e)) : [],
4365
+ count: isSet2(object.count) ? globalThis.Number(object.count) : 0
4366
+ };
4367
+ },
4368
+ toJSON(message) {
4369
+ const obj = {};
4370
+ if (message.relations?.length) {
4371
+ obj.relations = message.relations.map((e) => Relation.toJSON(e));
4372
+ }
4373
+ if (message.count !== 0) {
4374
+ obj.count = Math.round(message.count);
4375
+ }
4376
+ return obj;
4377
+ },
4378
+ create(base) {
4379
+ return FindRelationResponse.fromPartial(base ?? {});
4380
+ },
4381
+ fromPartial(object) {
4382
+ const message = createBaseFindRelationResponse();
4383
+ message.relations = object.relations?.map((e) => Relation.fromPartial(e)) || [];
4384
+ message.count = object.count ?? 0;
4385
+ return message;
4386
+ }
4387
+ };
4388
+ function createBaseAllowedResourcesRequest() {
4389
+ return { subject: "", action: "", resourceType: "", skip: 0, limit: 0 };
4390
+ }
4391
+ var AllowedResourcesRequest = {
4392
+ encode(message, writer = new import_wire3.BinaryWriter()) {
4393
+ if (message.subject !== "") {
4394
+ writer.uint32(10).string(message.subject);
4395
+ }
4396
+ if (message.action !== "") {
4397
+ writer.uint32(18).string(message.action);
4398
+ }
4399
+ if (message.resourceType !== "") {
4400
+ writer.uint32(42).string(message.resourceType);
4401
+ }
4402
+ if (message.skip !== 0) {
4403
+ writer.uint32(48).int32(message.skip);
4404
+ }
4405
+ if (message.limit !== 0) {
3170
4406
  writer.uint32(56).int32(message.limit);
3171
4407
  }
3172
4408
  return writer;
@@ -3180,7 +4416,7 @@ var FindRelationRequest = {
3180
4416
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3181
4417
  try {
3182
4418
  const end = length === void 0 ? reader.len : reader.pos + length;
3183
- const message = createBaseFindRelationRequest();
4419
+ const message = createBaseAllowedResourcesRequest();
3184
4420
  while (reader.pos < end) {
3185
4421
  const tag = reader.uint32();
3186
4422
  switch (tag >>> 3) {
@@ -3195,21 +4431,7 @@ var FindRelationRequest = {
3195
4431
  if (tag !== 18) {
3196
4432
  break;
3197
4433
  }
3198
- message.relation = reader.string();
3199
- continue;
3200
- }
3201
- case 3: {
3202
- if (tag !== 26) {
3203
- break;
3204
- }
3205
- message.resource = reader.string();
3206
- continue;
3207
- }
3208
- case 4: {
3209
- if (tag !== 34) {
3210
- break;
3211
- }
3212
- message.subjectType = reader.string();
4434
+ message.action = reader.string();
3213
4435
  continue;
3214
4436
  }
3215
4437
  case 5: {
@@ -3246,62 +4468,52 @@ var FindRelationRequest = {
3246
4468
  },
3247
4469
  fromJSON(object) {
3248
4470
  return {
3249
- subject: isSet2(object.subject) ? globalThis.String(object.subject) : void 0,
3250
- relation: isSet2(object.relation) ? globalThis.String(object.relation) : void 0,
3251
- resource: isSet2(object.resource) ? globalThis.String(object.resource) : void 0,
3252
- subjectType: isSet2(object.subjectType) ? globalThis.String(object.subjectType) : void 0,
3253
- resourceType: isSet2(object.resourceType) ? globalThis.String(object.resourceType) : void 0,
3254
- skip: isSet2(object.skip) ? globalThis.Number(object.skip) : void 0,
3255
- limit: isSet2(object.limit) ? globalThis.Number(object.limit) : void 0
4471
+ subject: isSet2(object.subject) ? globalThis.String(object.subject) : "",
4472
+ action: isSet2(object.action) ? globalThis.String(object.action) : "",
4473
+ resourceType: isSet2(object.resourceType) ? globalThis.String(object.resourceType) : "",
4474
+ skip: isSet2(object.skip) ? globalThis.Number(object.skip) : 0,
4475
+ limit: isSet2(object.limit) ? globalThis.Number(object.limit) : 0
3256
4476
  };
3257
4477
  },
3258
4478
  toJSON(message) {
3259
4479
  const obj = {};
3260
- if (message.subject !== void 0) {
4480
+ if (message.subject !== "") {
3261
4481
  obj.subject = message.subject;
3262
4482
  }
3263
- if (message.relation !== void 0) {
3264
- obj.relation = message.relation;
3265
- }
3266
- if (message.resource !== void 0) {
3267
- obj.resource = message.resource;
3268
- }
3269
- if (message.subjectType !== void 0) {
3270
- obj.subjectType = message.subjectType;
4483
+ if (message.action !== "") {
4484
+ obj.action = message.action;
3271
4485
  }
3272
- if (message.resourceType !== void 0) {
4486
+ if (message.resourceType !== "") {
3273
4487
  obj.resourceType = message.resourceType;
3274
4488
  }
3275
- if (message.skip !== void 0) {
4489
+ if (message.skip !== 0) {
3276
4490
  obj.skip = Math.round(message.skip);
3277
4491
  }
3278
- if (message.limit !== void 0) {
4492
+ if (message.limit !== 0) {
3279
4493
  obj.limit = Math.round(message.limit);
3280
4494
  }
3281
4495
  return obj;
3282
4496
  },
3283
4497
  create(base) {
3284
- return FindRelationRequest.fromPartial(base ?? {});
4498
+ return AllowedResourcesRequest.fromPartial(base ?? {});
3285
4499
  },
3286
4500
  fromPartial(object) {
3287
- const message = createBaseFindRelationRequest();
3288
- message.subject = object.subject ?? void 0;
3289
- message.relation = object.relation ?? void 0;
3290
- message.resource = object.resource ?? void 0;
3291
- message.subjectType = object.subjectType ?? void 0;
3292
- message.resourceType = object.resourceType ?? void 0;
3293
- message.skip = object.skip ?? void 0;
3294
- message.limit = object.limit ?? void 0;
4501
+ const message = createBaseAllowedResourcesRequest();
4502
+ message.subject = object.subject ?? "";
4503
+ message.action = object.action ?? "";
4504
+ message.resourceType = object.resourceType ?? "";
4505
+ message.skip = object.skip ?? 0;
4506
+ message.limit = object.limit ?? 0;
3295
4507
  return message;
3296
4508
  }
3297
4509
  };
3298
- function createBaseFindRelationResponse() {
3299
- return { relations: [], count: 0 };
4510
+ function createBaseAllowedResourcesResponse() {
4511
+ return { resources: [], count: 0 };
3300
4512
  }
3301
- var FindRelationResponse = {
4513
+ var AllowedResourcesResponse = {
3302
4514
  encode(message, writer = new import_wire3.BinaryWriter()) {
3303
- for (const v of message.relations) {
3304
- Relation.encode(v, writer.uint32(10).fork()).join();
4515
+ for (const v of message.resources) {
4516
+ writer.uint32(10).string(v);
3305
4517
  }
3306
4518
  if (message.count !== 0) {
3307
4519
  writer.uint32(16).int32(message.count);
@@ -3317,7 +4529,7 @@ var FindRelationResponse = {
3317
4529
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3318
4530
  try {
3319
4531
  const end = length === void 0 ? reader.len : reader.pos + length;
3320
- const message = createBaseFindRelationResponse();
4532
+ const message = createBaseAllowedResourcesResponse();
3321
4533
  while (reader.pos < end) {
3322
4534
  const tag = reader.uint32();
3323
4535
  switch (tag >>> 3) {
@@ -3325,7 +4537,7 @@ var FindRelationResponse = {
3325
4537
  if (tag !== 10) {
3326
4538
  break;
3327
4539
  }
3328
- message.relations.push(Relation.decode(reader, reader.uint32()));
4540
+ message.resources.push(reader.string());
3329
4541
  continue;
3330
4542
  }
3331
4543
  case 2: {
@@ -3348,14 +4560,14 @@ var FindRelationResponse = {
3348
4560
  },
3349
4561
  fromJSON(object) {
3350
4562
  return {
3351
- relations: globalThis.Array.isArray(object?.relations) ? object.relations.map((e) => Relation.fromJSON(e)) : [],
4563
+ resources: globalThis.Array.isArray(object?.resources) ? object.resources.map((e) => globalThis.String(e)) : [],
3352
4564
  count: isSet2(object.count) ? globalThis.Number(object.count) : 0
3353
4565
  };
3354
4566
  },
3355
4567
  toJSON(message) {
3356
4568
  const obj = {};
3357
- if (message.relations?.length) {
3358
- obj.relations = message.relations.map((e) => Relation.toJSON(e));
4569
+ if (message.resources?.length) {
4570
+ obj.resources = message.resources;
3359
4571
  }
3360
4572
  if (message.count !== 0) {
3361
4573
  obj.count = Math.round(message.count);
@@ -3363,19 +4575,19 @@ var FindRelationResponse = {
3363
4575
  return obj;
3364
4576
  },
3365
4577
  create(base) {
3366
- return FindRelationResponse.fromPartial(base ?? {});
4578
+ return AllowedResourcesResponse.fromPartial(base ?? {});
3367
4579
  },
3368
4580
  fromPartial(object) {
3369
- const message = createBaseFindRelationResponse();
3370
- message.relations = object.relations?.map((e) => Relation.fromPartial(e)) || [];
4581
+ const message = createBaseAllowedResourcesResponse();
4582
+ message.resources = object.resources?.map((e) => e) || [];
3371
4583
  message.count = object.count ?? 0;
3372
4584
  return message;
3373
4585
  }
3374
4586
  };
3375
- function createBaseAllowedResourcesRequest() {
3376
- return { subject: "", action: "", resourceType: "", skip: 0, limit: 0 };
4587
+ function createBaseResourceAccessListRequest() {
4588
+ return { subject: "", action: "", viewName: void 0, resourceType: "" };
3377
4589
  }
3378
- var AllowedResourcesRequest = {
4590
+ var ResourceAccessListRequest = {
3379
4591
  encode(message, writer = new import_wire3.BinaryWriter()) {
3380
4592
  if (message.subject !== "") {
3381
4593
  writer.uint32(10).string(message.subject);
@@ -3383,15 +4595,12 @@ var AllowedResourcesRequest = {
3383
4595
  if (message.action !== "") {
3384
4596
  writer.uint32(18).string(message.action);
3385
4597
  }
4598
+ if (message.viewName !== void 0) {
4599
+ writer.uint32(26).string(message.viewName);
4600
+ }
3386
4601
  if (message.resourceType !== "") {
3387
4602
  writer.uint32(42).string(message.resourceType);
3388
4603
  }
3389
- if (message.skip !== 0) {
3390
- writer.uint32(48).int32(message.skip);
3391
- }
3392
- if (message.limit !== 0) {
3393
- writer.uint32(56).int32(message.limit);
3394
- }
3395
4604
  return writer;
3396
4605
  },
3397
4606
  decode(input, length) {
@@ -3403,7 +4612,7 @@ var AllowedResourcesRequest = {
3403
4612
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3404
4613
  try {
3405
4614
  const end = length === void 0 ? reader.len : reader.pos + length;
3406
- const message = createBaseAllowedResourcesRequest();
4615
+ const message = createBaseResourceAccessListRequest();
3407
4616
  while (reader.pos < end) {
3408
4617
  const tag = reader.uint32();
3409
4618
  switch (tag >>> 3) {
@@ -3421,25 +4630,18 @@ var AllowedResourcesRequest = {
3421
4630
  message.action = reader.string();
3422
4631
  continue;
3423
4632
  }
3424
- case 5: {
3425
- if (tag !== 42) {
3426
- break;
3427
- }
3428
- message.resourceType = reader.string();
3429
- continue;
3430
- }
3431
- case 6: {
3432
- if (tag !== 48) {
4633
+ case 3: {
4634
+ if (tag !== 26) {
3433
4635
  break;
3434
4636
  }
3435
- message.skip = reader.int32();
4637
+ message.viewName = reader.string();
3436
4638
  continue;
3437
4639
  }
3438
- case 7: {
3439
- if (tag !== 56) {
4640
+ case 5: {
4641
+ if (tag !== 42) {
3440
4642
  break;
3441
4643
  }
3442
- message.limit = reader.int32();
4644
+ message.resourceType = reader.string();
3443
4645
  continue;
3444
4646
  }
3445
4647
  }
@@ -3457,9 +4659,8 @@ var AllowedResourcesRequest = {
3457
4659
  return {
3458
4660
  subject: isSet2(object.subject) ? globalThis.String(object.subject) : "",
3459
4661
  action: isSet2(object.action) ? globalThis.String(object.action) : "",
3460
- resourceType: isSet2(object.resourceType) ? globalThis.String(object.resourceType) : "",
3461
- skip: isSet2(object.skip) ? globalThis.Number(object.skip) : 0,
3462
- limit: isSet2(object.limit) ? globalThis.Number(object.limit) : 0
4662
+ viewName: isSet2(object.viewName) ? globalThis.String(object.viewName) : void 0,
4663
+ resourceType: isSet2(object.resourceType) ? globalThis.String(object.resourceType) : ""
3463
4664
  };
3464
4665
  },
3465
4666
  toJSON(message) {
@@ -3470,40 +4671,99 @@ var AllowedResourcesRequest = {
3470
4671
  if (message.action !== "") {
3471
4672
  obj.action = message.action;
3472
4673
  }
4674
+ if (message.viewName !== void 0) {
4675
+ obj.viewName = message.viewName;
4676
+ }
3473
4677
  if (message.resourceType !== "") {
3474
4678
  obj.resourceType = message.resourceType;
3475
4679
  }
3476
- if (message.skip !== 0) {
3477
- obj.skip = Math.round(message.skip);
3478
- }
3479
- if (message.limit !== 0) {
3480
- obj.limit = Math.round(message.limit);
3481
- }
3482
4680
  return obj;
3483
4681
  },
3484
4682
  create(base) {
3485
- return AllowedResourcesRequest.fromPartial(base ?? {});
4683
+ return ResourceAccessListRequest.fromPartial(base ?? {});
3486
4684
  },
3487
4685
  fromPartial(object) {
3488
- const message = createBaseAllowedResourcesRequest();
4686
+ const message = createBaseResourceAccessListRequest();
3489
4687
  message.subject = object.subject ?? "";
3490
4688
  message.action = object.action ?? "";
4689
+ message.viewName = object.viewName ?? void 0;
3491
4690
  message.resourceType = object.resourceType ?? "";
3492
- message.skip = object.skip ?? 0;
3493
- message.limit = object.limit ?? 0;
3494
4691
  return message;
3495
4692
  }
3496
4693
  };
3497
- function createBaseAllowedResourcesResponse() {
3498
- return { resources: [], count: 0 };
4694
+ function createBaseResourceAccessListResponse() {
4695
+ return { viewName: "" };
3499
4696
  }
3500
- var AllowedResourcesResponse = {
4697
+ var ResourceAccessListResponse = {
3501
4698
  encode(message, writer = new import_wire3.BinaryWriter()) {
3502
- for (const v of message.resources) {
3503
- writer.uint32(10).string(v);
4699
+ if (message.viewName !== "") {
4700
+ writer.uint32(10).string(message.viewName);
3504
4701
  }
3505
- if (message.count !== 0) {
3506
- writer.uint32(16).int32(message.count);
4702
+ return writer;
4703
+ },
4704
+ decode(input, length) {
4705
+ const reader = input instanceof import_wire3.BinaryReader ? input : new import_wire3.BinaryReader(input);
4706
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
4707
+ if (previousRecursionDepth >= 100) {
4708
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
4709
+ }
4710
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
4711
+ try {
4712
+ const end = length === void 0 ? reader.len : reader.pos + length;
4713
+ const message = createBaseResourceAccessListResponse();
4714
+ while (reader.pos < end) {
4715
+ const tag = reader.uint32();
4716
+ switch (tag >>> 3) {
4717
+ case 1: {
4718
+ if (tag !== 10) {
4719
+ break;
4720
+ }
4721
+ message.viewName = reader.string();
4722
+ continue;
4723
+ }
4724
+ }
4725
+ if ((tag & 7) === 4 || tag === 0) {
4726
+ break;
4727
+ }
4728
+ reader.skip(tag & 7);
4729
+ }
4730
+ return message;
4731
+ } finally {
4732
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
4733
+ }
4734
+ },
4735
+ fromJSON(object) {
4736
+ return { viewName: isSet2(object.viewName) ? globalThis.String(object.viewName) : "" };
4737
+ },
4738
+ toJSON(message) {
4739
+ const obj = {};
4740
+ if (message.viewName !== "") {
4741
+ obj.viewName = message.viewName;
4742
+ }
4743
+ return obj;
4744
+ },
4745
+ create(base) {
4746
+ return ResourceAccessListResponse.fromPartial(base ?? {});
4747
+ },
4748
+ fromPartial(object) {
4749
+ const message = createBaseResourceAccessListResponse();
4750
+ message.viewName = object.viewName ?? "";
4751
+ return message;
4752
+ }
4753
+ };
4754
+ function createBasePermissionCheck() {
4755
+ return { subject: "", actions: [], resource: "" };
4756
+ }
4757
+ var PermissionCheck = {
4758
+ encode(message, writer = new import_wire3.BinaryWriter()) {
4759
+ if (message.subject !== "") {
4760
+ writer.uint32(10).string(message.subject);
4761
+ }
4762
+ for (const v of message.actions) {
4763
+ writer.uint32(18).string(v);
4764
+ }
4765
+ if (message.resource !== "") {
4766
+ writer.uint32(26).string(message.resource);
3507
4767
  }
3508
4768
  return writer;
3509
4769
  },
@@ -3516,7 +4776,7 @@ var AllowedResourcesResponse = {
3516
4776
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3517
4777
  try {
3518
4778
  const end = length === void 0 ? reader.len : reader.pos + length;
3519
- const message = createBaseAllowedResourcesResponse();
4779
+ const message = createBasePermissionCheck();
3520
4780
  while (reader.pos < end) {
3521
4781
  const tag = reader.uint32();
3522
4782
  switch (tag >>> 3) {
@@ -3524,14 +4784,21 @@ var AllowedResourcesResponse = {
3524
4784
  if (tag !== 10) {
3525
4785
  break;
3526
4786
  }
3527
- message.resources.push(reader.string());
4787
+ message.subject = reader.string();
3528
4788
  continue;
3529
4789
  }
3530
4790
  case 2: {
3531
- if (tag !== 16) {
4791
+ if (tag !== 18) {
3532
4792
  break;
3533
4793
  }
3534
- message.count = reader.int32();
4794
+ message.actions.push(reader.string());
4795
+ continue;
4796
+ }
4797
+ case 3: {
4798
+ if (tag !== 26) {
4799
+ break;
4800
+ }
4801
+ message.resource = reader.string();
3535
4802
  continue;
3536
4803
  }
3537
4804
  }
@@ -3547,34 +4814,39 @@ var AllowedResourcesResponse = {
3547
4814
  },
3548
4815
  fromJSON(object) {
3549
4816
  return {
3550
- resources: globalThis.Array.isArray(object?.resources) ? object.resources.map((e) => globalThis.String(e)) : [],
3551
- count: isSet2(object.count) ? globalThis.Number(object.count) : 0
4817
+ subject: isSet2(object.subject) ? globalThis.String(object.subject) : "",
4818
+ actions: globalThis.Array.isArray(object?.actions) ? object.actions.map((e) => globalThis.String(e)) : [],
4819
+ resource: isSet2(object.resource) ? globalThis.String(object.resource) : ""
3552
4820
  };
3553
4821
  },
3554
4822
  toJSON(message) {
3555
4823
  const obj = {};
3556
- if (message.resources?.length) {
3557
- obj.resources = message.resources;
4824
+ if (message.subject !== "") {
4825
+ obj.subject = message.subject;
3558
4826
  }
3559
- if (message.count !== 0) {
3560
- obj.count = Math.round(message.count);
4827
+ if (message.actions?.length) {
4828
+ obj.actions = message.actions;
4829
+ }
4830
+ if (message.resource !== "") {
4831
+ obj.resource = message.resource;
3561
4832
  }
3562
4833
  return obj;
3563
4834
  },
3564
4835
  create(base) {
3565
- return AllowedResourcesResponse.fromPartial(base ?? {});
4836
+ return PermissionCheck.fromPartial(base ?? {});
3566
4837
  },
3567
4838
  fromPartial(object) {
3568
- const message = createBaseAllowedResourcesResponse();
3569
- message.resources = object.resources?.map((e) => e) || [];
3570
- message.count = object.count ?? 0;
4839
+ const message = createBasePermissionCheck();
4840
+ message.subject = object.subject ?? "";
4841
+ message.actions = object.actions?.map((e) => e) || [];
4842
+ message.resource = object.resource ?? "";
3571
4843
  return message;
3572
4844
  }
3573
4845
  };
3574
- function createBaseResourceAccessListRequest() {
3575
- return { subject: "", action: "", viewName: void 0, resourceType: "" };
4846
+ function createBasePermissionRequest() {
4847
+ return { subject: "", action: "", resource: "" };
3576
4848
  }
3577
- var ResourceAccessListRequest = {
4849
+ var PermissionRequest = {
3578
4850
  encode(message, writer = new import_wire3.BinaryWriter()) {
3579
4851
  if (message.subject !== "") {
3580
4852
  writer.uint32(10).string(message.subject);
@@ -3582,11 +4854,8 @@ var ResourceAccessListRequest = {
3582
4854
  if (message.action !== "") {
3583
4855
  writer.uint32(18).string(message.action);
3584
4856
  }
3585
- if (message.viewName !== void 0) {
3586
- writer.uint32(26).string(message.viewName);
3587
- }
3588
- if (message.resourceType !== "") {
3589
- writer.uint32(42).string(message.resourceType);
4857
+ if (message.resource !== "") {
4858
+ writer.uint32(26).string(message.resource);
3590
4859
  }
3591
4860
  return writer;
3592
4861
  },
@@ -3599,7 +4868,7 @@ var ResourceAccessListRequest = {
3599
4868
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3600
4869
  try {
3601
4870
  const end = length === void 0 ? reader.len : reader.pos + length;
3602
- const message = createBaseResourceAccessListRequest();
4871
+ const message = createBasePermissionRequest();
3603
4872
  while (reader.pos < end) {
3604
4873
  const tag = reader.uint32();
3605
4874
  switch (tag >>> 3) {
@@ -3621,14 +4890,7 @@ var ResourceAccessListRequest = {
3621
4890
  if (tag !== 26) {
3622
4891
  break;
3623
4892
  }
3624
- message.viewName = reader.string();
3625
- continue;
3626
- }
3627
- case 5: {
3628
- if (tag !== 42) {
3629
- break;
3630
- }
3631
- message.resourceType = reader.string();
4893
+ message.resource = reader.string();
3632
4894
  continue;
3633
4895
  }
3634
4896
  }
@@ -3646,8 +4908,7 @@ var ResourceAccessListRequest = {
3646
4908
  return {
3647
4909
  subject: isSet2(object.subject) ? globalThis.String(object.subject) : "",
3648
4910
  action: isSet2(object.action) ? globalThis.String(object.action) : "",
3649
- viewName: isSet2(object.viewName) ? globalThis.String(object.viewName) : void 0,
3650
- resourceType: isSet2(object.resourceType) ? globalThis.String(object.resourceType) : ""
4911
+ resource: isSet2(object.resource) ? globalThis.String(object.resource) : ""
3651
4912
  };
3652
4913
  },
3653
4914
  toJSON(message) {
@@ -3658,33 +4919,29 @@ var ResourceAccessListRequest = {
3658
4919
  if (message.action !== "") {
3659
4920
  obj.action = message.action;
3660
4921
  }
3661
- if (message.viewName !== void 0) {
3662
- obj.viewName = message.viewName;
3663
- }
3664
- if (message.resourceType !== "") {
3665
- obj.resourceType = message.resourceType;
4922
+ if (message.resource !== "") {
4923
+ obj.resource = message.resource;
3666
4924
  }
3667
4925
  return obj;
3668
4926
  },
3669
4927
  create(base) {
3670
- return ResourceAccessListRequest.fromPartial(base ?? {});
4928
+ return PermissionRequest.fromPartial(base ?? {});
3671
4929
  },
3672
4930
  fromPartial(object) {
3673
- const message = createBaseResourceAccessListRequest();
4931
+ const message = createBasePermissionRequest();
3674
4932
  message.subject = object.subject ?? "";
3675
4933
  message.action = object.action ?? "";
3676
- message.viewName = object.viewName ?? void 0;
3677
- message.resourceType = object.resourceType ?? "";
4934
+ message.resource = object.resource ?? "";
3678
4935
  return message;
3679
4936
  }
3680
4937
  };
3681
- function createBaseResourceAccessListResponse() {
3682
- return { viewName: "" };
4938
+ function createBaseDecision() {
4939
+ return { allow: false };
3683
4940
  }
3684
- var ResourceAccessListResponse = {
4941
+ var Decision = {
3685
4942
  encode(message, writer = new import_wire3.BinaryWriter()) {
3686
- if (message.viewName !== "") {
3687
- writer.uint32(10).string(message.viewName);
4943
+ if (message.allow !== false) {
4944
+ writer.uint32(8).bool(message.allow);
3688
4945
  }
3689
4946
  return writer;
3690
4947
  },
@@ -3697,15 +4954,15 @@ var ResourceAccessListResponse = {
3697
4954
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3698
4955
  try {
3699
4956
  const end = length === void 0 ? reader.len : reader.pos + length;
3700
- const message = createBaseResourceAccessListResponse();
4957
+ const message = createBaseDecision();
3701
4958
  while (reader.pos < end) {
3702
4959
  const tag = reader.uint32();
3703
4960
  switch (tag >>> 3) {
3704
4961
  case 1: {
3705
- if (tag !== 10) {
4962
+ if (tag !== 8) {
3706
4963
  break;
3707
4964
  }
3708
- message.viewName = reader.string();
4965
+ message.allow = reader.bool();
3709
4966
  continue;
3710
4967
  }
3711
4968
  }
@@ -3720,37 +4977,37 @@ var ResourceAccessListResponse = {
3720
4977
  }
3721
4978
  },
3722
4979
  fromJSON(object) {
3723
- return { viewName: isSet2(object.viewName) ? globalThis.String(object.viewName) : "" };
4980
+ return { allow: isSet2(object.allow) ? globalThis.Boolean(object.allow) : false };
3724
4981
  },
3725
4982
  toJSON(message) {
3726
4983
  const obj = {};
3727
- if (message.viewName !== "") {
3728
- obj.viewName = message.viewName;
4984
+ if (message.allow !== false) {
4985
+ obj.allow = message.allow;
3729
4986
  }
3730
4987
  return obj;
3731
4988
  },
3732
4989
  create(base) {
3733
- return ResourceAccessListResponse.fromPartial(base ?? {});
4990
+ return Decision.fromPartial(base ?? {});
3734
4991
  },
3735
4992
  fromPartial(object) {
3736
- const message = createBaseResourceAccessListResponse();
3737
- message.viewName = object.viewName ?? "";
4993
+ const message = createBaseDecision();
4994
+ message.allow = object.allow ?? false;
3738
4995
  return message;
3739
4996
  }
3740
4997
  };
3741
- function createBasePermissionCheck() {
3742
- return { subject: "", actions: [], resource: "" };
4998
+ function createBaseSubjectPermissionsRequest() {
4999
+ return { subject: "", resource: "", actionPrefix: void 0 };
3743
5000
  }
3744
- var PermissionCheck = {
5001
+ var SubjectPermissionsRequest = {
3745
5002
  encode(message, writer = new import_wire3.BinaryWriter()) {
3746
5003
  if (message.subject !== "") {
3747
5004
  writer.uint32(10).string(message.subject);
3748
5005
  }
3749
- for (const v of message.actions) {
3750
- writer.uint32(18).string(v);
3751
- }
3752
5006
  if (message.resource !== "") {
3753
- writer.uint32(26).string(message.resource);
5007
+ writer.uint32(18).string(message.resource);
5008
+ }
5009
+ if (message.actionPrefix !== void 0) {
5010
+ writer.uint32(26).string(message.actionPrefix);
3754
5011
  }
3755
5012
  return writer;
3756
5013
  },
@@ -3763,7 +5020,7 @@ var PermissionCheck = {
3763
5020
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3764
5021
  try {
3765
5022
  const end = length === void 0 ? reader.len : reader.pos + length;
3766
- const message = createBasePermissionCheck();
5023
+ const message = createBaseSubjectPermissionsRequest();
3767
5024
  while (reader.pos < end) {
3768
5025
  const tag = reader.uint32();
3769
5026
  switch (tag >>> 3) {
@@ -3778,14 +5035,14 @@ var PermissionCheck = {
3778
5035
  if (tag !== 18) {
3779
5036
  break;
3780
5037
  }
3781
- message.actions.push(reader.string());
5038
+ message.resource = reader.string();
3782
5039
  continue;
3783
5040
  }
3784
5041
  case 3: {
3785
5042
  if (tag !== 26) {
3786
5043
  break;
3787
5044
  }
3788
- message.resource = reader.string();
5045
+ message.actionPrefix = reader.string();
3789
5046
  continue;
3790
5047
  }
3791
5048
  }
@@ -3802,8 +5059,8 @@ var PermissionCheck = {
3802
5059
  fromJSON(object) {
3803
5060
  return {
3804
5061
  subject: isSet2(object.subject) ? globalThis.String(object.subject) : "",
3805
- actions: globalThis.Array.isArray(object?.actions) ? object.actions.map((e) => globalThis.String(e)) : [],
3806
- resource: isSet2(object.resource) ? globalThis.String(object.resource) : ""
5062
+ resource: isSet2(object.resource) ? globalThis.String(object.resource) : "",
5063
+ actionPrefix: isSet2(object.actionPrefix) ? globalThis.String(object.actionPrefix) : void 0
3807
5064
  };
3808
5065
  },
3809
5066
  toJSON(message) {
@@ -3811,38 +5068,44 @@ var PermissionCheck = {
3811
5068
  if (message.subject !== "") {
3812
5069
  obj.subject = message.subject;
3813
5070
  }
3814
- if (message.actions?.length) {
3815
- obj.actions = message.actions;
3816
- }
3817
5071
  if (message.resource !== "") {
3818
5072
  obj.resource = message.resource;
3819
5073
  }
5074
+ if (message.actionPrefix !== void 0) {
5075
+ obj.actionPrefix = message.actionPrefix;
5076
+ }
3820
5077
  return obj;
3821
5078
  },
3822
5079
  create(base) {
3823
- return PermissionCheck.fromPartial(base ?? {});
5080
+ return SubjectPermissionsRequest.fromPartial(base ?? {});
3824
5081
  },
3825
5082
  fromPartial(object) {
3826
- const message = createBasePermissionCheck();
5083
+ const message = createBaseSubjectPermissionsRequest();
3827
5084
  message.subject = object.subject ?? "";
3828
- message.actions = object.actions?.map((e) => e) || [];
3829
5085
  message.resource = object.resource ?? "";
5086
+ message.actionPrefix = object.actionPrefix ?? void 0;
3830
5087
  return message;
3831
5088
  }
3832
5089
  };
3833
- function createBasePermissionRequest() {
3834
- return { subject: "", action: "", resource: "" };
5090
+ function createBaseSubjectPermission() {
5091
+ return { action: "", direct: false, inherited: false, implicit: false, allowed: false };
3835
5092
  }
3836
- var PermissionRequest = {
5093
+ var SubjectPermission = {
3837
5094
  encode(message, writer = new import_wire3.BinaryWriter()) {
3838
- if (message.subject !== "") {
3839
- writer.uint32(10).string(message.subject);
3840
- }
3841
5095
  if (message.action !== "") {
3842
- writer.uint32(18).string(message.action);
5096
+ writer.uint32(10).string(message.action);
3843
5097
  }
3844
- if (message.resource !== "") {
3845
- writer.uint32(26).string(message.resource);
5098
+ if (message.direct !== false) {
5099
+ writer.uint32(16).bool(message.direct);
5100
+ }
5101
+ if (message.inherited !== false) {
5102
+ writer.uint32(24).bool(message.inherited);
5103
+ }
5104
+ if (message.implicit !== false) {
5105
+ writer.uint32(32).bool(message.implicit);
5106
+ }
5107
+ if (message.allowed !== false) {
5108
+ writer.uint32(40).bool(message.allowed);
3846
5109
  }
3847
5110
  return writer;
3848
5111
  },
@@ -3855,7 +5118,7 @@ var PermissionRequest = {
3855
5118
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3856
5119
  try {
3857
5120
  const end = length === void 0 ? reader.len : reader.pos + length;
3858
- const message = createBasePermissionRequest();
5121
+ const message = createBaseSubjectPermission();
3859
5122
  while (reader.pos < end) {
3860
5123
  const tag = reader.uint32();
3861
5124
  switch (tag >>> 3) {
@@ -3863,21 +5126,35 @@ var PermissionRequest = {
3863
5126
  if (tag !== 10) {
3864
5127
  break;
3865
5128
  }
3866
- message.subject = reader.string();
5129
+ message.action = reader.string();
3867
5130
  continue;
3868
5131
  }
3869
5132
  case 2: {
3870
- if (tag !== 18) {
5133
+ if (tag !== 16) {
3871
5134
  break;
3872
5135
  }
3873
- message.action = reader.string();
5136
+ message.direct = reader.bool();
3874
5137
  continue;
3875
5138
  }
3876
5139
  case 3: {
3877
- if (tag !== 26) {
5140
+ if (tag !== 24) {
3878
5141
  break;
3879
5142
  }
3880
- message.resource = reader.string();
5143
+ message.inherited = reader.bool();
5144
+ continue;
5145
+ }
5146
+ case 4: {
5147
+ if (tag !== 32) {
5148
+ break;
5149
+ }
5150
+ message.implicit = reader.bool();
5151
+ continue;
5152
+ }
5153
+ case 5: {
5154
+ if (tag !== 40) {
5155
+ break;
5156
+ }
5157
+ message.allowed = reader.bool();
3881
5158
  continue;
3882
5159
  }
3883
5160
  }
@@ -3893,42 +5170,52 @@ var PermissionRequest = {
3893
5170
  },
3894
5171
  fromJSON(object) {
3895
5172
  return {
3896
- subject: isSet2(object.subject) ? globalThis.String(object.subject) : "",
3897
5173
  action: isSet2(object.action) ? globalThis.String(object.action) : "",
3898
- resource: isSet2(object.resource) ? globalThis.String(object.resource) : ""
5174
+ direct: isSet2(object.direct) ? globalThis.Boolean(object.direct) : false,
5175
+ inherited: isSet2(object.inherited) ? globalThis.Boolean(object.inherited) : false,
5176
+ implicit: isSet2(object.implicit) ? globalThis.Boolean(object.implicit) : false,
5177
+ allowed: isSet2(object.allowed) ? globalThis.Boolean(object.allowed) : false
3899
5178
  };
3900
5179
  },
3901
5180
  toJSON(message) {
3902
5181
  const obj = {};
3903
- if (message.subject !== "") {
3904
- obj.subject = message.subject;
3905
- }
3906
5182
  if (message.action !== "") {
3907
5183
  obj.action = message.action;
3908
5184
  }
3909
- if (message.resource !== "") {
3910
- obj.resource = message.resource;
5185
+ if (message.direct !== false) {
5186
+ obj.direct = message.direct;
5187
+ }
5188
+ if (message.inherited !== false) {
5189
+ obj.inherited = message.inherited;
5190
+ }
5191
+ if (message.implicit !== false) {
5192
+ obj.implicit = message.implicit;
5193
+ }
5194
+ if (message.allowed !== false) {
5195
+ obj.allowed = message.allowed;
3911
5196
  }
3912
5197
  return obj;
3913
5198
  },
3914
5199
  create(base) {
3915
- return PermissionRequest.fromPartial(base ?? {});
5200
+ return SubjectPermission.fromPartial(base ?? {});
3916
5201
  },
3917
5202
  fromPartial(object) {
3918
- const message = createBasePermissionRequest();
3919
- message.subject = object.subject ?? "";
5203
+ const message = createBaseSubjectPermission();
3920
5204
  message.action = object.action ?? "";
3921
- message.resource = object.resource ?? "";
5205
+ message.direct = object.direct ?? false;
5206
+ message.inherited = object.inherited ?? false;
5207
+ message.implicit = object.implicit ?? false;
5208
+ message.allowed = object.allowed ?? false;
3922
5209
  return message;
3923
5210
  }
3924
5211
  };
3925
- function createBaseDecision() {
3926
- return { allow: false };
5212
+ function createBaseSubjectPermissionsResponse() {
5213
+ return { permissions: [] };
3927
5214
  }
3928
- var Decision = {
5215
+ var SubjectPermissionsResponse = {
3929
5216
  encode(message, writer = new import_wire3.BinaryWriter()) {
3930
- if (message.allow !== false) {
3931
- writer.uint32(8).bool(message.allow);
5217
+ for (const v of message.permissions) {
5218
+ SubjectPermission.encode(v, writer.uint32(10).fork()).join();
3932
5219
  }
3933
5220
  return writer;
3934
5221
  },
@@ -3941,15 +5228,15 @@ var Decision = {
3941
5228
  reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
3942
5229
  try {
3943
5230
  const end = length === void 0 ? reader.len : reader.pos + length;
3944
- const message = createBaseDecision();
5231
+ const message = createBaseSubjectPermissionsResponse();
3945
5232
  while (reader.pos < end) {
3946
5233
  const tag = reader.uint32();
3947
5234
  switch (tag >>> 3) {
3948
5235
  case 1: {
3949
- if (tag !== 8) {
5236
+ if (tag !== 10) {
3950
5237
  break;
3951
5238
  }
3952
- message.allow = reader.bool();
5239
+ message.permissions.push(SubjectPermission.decode(reader, reader.uint32()));
3953
5240
  continue;
3954
5241
  }
3955
5242
  }
@@ -3964,21 +5251,23 @@ var Decision = {
3964
5251
  }
3965
5252
  },
3966
5253
  fromJSON(object) {
3967
- return { allow: isSet2(object.allow) ? globalThis.Boolean(object.allow) : false };
5254
+ return {
5255
+ permissions: globalThis.Array.isArray(object?.permissions) ? object.permissions.map((e) => SubjectPermission.fromJSON(e)) : []
5256
+ };
3968
5257
  },
3969
5258
  toJSON(message) {
3970
5259
  const obj = {};
3971
- if (message.allow !== false) {
3972
- obj.allow = message.allow;
5260
+ if (message.permissions?.length) {
5261
+ obj.permissions = message.permissions.map((e) => SubjectPermission.toJSON(e));
3973
5262
  }
3974
5263
  return obj;
3975
5264
  },
3976
5265
  create(base) {
3977
- return Decision.fromPartial(base ?? {});
5266
+ return SubjectPermissionsResponse.fromPartial(base ?? {});
3978
5267
  },
3979
5268
  fromPartial(object) {
3980
- const message = createBaseDecision();
3981
- message.allow = object.allow ?? false;
5269
+ const message = createBaseSubjectPermissionsResponse();
5270
+ message.permissions = object.permissions?.map((e) => SubjectPermission.fromPartial(e)) || [];
3982
5271
  return message;
3983
5272
  }
3984
5273
  };
@@ -4074,6 +5363,14 @@ var AuthorizationDefinition = {
4074
5363
  responseStream: false,
4075
5364
  options: {}
4076
5365
  },
5366
+ getSubjectPermissions: {
5367
+ name: "GetSubjectPermissions",
5368
+ requestType: SubjectPermissionsRequest,
5369
+ requestStream: false,
5370
+ responseType: SubjectPermissionsResponse,
5371
+ responseStream: false,
5372
+ options: {}
5373
+ },
4077
5374
  getAllowedResources: {
4078
5375
  name: "GetAllowedResources",
4079
5376
  requestType: AllowedResourcesRequest,
@@ -4355,13 +5652,95 @@ var EditMessageRequest = {
4355
5652
  message.userId = reader.string();
4356
5653
  continue;
4357
5654
  }
4358
- case 3: {
4359
- if (tag !== 26) {
4360
- break;
4361
- }
4362
- message.newMessage = reader.string();
4363
- continue;
4364
- }
5655
+ case 3: {
5656
+ if (tag !== 26) {
5657
+ break;
5658
+ }
5659
+ message.newMessage = reader.string();
5660
+ continue;
5661
+ }
5662
+ }
5663
+ if ((tag & 7) === 4 || tag === 0) {
5664
+ break;
5665
+ }
5666
+ reader.skip(tag & 7);
5667
+ }
5668
+ return message;
5669
+ } finally {
5670
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
5671
+ }
5672
+ },
5673
+ fromJSON(object) {
5674
+ return {
5675
+ messageId: isSet3(object.messageId) ? globalThis.String(object.messageId) : "",
5676
+ userId: isSet3(object.userId) ? globalThis.String(object.userId) : "",
5677
+ newMessage: isSet3(object.newMessage) ? globalThis.String(object.newMessage) : ""
5678
+ };
5679
+ },
5680
+ toJSON(message) {
5681
+ const obj = {};
5682
+ if (message.messageId !== "") {
5683
+ obj.messageId = message.messageId;
5684
+ }
5685
+ if (message.userId !== "") {
5686
+ obj.userId = message.userId;
5687
+ }
5688
+ if (message.newMessage !== "") {
5689
+ obj.newMessage = message.newMessage;
5690
+ }
5691
+ return obj;
5692
+ },
5693
+ create(base) {
5694
+ return EditMessageRequest.fromPartial(base ?? {});
5695
+ },
5696
+ fromPartial(object) {
5697
+ const message = createBaseEditMessageRequest();
5698
+ message.messageId = object.messageId ?? "";
5699
+ message.userId = object.userId ?? "";
5700
+ message.newMessage = object.newMessage ?? "";
5701
+ return message;
5702
+ }
5703
+ };
5704
+ function createBaseDeleteMessageRequest() {
5705
+ return { messageId: "", userId: "" };
5706
+ }
5707
+ var DeleteMessageRequest = {
5708
+ encode(message, writer = new import_wire4.BinaryWriter()) {
5709
+ if (message.messageId !== "") {
5710
+ writer.uint32(10).string(message.messageId);
5711
+ }
5712
+ if (message.userId !== "") {
5713
+ writer.uint32(18).string(message.userId);
5714
+ }
5715
+ return writer;
5716
+ },
5717
+ decode(input, length) {
5718
+ const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
5719
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
5720
+ if (previousRecursionDepth >= 100) {
5721
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5722
+ }
5723
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
5724
+ try {
5725
+ const end = length === void 0 ? reader.len : reader.pos + length;
5726
+ const message = createBaseDeleteMessageRequest();
5727
+ while (reader.pos < end) {
5728
+ const tag = reader.uint32();
5729
+ switch (tag >>> 3) {
5730
+ case 1: {
5731
+ if (tag !== 10) {
5732
+ break;
5733
+ }
5734
+ message.messageId = reader.string();
5735
+ continue;
5736
+ }
5737
+ case 2: {
5738
+ if (tag !== 18) {
5739
+ break;
5740
+ }
5741
+ message.userId = reader.string();
5742
+ continue;
5743
+ }
4365
5744
  }
4366
5745
  if ((tag & 7) === 4 || tag === 0) {
4367
5746
  break;
@@ -4376,8 +5755,7 @@ var EditMessageRequest = {
4376
5755
  fromJSON(object) {
4377
5756
  return {
4378
5757
  messageId: isSet3(object.messageId) ? globalThis.String(object.messageId) : "",
4379
- userId: isSet3(object.userId) ? globalThis.String(object.userId) : "",
4380
- newMessage: isSet3(object.newMessage) ? globalThis.String(object.newMessage) : ""
5758
+ userId: isSet3(object.userId) ? globalThis.String(object.userId) : ""
4381
5759
  };
4382
5760
  },
4383
5761
  toJSON(message) {
@@ -4388,19 +5766,15 @@ var EditMessageRequest = {
4388
5766
  if (message.userId !== "") {
4389
5767
  obj.userId = message.userId;
4390
5768
  }
4391
- if (message.newMessage !== "") {
4392
- obj.newMessage = message.newMessage;
4393
- }
4394
5769
  return obj;
4395
5770
  },
4396
5771
  create(base) {
4397
- return EditMessageRequest.fromPartial(base ?? {});
5772
+ return DeleteMessageRequest.fromPartial(base ?? {});
4398
5773
  },
4399
5774
  fromPartial(object) {
4400
- const message = createBaseEditMessageRequest();
5775
+ const message = createBaseDeleteMessageRequest();
4401
5776
  message.messageId = object.messageId ?? "";
4402
5777
  message.userId = object.userId ?? "";
4403
- message.newMessage = object.newMessage ?? "";
4404
5778
  return message;
4405
5779
  }
4406
5780
  };
@@ -4653,6 +6027,14 @@ var ChatDefinition = {
4653
6027
  responseType: Empty,
4654
6028
  responseStream: false,
4655
6029
  options: {}
6030
+ },
6031
+ deleteMessage: {
6032
+ name: "DeleteMessage",
6033
+ requestType: DeleteMessageRequest,
6034
+ requestStream: false,
6035
+ responseType: Empty,
6036
+ responseStream: false,
6037
+ options: {}
4656
6038
  }
4657
6039
  }
4658
6040
  };
@@ -9803,6 +11185,113 @@ function isSet4(value) {
9803
11185
 
9804
11186
  // src/protoUtils/core.ts
9805
11187
  var import_wire6 = require("@bufbuild/protobuf/wire");
11188
+ function createBaseSocketPushRequest() {
11189
+ return { event: "", data: void 0, receivers: [], rooms: [] };
11190
+ }
11191
+ var SocketPushRequest = {
11192
+ encode(message, writer = new import_wire6.BinaryWriter()) {
11193
+ if (message.event !== "") {
11194
+ writer.uint32(10).string(message.event);
11195
+ }
11196
+ if (message.data !== void 0) {
11197
+ writer.uint32(18).string(message.data);
11198
+ }
11199
+ for (const v of message.receivers) {
11200
+ writer.uint32(26).string(v);
11201
+ }
11202
+ for (const v of message.rooms) {
11203
+ writer.uint32(34).string(v);
11204
+ }
11205
+ return writer;
11206
+ },
11207
+ decode(input, length) {
11208
+ const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
11209
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
11210
+ if (previousRecursionDepth >= 100) {
11211
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
11212
+ }
11213
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
11214
+ try {
11215
+ const end = length === void 0 ? reader.len : reader.pos + length;
11216
+ const message = createBaseSocketPushRequest();
11217
+ while (reader.pos < end) {
11218
+ const tag = reader.uint32();
11219
+ switch (tag >>> 3) {
11220
+ case 1: {
11221
+ if (tag !== 10) {
11222
+ break;
11223
+ }
11224
+ message.event = reader.string();
11225
+ continue;
11226
+ }
11227
+ case 2: {
11228
+ if (tag !== 18) {
11229
+ break;
11230
+ }
11231
+ message.data = reader.string();
11232
+ continue;
11233
+ }
11234
+ case 3: {
11235
+ if (tag !== 26) {
11236
+ break;
11237
+ }
11238
+ message.receivers.push(reader.string());
11239
+ continue;
11240
+ }
11241
+ case 4: {
11242
+ if (tag !== 34) {
11243
+ break;
11244
+ }
11245
+ message.rooms.push(reader.string());
11246
+ continue;
11247
+ }
11248
+ }
11249
+ if ((tag & 7) === 4 || tag === 0) {
11250
+ break;
11251
+ }
11252
+ reader.skip(tag & 7);
11253
+ }
11254
+ return message;
11255
+ } finally {
11256
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
11257
+ }
11258
+ },
11259
+ fromJSON(object) {
11260
+ return {
11261
+ event: isSet5(object.event) ? globalThis.String(object.event) : "",
11262
+ data: isSet5(object.data) ? globalThis.String(object.data) : void 0,
11263
+ receivers: globalThis.Array.isArray(object?.receivers) ? object.receivers.map((e) => globalThis.String(e)) : [],
11264
+ rooms: globalThis.Array.isArray(object?.rooms) ? object.rooms.map((e) => globalThis.String(e)) : []
11265
+ };
11266
+ },
11267
+ toJSON(message) {
11268
+ const obj = {};
11269
+ if (message.event !== "") {
11270
+ obj.event = message.event;
11271
+ }
11272
+ if (message.data !== void 0) {
11273
+ obj.data = message.data;
11274
+ }
11275
+ if (message.receivers?.length) {
11276
+ obj.receivers = message.receivers;
11277
+ }
11278
+ if (message.rooms?.length) {
11279
+ obj.rooms = message.rooms;
11280
+ }
11281
+ return obj;
11282
+ },
11283
+ create(base) {
11284
+ return SocketPushRequest.fromPartial(base ?? {});
11285
+ },
11286
+ fromPartial(object) {
11287
+ const message = createBaseSocketPushRequest();
11288
+ message.event = object.event ?? "";
11289
+ message.data = object.data ?? void 0;
11290
+ message.receivers = object.receivers?.map((e) => e) || [];
11291
+ message.rooms = object.rooms?.map((e) => e) || [];
11292
+ return message;
11293
+ }
11294
+ };
9806
11295
  function createBaseRegisterAdminRouteRequest() {
9807
11296
  return { routes: [], routerUrl: void 0 };
9808
11297
  }
@@ -11878,6 +13367,14 @@ var AdminDefinition = {
11878
13367
  responseType: Empty,
11879
13368
  responseStream: false,
11880
13369
  options: {}
13370
+ },
13371
+ socketPush: {
13372
+ name: "SocketPush",
13373
+ requestType: SocketPushRequest,
13374
+ requestStream: false,
13375
+ responseType: Empty,
13376
+ responseStream: false,
13377
+ options: {}
11881
13378
  }
11882
13379
  }
11883
13380
  };
@@ -22561,12 +24058,12 @@ async function checkModuleHealth(clientName, serviceUrl, service = "", grpcToken
22561
24058
  }
22562
24059
  const _healthClient = clientFactory.create(HealthDefinition, channel);
22563
24060
  let error;
22564
- const status2 = await _healthClient.check({ service }).then((res) => {
24061
+ const status3 = await _healthClient.check({ service }).then((res) => {
22565
24062
  return res.status;
22566
24063
  }).catch((err) => error = err);
22567
24064
  channel.close();
22568
24065
  if (!error) {
22569
- return status2;
24066
+ return status3;
22570
24067
  }
22571
24068
  throw error;
22572
24069
  }
@@ -22893,6 +24390,11 @@ var PostgresIndexType = /* @__PURE__ */ ((PostgresIndexType2) => {
22893
24390
  PostgresIndexType2["BRIN"] = "BRIN";
22894
24391
  return PostgresIndexType2;
22895
24392
  })(PostgresIndexType || {});
24393
+ var CompatibleIndexType = /* @__PURE__ */ ((CompatibleIndexType2) => {
24394
+ CompatibleIndexType2["Ascending"] = "Ascending";
24395
+ CompatibleIndexType2["Descending"] = "Descending";
24396
+ return CompatibleIndexType2;
24397
+ })(CompatibleIndexType || {});
22896
24398
  var ConduitModelOptionsPermModifyType = [
22897
24399
  "Everything",
22898
24400
  "Nothing",
@@ -23521,6 +25023,9 @@ var Admin = class extends ConduitModule {
23521
25023
  };
23522
25024
  return this.client.registerAdminRoute(request);
23523
25025
  }
25026
+ socketPush(data) {
25027
+ return this.client.socketPush(data);
25028
+ }
23524
25029
  patchRouteMiddlewares(path, action, middlewares) {
23525
25030
  return this.client.patchRouteMiddlewares({
23526
25031
  path,
@@ -23623,6 +25128,9 @@ var Chat = class extends ConduitModule {
23623
25128
  editMessage(messageData) {
23624
25129
  return this.client.editMessage(EditMessageRequest.fromPartial(messageData));
23625
25130
  }
25131
+ deleteMessage(messageData) {
25132
+ return this.client.deleteMessage(DeleteMessageRequest.fromPartial(messageData));
25133
+ }
23626
25134
  createRoom(name, participants) {
23627
25135
  return this.client.createRoom({ name, participants });
23628
25136
  }
@@ -23666,6 +25174,16 @@ var Authorization = class extends ConduitModule {
23666
25174
  can(data) {
23667
25175
  return this.client.can(data);
23668
25176
  }
25177
+ /**
25178
+ * Lists actions declared on the resource definition.
25179
+ * A direct grant for an undeclared action can still pass `can()` and is omitted.
25180
+ * `actionPrefix` is literal (`overview` also matches `overviewer`; prefer `overview_`).
25181
+ * Subject and resource-definition changes drop the ~60s cache immediately.
25182
+ * Inherited access through an intermediate subject can lag until the TTL, as with `can()`.
25183
+ */
25184
+ getSubjectPermissions(data) {
25185
+ return this.client.getSubjectPermissions(data);
25186
+ }
23669
25187
  grantPermission(data) {
23670
25188
  return this.client.grantPermission(data);
23671
25189
  }
@@ -23681,6 +25199,7 @@ var Authorization = class extends ConduitModule {
23681
25199
  };
23682
25200
 
23683
25201
  // src/modules/authentication/index.ts
25202
+ var import_grpc_js = require("@grpc/grpc-js");
23684
25203
  var Authentication = class extends ConduitModule {
23685
25204
  constructor(moduleName, url, grpcToken) {
23686
25205
  super(moduleName, "authentication", url, grpcToken);
@@ -23688,29 +25207,79 @@ var Authentication = class extends ConduitModule {
23688
25207
  this.initializeClient(AuthenticationDefinition);
23689
25208
  }
23690
25209
  moduleName;
23691
- userLogin(userId, clientId) {
23692
- return this.client.userLogin({ userId, clientId });
25210
+ userCacheProvider;
25211
+ /**
25212
+ * Attaches a cache (or a lazy provider of one, resolved on every `getUser` call so that
25213
+ * no Redis connection is opened until it is needed) that `getUser` reads through.
25214
+ */
25215
+ attachUserCache(cache) {
25216
+ this.userCacheProvider = typeof cache === "function" ? cache : cache ? () => cache : void 0;
25217
+ }
25218
+ hasUserCache() {
25219
+ return this.userCacheProvider !== void 0;
25220
+ }
25221
+ /**
25222
+ * Fetches a user document (never includes `hashedPassword`), reading through the
25223
+ * attached user cache (5 s TTL, see UserCache) when there is one. Cache problems never
25224
+ * fail or delay the call beyond the cache's own timeout; the cache write is fire-and-forget.
25225
+ *
25226
+ * The server answers gRPC NOT_FOUND for an unknown id and this method rejects with that
25227
+ * error (an empty response is also turned into a `GrpcError` NOT_FOUND).
25228
+ */
25229
+ async getUser(userId) {
25230
+ let cache;
25231
+ try {
25232
+ cache = this.userCacheProvider?.();
25233
+ } catch {
25234
+ cache = void 0;
25235
+ }
25236
+ const cached = await cache?.get(userId);
25237
+ if (cached) return cached;
25238
+ const res = await this.client.getUser({ userId });
25239
+ if (!res?.user) {
25240
+ throw new GrpcError(import_grpc_js.status.NOT_FOUND, "User not found");
25241
+ }
25242
+ const user = JSON.parse(res.user);
25243
+ void cache?.set(userId, user);
25244
+ return user;
25245
+ }
25246
+ /**
25247
+ * Issues tokens for a user without a login. Trusted path: it runs no login strategy
25248
+ * and satisfies a realm's `requireTwoFa` policy without a 2FA step. `realm` (slug)
25249
+ * defaults to the user's home realm.
25250
+ */
25251
+ userLogin(userId, clientId, realm) {
25252
+ return this.client.userLogin({ userId, clientId, realm });
23693
25253
  }
23694
25254
  userDelete(userId) {
23695
25255
  return this.client.userDelete({ userId });
23696
25256
  }
23697
- userCreate(email, verify = false, password, anonymousId, userData) {
25257
+ userCreate(email, verify = false, password, anonymousId, userData, realm) {
23698
25258
  return this.client.userCreate({
23699
25259
  email,
23700
25260
  verify,
23701
25261
  password,
23702
25262
  anonymousId,
23703
- userData: JSON.stringify(userData)
25263
+ userData: JSON.stringify(userData),
25264
+ realm
23704
25265
  });
23705
25266
  }
23706
- userCreateByUsername(username, password, anonymousId) {
23707
- return this.client.userCreateByUsername({ username, password, anonymousId });
25267
+ userCreateByUsername(username, password, anonymousId, realm) {
25268
+ return this.client.userCreateByUsername({ username, password, anonymousId, realm });
23708
25269
  }
23709
- anonymousUserCreate(clientId) {
23710
- return this.client.anonymousUserCreate({ clientId });
25270
+ anonymousUserCreate(clientId, realm) {
25271
+ return this.client.anonymousUserCreate({ clientId, realm });
23711
25272
  }
23712
- changePass(email, password) {
23713
- return this.client.changePass({ email, password });
25273
+ /**
25274
+ * Sets a new password. `realm` picks the account when the email is held by several accounts
25275
+ * (isolated identity mode): a realm slug picks that realm's account, `'global'` picks the
25276
+ * account without a home realm. Without it such an email is refused with FAILED_PRECONDITION.
25277
+ */
25278
+ changePass(email, password, realm) {
25279
+ return this.client.changePass({ email, password, realm });
25280
+ }
25281
+ changeEmail(userId, newEmail) {
25282
+ return this.client.changeEmail({ userId, newEmail });
23714
25283
  }
23715
25284
  getTeam(teamId) {
23716
25285
  return this.client.getTeam({ teamId });
@@ -23749,6 +25318,46 @@ var Authentication = class extends ConduitModule {
23749
25318
  updateTeam(teamId, name, newParentTeamId) {
23750
25319
  return this.client.updateTeam({ teamId, name, newParentTeamId });
23751
25320
  }
25321
+ /**
25322
+ * Turns a top-level team into a realm, or updates the settings of an existing realm.
25323
+ * `settings` is the realm settings body (strategies, policies, registration, active);
25324
+ * it may carry OAuth secrets (write-only). Changing the slug of an existing realm
25325
+ * needs `force`.
25326
+ * Errors keep their gRPC code; module errors (REALM_SLUG_TAKEN, REALM_NESTED,
25327
+ * GUESTS_NOT_ALLOWED...) carry a JSON string message (`{"conduitCode", "message"}`),
25328
+ * so key on `conduitCode`.
25329
+ */
25330
+ setTeamRealm(teamId, slug, settings, force = false) {
25331
+ return this.client.setTeamRealm({
25332
+ teamId,
25333
+ slug,
25334
+ settingsJson: settings === void 0 ? void 0 : JSON.stringify(settings),
25335
+ force
25336
+ });
25337
+ }
25338
+ /** The team, its masked realm settings (`settingsJson`, no secrets) and user counts. */
25339
+ getRealmSettings(teamId) {
25340
+ return this.client.getRealmSettings({ teamId });
25341
+ }
25342
+ /** Demotes a realm. Refused while home users exist unless `force`, which blocks them. */
25343
+ unsetTeamRealm(teamId, force = false) {
25344
+ return this.client.unsetTeamRealm({ teamId, force });
25345
+ }
25346
+ /**
25347
+ * `home` makes the realm the user's home realm, `guest` adds a guest membership.
25348
+ * Fails with FAILED_PRECONDITION when `home` would replace a different home realm
25349
+ * (unless `force`, which moves the user and revokes all their tokens) and when `guest`
25350
+ * is requested for a user whose home realm is this realm.
25351
+ * Errors keep their gRPC code; module errors carry a JSON string message
25352
+ * (`{"conduitCode", "message"}`), so key on `conduitCode`.
25353
+ */
25354
+ grantRealmMembership(teamId, userId, type, force = false) {
25355
+ return this.client.grantRealmMembership({ teamId, userId, type, force });
25356
+ }
25357
+ /** Removes a guest membership (home users are moved, not removed). */
25358
+ revokeRealmMembership(teamId, userId) {
25359
+ return this.client.revokeRealmMembership({ teamId, userId, type: "", force: false });
25360
+ }
23752
25361
  };
23753
25362
 
23754
25363
  // src/modules/communications/index.ts
@@ -24037,72 +25646,136 @@ var import_crypto = __toESM(require("crypto"), 1);
24037
25646
  var EventBus = class {
24038
25647
  _clientSubscriber;
24039
25648
  _clientPublisher;
24040
- _subscribedChannels;
24041
- _subscribers;
25649
+ /** channelName -> subscriberId -> callback */
25650
+ _channelCallbacks;
25651
+ /** subscriberId -> channelName */
25652
+ _subscriberChannels;
25653
+ /** channels with a successful Redis SUBSCRIBE */
25654
+ _redisSubscribedChannels;
25655
+ _subscribeInFlight = /* @__PURE__ */ new Map();
24042
25656
  _signature;
25657
+ _anonymousSubscriberSeq = 0;
25658
+ _shuttingDown = false;
24043
25659
  constructor(redisManager) {
24044
- this._subscribedChannels = {};
24045
- this._subscribers = {};
25660
+ this._channelCallbacks = /* @__PURE__ */ new Map();
25661
+ this._subscriberChannels = /* @__PURE__ */ new Map();
25662
+ this._redisSubscribedChannels = /* @__PURE__ */ new Set();
24046
25663
  this._clientSubscriber = redisManager.getClient({ keyPrefix: "bus_" });
24047
25664
  this._clientPublisher = redisManager.getClient({ keyPrefix: "bus_" });
24048
25665
  this._signature = import_crypto.default.randomBytes(20).toString("hex");
24049
25666
  this._clientSubscriber.on("ready", () => {
24050
25667
  getLogger().log("The Bus is in the station...hehe");
24051
25668
  });
25669
+ this._clientSubscriber.on("message", (channel, message) => {
25670
+ this.dispatch(channel, message);
25671
+ });
24052
25672
  process.on("exit", () => {
24053
- this._clientSubscriber.quit();
24054
- this._clientPublisher.quit();
25673
+ this.quit();
24055
25674
  });
24056
25675
  }
25676
+ quit() {
25677
+ if (this._shuttingDown) return;
25678
+ this._shuttingDown = true;
25679
+ void this._clientSubscriber.quit();
25680
+ void this._clientPublisher.quit();
25681
+ }
24057
25682
  unsubscribe(subscriberId) {
24058
- if (this._subscribers[subscriberId]) {
24059
- const [channelName, index] = this._subscribers[subscriberId];
24060
- this._subscribedChannels[channelName].splice(index, 1);
24061
- delete this._subscribers[subscriberId];
24062
- if (this._subscribedChannels[channelName].length === 0) {
24063
- delete this._subscribedChannels[channelName];
25683
+ const channelName = this._subscriberChannels.get(subscriberId);
25684
+ if (!channelName) {
25685
+ return;
25686
+ }
25687
+ const callbacks = this._channelCallbacks.get(channelName);
25688
+ callbacks?.delete(subscriberId);
25689
+ this._subscriberChannels.delete(subscriberId);
25690
+ if (callbacks && callbacks.size === 0) {
25691
+ this._channelCallbacks.delete(channelName);
25692
+ if (this._redisSubscribedChannels.delete(channelName)) {
24064
25693
  this._clientSubscriber.unsubscribe(channelName, () => {
24065
25694
  });
24066
25695
  }
24067
25696
  }
24068
25697
  }
24069
25698
  subscribe(channelName, callback, subscriberId) {
25699
+ void this.subscribeAck(channelName, callback, subscriberId).catch((err) => {
25700
+ getLogger().error(
25701
+ `EventBus subscribe failed for ${channelName}: ${err instanceof Error ? err.message : String(err)}`
25702
+ );
25703
+ });
25704
+ }
25705
+ async subscribeAck(channelName, callback, subscriberId) {
25706
+ if (this._shuttingDown) {
25707
+ return;
25708
+ }
25709
+ const id = subscriberId ?? `anon:${channelName}:${++this._anonymousSubscriberSeq}:${import_crypto.default.randomBytes(4).toString("hex")}`;
24070
25710
  if (subscriberId) {
24071
25711
  this.unsubscribe(subscriberId);
24072
25712
  }
24073
- if (this._subscribedChannels[channelName]) {
24074
- this._subscribedChannels[channelName].push(callback);
24075
- if (subscriberId) {
24076
- this._subscribers[subscriberId] = [
24077
- channelName,
24078
- this._subscribedChannels[channelName].length - 1
24079
- ];
24080
- }
25713
+ let callbacks = this._channelCallbacks.get(channelName);
25714
+ if (!callbacks) {
25715
+ callbacks = /* @__PURE__ */ new Map();
25716
+ this._channelCallbacks.set(channelName, callbacks);
25717
+ }
25718
+ callbacks.set(id, callback);
25719
+ this._subscriberChannels.set(id, channelName);
25720
+ if (this._redisSubscribedChannels.has(channelName)) {
24081
25721
  return;
24082
25722
  }
24083
- this._subscribedChannels[channelName] = [callback];
24084
- this._clientSubscriber.subscribe(channelName, () => {
24085
- });
24086
- const self = this;
24087
- this._clientSubscriber.on("message", (channel, message) => {
24088
- if (channel !== channelName) return;
24089
- if (message.indexOf("CND_Signature") !== -1) {
24090
- if (message.indexOf(self._signature) === -1) {
24091
- self._subscribedChannels[channelName].forEach((fn) => {
24092
- fn(message.split("CND_Signature:")[0]);
24093
- });
24094
- }
24095
- } else {
24096
- self._subscribedChannels[channelName].forEach((fn) => {
24097
- fn(message);
25723
+ let inFlight = this._subscribeInFlight.get(channelName);
25724
+ if (!inFlight) {
25725
+ inFlight = new Promise((resolve, reject) => {
25726
+ this._clientSubscriber.subscribe(channelName, (err) => {
25727
+ if (err) {
25728
+ reject(err);
25729
+ return;
25730
+ }
25731
+ this._redisSubscribedChannels.add(channelName);
25732
+ resolve();
24098
25733
  });
25734
+ }).finally(() => {
25735
+ this._subscribeInFlight.delete(channelName);
25736
+ });
25737
+ this._subscribeInFlight.set(channelName, inFlight);
25738
+ }
25739
+ try {
25740
+ await inFlight;
25741
+ } catch (err) {
25742
+ if (!this._redisSubscribedChannels.has(channelName)) {
25743
+ this.removeChannelCallbacks(channelName);
24099
25744
  }
24100
- });
25745
+ this.unsubscribe(id);
25746
+ throw err;
25747
+ }
24101
25748
  }
24102
25749
  publish(channelName, message) {
24103
25750
  message = message + `CND_Signature:${this._signature}`;
24104
25751
  this._clientPublisher.publish(channelName, message);
24105
25752
  }
25753
+ removeChannelCallbacks(channelName) {
25754
+ const callbacks = this._channelCallbacks.get(channelName);
25755
+ if (!callbacks) {
25756
+ return;
25757
+ }
25758
+ for (const subId of callbacks.keys()) {
25759
+ this._subscriberChannels.delete(subId);
25760
+ }
25761
+ this._channelCallbacks.delete(channelName);
25762
+ }
25763
+ dispatch(channel, message) {
25764
+ const callbacks = this._channelCallbacks.get(channel);
25765
+ if (!callbacks || callbacks.size === 0) {
25766
+ return;
25767
+ }
25768
+ let payload = message;
25769
+ if (message.indexOf("CND_Signature") !== -1) {
25770
+ if (message.indexOf(this._signature) !== -1) {
25771
+ return;
25772
+ }
25773
+ payload = message.split("CND_Signature:")[0];
25774
+ }
25775
+ for (const fn of callbacks.values()) {
25776
+ fn(payload);
25777
+ }
25778
+ }
24106
25779
  };
24107
25780
 
24108
25781
  // src/utilities/RedisManager.ts
@@ -24140,6 +25813,22 @@ async function isLockContention(error) {
24140
25813
  );
24141
25814
  return voteErrors.length > 0 && voteErrors.every((voteError) => voteError instanceof import_redlock.ResourceLockedError);
24142
25815
  }
25816
+ var CONSUME_KEY_IF_MATCHES_SCRIPT = `
25817
+ local stored = redis.call('GET', KEYS[1])
25818
+ if not stored then return 0 end
25819
+ if stored == ARGV[1] then
25820
+ redis.call('DEL', KEYS[1], KEYS[2])
25821
+ return 1
25822
+ end
25823
+ local attempts = redis.call('INCR', KEYS[2])
25824
+ if attempts >= tonumber(ARGV[2]) then
25825
+ redis.call('DEL', KEYS[1], KEYS[2])
25826
+ elseif attempts == 1 then
25827
+ local ttl = redis.call('PTTL', KEYS[1])
25828
+ if ttl > 0 then redis.call('PEXPIRE', KEYS[2], ttl) end
25829
+ end
25830
+ return 0
25831
+ `;
24143
25832
  var StateManager = class {
24144
25833
  redisClient;
24145
25834
  redLock;
@@ -24235,10 +25924,175 @@ var StateManager = class {
24235
25924
  getKey(keyName) {
24236
25925
  return this.redisClient.get(keyName);
24237
25926
  }
25927
+ /**
25928
+ * Deletes keyName and resolves true when it holds value. A mismatch is counted in
25929
+ * attemptsKey (expiring with keyName), and the maxAttempts-th mismatch deletes keyName.
25930
+ * Both keys must share a hash tag for Redis Cluster.
25931
+ */
25932
+ async consumeKeyIfMatches(keyName, attemptsKey, value, maxAttempts) {
25933
+ const result = await this.redisClient.eval(
25934
+ CONSUME_KEY_IF_MATCHES_SCRIPT,
25935
+ 2,
25936
+ keyName,
25937
+ attemptsKey,
25938
+ value,
25939
+ maxAttempts
25940
+ );
25941
+ return result === 1;
25942
+ }
25943
+ incr(keyName) {
25944
+ return this.redisClient.incr(keyName);
25945
+ }
25946
+ };
25947
+
25948
+ // src/utilities/redisHelpers.ts
25949
+ var RedisTimeoutError = class extends Error {
25950
+ constructor(ms) {
25951
+ super(`Redis operation timed out after ${ms}ms`);
25952
+ }
25953
+ };
25954
+ function withTimeout(op, ms) {
25955
+ let timer;
25956
+ const timeout = new Promise((_, reject) => {
25957
+ timer = setTimeout(() => reject(new RedisTimeoutError(ms)), ms);
25958
+ });
25959
+ let pending;
25960
+ try {
25961
+ pending = op();
25962
+ } catch (e) {
25963
+ clearTimeout(timer);
25964
+ return Promise.reject(e);
25965
+ }
25966
+ return Promise.race([pending, timeout]).finally(() => clearTimeout(timer));
25967
+ }
25968
+ function silenceClientErrors(client, label) {
25969
+ const emitter = client;
25970
+ emitter.on?.("error", (e) => {
25971
+ const logger = getLogger();
25972
+ logger.debug?.(`${label} redis error: ${e?.message}`);
25973
+ });
25974
+ }
25975
+ async function inChunks(items, size, fn) {
25976
+ const failed = [];
25977
+ for (let i = 0; i < items.length; i += size) {
25978
+ const chunk = items.slice(i, i + size);
25979
+ try {
25980
+ await fn(chunk);
25981
+ } catch {
25982
+ failed.push(...chunk);
25983
+ }
25984
+ }
25985
+ return failed;
25986
+ }
25987
+
25988
+ // src/utilities/UserCache.ts
25989
+ var USER_CACHE_PREFIX = "auth_user_";
25990
+ var USER_CACHE_TTL_MS = 5e3;
25991
+ var OP_TIMEOUT_MS = 200;
25992
+ var CHUNK_SIZE = 100;
25993
+ var UserCache = class {
25994
+ client;
25995
+ constructor(redisManager) {
25996
+ const client = redisManager.getClient();
25997
+ silenceClientErrors(client, "UserCache");
25998
+ this.client = client;
25999
+ }
26000
+ key(id) {
26001
+ return USER_CACHE_PREFIX + id;
26002
+ }
26003
+ async get(id) {
26004
+ try {
26005
+ const raw = await withTimeout(() => this.client.get(this.key(id)), OP_TIMEOUT_MS);
26006
+ return raw ? JSON.parse(raw) : null;
26007
+ } catch {
26008
+ return null;
26009
+ }
26010
+ }
26011
+ async set(id, user) {
26012
+ try {
26013
+ await withTimeout(
26014
+ () => this.client.set(this.key(id), JSON.stringify(user), "PX", USER_CACHE_TTL_MS),
26015
+ OP_TIMEOUT_MS
26016
+ );
26017
+ } catch {
26018
+ }
26019
+ }
26020
+ async invalidate(id) {
26021
+ try {
26022
+ await withTimeout(() => this.client.del(this.key(id)), OP_TIMEOUT_MS);
26023
+ } catch {
26024
+ }
26025
+ }
26026
+ async invalidateMany(ids) {
26027
+ await inChunks(
26028
+ ids,
26029
+ CHUNK_SIZE,
26030
+ (chunk) => Promise.all(chunk.map((id) => this.invalidate(id))).then(() => void 0)
26031
+ );
26032
+ }
26033
+ };
26034
+
26035
+ // src/utilities/SessionRegistry.ts
26036
+ var SESSION_REGISTRY_PREFIX = "auth_session_";
26037
+ var OP_TIMEOUT_MS2 = 500;
26038
+ var CHUNK_SIZE2 = 100;
26039
+ var SessionRegistry = class _SessionRegistry {
26040
+ client;
26041
+ constructor(redisManager) {
26042
+ const client = redisManager.getClient();
26043
+ silenceClientErrors(client, "SessionRegistry");
26044
+ this.client = client;
26045
+ }
26046
+ key(sid) {
26047
+ return SESSION_REGISTRY_PREFIX + sid;
26048
+ }
26049
+ async run(op) {
26050
+ try {
26051
+ return await withTimeout(op, OP_TIMEOUT_MS2);
26052
+ } catch {
26053
+ throw new Error("Session registry unavailable");
26054
+ }
26055
+ }
26056
+ static ttl(ttlMs) {
26057
+ return Math.max(1, Math.ceil(ttlMs));
26058
+ }
26059
+ async register(sid, data, ttlMs) {
26060
+ const value = JSON.stringify({
26061
+ user: data.user,
26062
+ clientId: data.clientId,
26063
+ realm: data.realm ?? null
26064
+ });
26065
+ await this.run(
26066
+ () => this.client.set(this.key(sid), value, "PX", _SessionRegistry.ttl(ttlMs))
26067
+ );
26068
+ }
26069
+ /** Extends the session's lifetime. Does nothing for an unknown session. */
26070
+ async touch(sid, ttlMs) {
26071
+ await this.run(() => this.client.pexpire(this.key(sid), _SessionRegistry.ttl(ttlMs)));
26072
+ }
26073
+ async exists(sid) {
26074
+ return await this.run(() => this.client.exists(this.key(sid))) === 1;
26075
+ }
26076
+ async revoke(sid) {
26077
+ await this.run(() => this.client.del(this.key(sid)));
26078
+ }
26079
+ /** Attempts every sid; throws an Error listing the sids that could not be revoked. */
26080
+ async revokeMany(sids) {
26081
+ const failed = [];
26082
+ await inChunks(sids, CHUNK_SIZE2, async (chunk) => {
26083
+ const results = await Promise.allSettled(chunk.map((sid) => this.revoke(sid)));
26084
+ results.forEach((r, i) => {
26085
+ if (r.status === "rejected") failed.push(chunk[i]);
26086
+ });
26087
+ });
26088
+ if (failed.length > 0) {
26089
+ throw new Error(`Failed to revoke sessions: ${failed.join(", ")}`);
26090
+ }
26091
+ }
24238
26092
  };
24239
26093
 
24240
26094
  // src/index.ts
24241
- var import_grpc_js = require("@grpc/grpc-js");
26095
+ var import_grpc_js2 = require("@grpc/grpc-js");
24242
26096
  var import_fast_jwt = require("fast-jwt");
24243
26097
 
24244
26098
  // src/interfaces/Route.ts
@@ -24313,6 +26167,8 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
24313
26167
  _dynamicModules = {};
24314
26168
  _eventBus;
24315
26169
  _stateManager;
26170
+ _userCache;
26171
+ _sessionRegistry;
24316
26172
  lastSearch = Date.now();
24317
26173
  urlRemap;
24318
26174
  _serviceHealthStatusGetter;
@@ -24396,6 +26252,20 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
24396
26252
  return null;
24397
26253
  }
24398
26254
  }
26255
+ /** Redis-backed user cache. Throws when Redis is not initialized. */
26256
+ get userCache() {
26257
+ if (!this._userCache) {
26258
+ this._userCache = new UserCache(this.redisManager);
26259
+ }
26260
+ return this._userCache;
26261
+ }
26262
+ /** Redis-backed session registry. Throws when Redis is not initialized. */
26263
+ get sessionRegistry() {
26264
+ if (!this._sessionRegistry) {
26265
+ this._sessionRegistry = new SessionRegistry(this.redisManager);
26266
+ }
26267
+ return this._sessionRegistry;
26268
+ }
24399
26269
  get core() {
24400
26270
  return this._core;
24401
26271
  }
@@ -24513,7 +26383,7 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
24513
26383
  return;
24514
26384
  }
24515
26385
  } catch (err) {
24516
- if (err.code === import_grpc_js.status.PERMISSION_DENIED) {
26386
+ if (err.code === import_grpc_js2.status.PERMISSION_DENIED) {
24517
26387
  _ConduitGrpcSdk.Logger.error(err);
24518
26388
  throw err;
24519
26389
  }
@@ -24602,7 +26472,7 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
24602
26472
  this.waitForExistence(moduleName, onlyIfServing),
24603
26473
  sleep(options.timeoutMs).then(() => {
24604
26474
  throw new GrpcError(
24605
- import_grpc_js.status.DEADLINE_EXCEEDED,
26475
+ import_grpc_js2.status.DEADLINE_EXCEEDED,
24606
26476
  `awaitPeer(${moduleName}) timed out after ${options.timeoutMs}ms`
24607
26477
  );
24608
26478
  })
@@ -24791,6 +26661,11 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
24791
26661
  moduleUrl,
24792
26662
  this._grpcToken
24793
26663
  );
26664
+ if (moduleName === "authentication") {
26665
+ this._modules[moduleName].attachUserCache(
26666
+ () => this._redisManager ? this.userCache : void 0
26667
+ );
26668
+ }
24794
26669
  } else if (this._dynamicModules[moduleName]) {
24795
26670
  _ConduitGrpcSdk.Logger.info(`Creating gRPC client for ${moduleName}`);
24796
26671
  this._modules[moduleName] = new ConduitModule(
@@ -24949,6 +26824,7 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
24949
26824
  ColumnExistenceResponse,
24950
26825
  Communications,
24951
26826
  CommunicationsDefinition,
26827
+ CompatibleIndexType,
24952
26828
  ConduitAuthorizedResource,
24953
26829
  ConduitError,
24954
26830
  ConduitGrpcSdk,
@@ -24982,6 +26858,7 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
24982
26858
  DeleteEmbeddingConfigRequest,
24983
26859
  DeleteEmbeddingConfigResponse,
24984
26860
  DeleteFileResponse,
26861
+ DeleteMessageRequest,
24985
26862
  DeleteResourceRequest,
24986
26863
  DeleteRoomRequest,
24987
26864
  DeleteVectorIndexRequest,
@@ -25024,6 +26901,7 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
25024
26901
  GetMessageStatusResponse,
25025
26902
  GetNotificationTokensRequest,
25026
26903
  GetNotificationTokensResponse,
26904
+ GetRealmSettingsRequest,
25027
26905
  GetRedisDetailsResponse,
25028
26906
  GetRoomResponse,
25029
26907
  GetSchemaRequest,
@@ -25032,6 +26910,8 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
25032
26910
  GetStatusRequest,
25033
26911
  GetStatusResponse,
25034
26912
  GetTeamRequest,
26913
+ GetUserRequest,
26914
+ GetUserResponse,
25035
26915
  GrpcError,
25036
26916
  HealthCheckRequest,
25037
26917
  HealthCheckResponse,
@@ -25072,6 +26952,8 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
25072
26952
  RawQueryRequest_RawQuery,
25073
26953
  RawQueryRequest_RawQuery_MongoQuery,
25074
26954
  RawQueryRequest_RawQuery_SQLQuery,
26955
+ RealmMembershipRequest,
26956
+ RealmResponse,
25075
26957
  RegisterAdminRouteRequest,
25076
26958
  RegisterAdminRouteRequest_ConduitRouteOptions,
25077
26959
  RegisterAdminRouteRequest_ConduitRouteReturnDefinition,
@@ -25109,6 +26991,7 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
25109
26991
  Room,
25110
26992
  Router,
25111
26993
  RouterDefinition,
26994
+ SESSION_REGISTRY_PREFIX,
25112
26995
  SMS,
25113
26996
  SQLDataType,
25114
26997
  Schema,
@@ -25140,21 +27023,31 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
25140
27023
  SendWithFallbackRequest_SendCommunicationParams,
25141
27024
  SendWithFallbackResponse,
25142
27025
  SendWithFallbackResponse_ChannelResult,
27026
+ SessionRegistry,
25143
27027
  SetConfigRequest,
25144
27028
  SetConfigResponse,
25145
27029
  SetNotificationTokenRequest,
25146
27030
  SetNotificationTokenResponse,
27031
+ SetTeamRealmRequest,
25147
27032
  SocketData,
27033
+ SocketPushRequest,
25148
27034
  SocketRequest,
25149
27035
  SocketResponse,
25150
27036
  StartBackfillRequest,
25151
27037
  StartBackfillResponse,
25152
27038
  Storage,
25153
27039
  StorageDefinition,
27040
+ SubjectPermission,
27041
+ SubjectPermissionsRequest,
27042
+ SubjectPermissionsResponse,
25154
27043
  TYPE,
25155
27044
  Team,
25156
27045
  TeamDeleteRequest,
25157
27046
  TeamDeleteResponse,
27047
+ USER_CACHE_PREFIX,
27048
+ USER_CACHE_TTL_MS,
27049
+ UnsetTeamRealmRequest,
27050
+ UnsetTeamRealmResponse,
25158
27051
  UpdateCommunicationTemplateRequest,
25159
27052
  UpdateConfigRequest,
25160
27053
  UpdateConfigResponse,
@@ -25166,6 +27059,9 @@ var ConduitGrpcSdk = class _ConduitGrpcSdk {
25166
27059
  UpdateTemplateRequest,
25167
27060
  UpsertConfigRequest,
25168
27061
  UpsertConfigResponse,
27062
+ UserCache,
27063
+ UserChangeEmail,
27064
+ UserChangeEmailResponse,
25169
27065
  UserChangePass,
25170
27066
  UserCreateByUsernameRequest,
25171
27067
  UserCreateRequest,