@conduitplatform/grpc-sdk 0.17.0-alpha.7 → 0.17.0-alpha.8
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 +472 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -5
- package/dist/index.d.ts +80 -5
- package/dist/index.esm.js +467 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -521,6 +521,143 @@ var UserChangePass = {
|
|
|
521
521
|
return message;
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
|
+
function createBaseUserChangeEmail() {
|
|
525
|
+
return { userId: "", newEmail: "" };
|
|
526
|
+
}
|
|
527
|
+
var UserChangeEmail = {
|
|
528
|
+
encode(message, writer = new BinaryWriter2()) {
|
|
529
|
+
if (message.userId !== "") {
|
|
530
|
+
writer.uint32(10).string(message.userId);
|
|
531
|
+
}
|
|
532
|
+
if (message.newEmail !== "") {
|
|
533
|
+
writer.uint32(18).string(message.newEmail);
|
|
534
|
+
}
|
|
535
|
+
return writer;
|
|
536
|
+
},
|
|
537
|
+
decode(input, length) {
|
|
538
|
+
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
539
|
+
const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
|
|
540
|
+
if (previousRecursionDepth >= 100) {
|
|
541
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
542
|
+
}
|
|
543
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
544
|
+
try {
|
|
545
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
546
|
+
const message = createBaseUserChangeEmail();
|
|
547
|
+
while (reader.pos < end) {
|
|
548
|
+
const tag = reader.uint32();
|
|
549
|
+
switch (tag >>> 3) {
|
|
550
|
+
case 1: {
|
|
551
|
+
if (tag !== 10) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
message.userId = reader.string();
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
case 2: {
|
|
558
|
+
if (tag !== 18) {
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
message.newEmail = reader.string();
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
reader.skip(tag & 7);
|
|
569
|
+
}
|
|
570
|
+
return message;
|
|
571
|
+
} finally {
|
|
572
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth;
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
fromJSON(object) {
|
|
576
|
+
return {
|
|
577
|
+
userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
|
|
578
|
+
newEmail: isSet(object.newEmail) ? globalThis.String(object.newEmail) : ""
|
|
579
|
+
};
|
|
580
|
+
},
|
|
581
|
+
toJSON(message) {
|
|
582
|
+
const obj = {};
|
|
583
|
+
if (message.userId !== "") {
|
|
584
|
+
obj.userId = message.userId;
|
|
585
|
+
}
|
|
586
|
+
if (message.newEmail !== "") {
|
|
587
|
+
obj.newEmail = message.newEmail;
|
|
588
|
+
}
|
|
589
|
+
return obj;
|
|
590
|
+
},
|
|
591
|
+
create(base) {
|
|
592
|
+
return UserChangeEmail.fromPartial(base ?? {});
|
|
593
|
+
},
|
|
594
|
+
fromPartial(object) {
|
|
595
|
+
const message = createBaseUserChangeEmail();
|
|
596
|
+
message.userId = object.userId ?? "";
|
|
597
|
+
message.newEmail = object.newEmail ?? "";
|
|
598
|
+
return message;
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
function createBaseUserChangeEmailResponse() {
|
|
602
|
+
return { message: "" };
|
|
603
|
+
}
|
|
604
|
+
var UserChangeEmailResponse = {
|
|
605
|
+
encode(message, writer = new BinaryWriter2()) {
|
|
606
|
+
if (message.message !== "") {
|
|
607
|
+
writer.uint32(10).string(message.message);
|
|
608
|
+
}
|
|
609
|
+
return writer;
|
|
610
|
+
},
|
|
611
|
+
decode(input, length) {
|
|
612
|
+
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
613
|
+
const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
|
|
614
|
+
if (previousRecursionDepth >= 100) {
|
|
615
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
616
|
+
}
|
|
617
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
618
|
+
try {
|
|
619
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
620
|
+
const message = createBaseUserChangeEmailResponse();
|
|
621
|
+
while (reader.pos < end) {
|
|
622
|
+
const tag = reader.uint32();
|
|
623
|
+
switch (tag >>> 3) {
|
|
624
|
+
case 1: {
|
|
625
|
+
if (tag !== 10) {
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
message.message = reader.string();
|
|
629
|
+
continue;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
reader.skip(tag & 7);
|
|
636
|
+
}
|
|
637
|
+
return message;
|
|
638
|
+
} finally {
|
|
639
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth;
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
fromJSON(object) {
|
|
643
|
+
return { message: isSet(object.message) ? globalThis.String(object.message) : "" };
|
|
644
|
+
},
|
|
645
|
+
toJSON(message) {
|
|
646
|
+
const obj = {};
|
|
647
|
+
if (message.message !== "") {
|
|
648
|
+
obj.message = message.message;
|
|
649
|
+
}
|
|
650
|
+
return obj;
|
|
651
|
+
},
|
|
652
|
+
create(base) {
|
|
653
|
+
return UserChangeEmailResponse.fromPartial(base ?? {});
|
|
654
|
+
},
|
|
655
|
+
fromPartial(object) {
|
|
656
|
+
const message = createBaseUserChangeEmailResponse();
|
|
657
|
+
message.message = object.message ?? "";
|
|
658
|
+
return message;
|
|
659
|
+
}
|
|
660
|
+
};
|
|
524
661
|
function createBaseUserDeleteRequest() {
|
|
525
662
|
return { userId: "" };
|
|
526
663
|
}
|
|
@@ -2063,6 +2200,14 @@ var AuthenticationDefinition = {
|
|
|
2063
2200
|
responseStream: false,
|
|
2064
2201
|
options: {}
|
|
2065
2202
|
},
|
|
2203
|
+
changeEmail: {
|
|
2204
|
+
name: "ChangeEmail",
|
|
2205
|
+
requestType: UserChangeEmail,
|
|
2206
|
+
requestStream: false,
|
|
2207
|
+
responseType: UserChangeEmailResponse,
|
|
2208
|
+
responseStream: false,
|
|
2209
|
+
options: {}
|
|
2210
|
+
},
|
|
2066
2211
|
userDelete: {
|
|
2067
2212
|
name: "UserDelete",
|
|
2068
2213
|
requestType: UserDeleteRequest,
|
|
@@ -4099,6 +4244,83 @@ var EditMessageRequest = {
|
|
|
4099
4244
|
return message;
|
|
4100
4245
|
}
|
|
4101
4246
|
};
|
|
4247
|
+
function createBaseDeleteMessageRequest() {
|
|
4248
|
+
return { messageId: "", userId: "" };
|
|
4249
|
+
}
|
|
4250
|
+
var DeleteMessageRequest = {
|
|
4251
|
+
encode(message, writer = new BinaryWriter4()) {
|
|
4252
|
+
if (message.messageId !== "") {
|
|
4253
|
+
writer.uint32(10).string(message.messageId);
|
|
4254
|
+
}
|
|
4255
|
+
if (message.userId !== "") {
|
|
4256
|
+
writer.uint32(18).string(message.userId);
|
|
4257
|
+
}
|
|
4258
|
+
return writer;
|
|
4259
|
+
},
|
|
4260
|
+
decode(input, length) {
|
|
4261
|
+
const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
|
|
4262
|
+
const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
|
|
4263
|
+
if (previousRecursionDepth >= 100) {
|
|
4264
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
4265
|
+
}
|
|
4266
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
4267
|
+
try {
|
|
4268
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4269
|
+
const message = createBaseDeleteMessageRequest();
|
|
4270
|
+
while (reader.pos < end) {
|
|
4271
|
+
const tag = reader.uint32();
|
|
4272
|
+
switch (tag >>> 3) {
|
|
4273
|
+
case 1: {
|
|
4274
|
+
if (tag !== 10) {
|
|
4275
|
+
break;
|
|
4276
|
+
}
|
|
4277
|
+
message.messageId = reader.string();
|
|
4278
|
+
continue;
|
|
4279
|
+
}
|
|
4280
|
+
case 2: {
|
|
4281
|
+
if (tag !== 18) {
|
|
4282
|
+
break;
|
|
4283
|
+
}
|
|
4284
|
+
message.userId = reader.string();
|
|
4285
|
+
continue;
|
|
4286
|
+
}
|
|
4287
|
+
}
|
|
4288
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4289
|
+
break;
|
|
4290
|
+
}
|
|
4291
|
+
reader.skip(tag & 7);
|
|
4292
|
+
}
|
|
4293
|
+
return message;
|
|
4294
|
+
} finally {
|
|
4295
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth;
|
|
4296
|
+
}
|
|
4297
|
+
},
|
|
4298
|
+
fromJSON(object) {
|
|
4299
|
+
return {
|
|
4300
|
+
messageId: isSet3(object.messageId) ? globalThis.String(object.messageId) : "",
|
|
4301
|
+
userId: isSet3(object.userId) ? globalThis.String(object.userId) : ""
|
|
4302
|
+
};
|
|
4303
|
+
},
|
|
4304
|
+
toJSON(message) {
|
|
4305
|
+
const obj = {};
|
|
4306
|
+
if (message.messageId !== "") {
|
|
4307
|
+
obj.messageId = message.messageId;
|
|
4308
|
+
}
|
|
4309
|
+
if (message.userId !== "") {
|
|
4310
|
+
obj.userId = message.userId;
|
|
4311
|
+
}
|
|
4312
|
+
return obj;
|
|
4313
|
+
},
|
|
4314
|
+
create(base) {
|
|
4315
|
+
return DeleteMessageRequest.fromPartial(base ?? {});
|
|
4316
|
+
},
|
|
4317
|
+
fromPartial(object) {
|
|
4318
|
+
const message = createBaseDeleteMessageRequest();
|
|
4319
|
+
message.messageId = object.messageId ?? "";
|
|
4320
|
+
message.userId = object.userId ?? "";
|
|
4321
|
+
return message;
|
|
4322
|
+
}
|
|
4323
|
+
};
|
|
4102
4324
|
function createBaseDeleteRoomRequest() {
|
|
4103
4325
|
return { _id: "" };
|
|
4104
4326
|
}
|
|
@@ -4348,6 +4570,14 @@ var ChatDefinition = {
|
|
|
4348
4570
|
responseType: Empty,
|
|
4349
4571
|
responseStream: false,
|
|
4350
4572
|
options: {}
|
|
4573
|
+
},
|
|
4574
|
+
deleteMessage: {
|
|
4575
|
+
name: "DeleteMessage",
|
|
4576
|
+
requestType: DeleteMessageRequest,
|
|
4577
|
+
requestStream: false,
|
|
4578
|
+
responseType: Empty,
|
|
4579
|
+
responseStream: false,
|
|
4580
|
+
options: {}
|
|
4351
4581
|
}
|
|
4352
4582
|
}
|
|
4353
4583
|
};
|
|
@@ -9498,6 +9728,113 @@ function isSet4(value) {
|
|
|
9498
9728
|
|
|
9499
9729
|
// src/protoUtils/core.ts
|
|
9500
9730
|
import { BinaryReader as BinaryReader6, BinaryWriter as BinaryWriter6 } from "@bufbuild/protobuf/wire";
|
|
9731
|
+
function createBaseSocketPushRequest() {
|
|
9732
|
+
return { event: "", data: void 0, receivers: [], rooms: [] };
|
|
9733
|
+
}
|
|
9734
|
+
var SocketPushRequest = {
|
|
9735
|
+
encode(message, writer = new BinaryWriter6()) {
|
|
9736
|
+
if (message.event !== "") {
|
|
9737
|
+
writer.uint32(10).string(message.event);
|
|
9738
|
+
}
|
|
9739
|
+
if (message.data !== void 0) {
|
|
9740
|
+
writer.uint32(18).string(message.data);
|
|
9741
|
+
}
|
|
9742
|
+
for (const v of message.receivers) {
|
|
9743
|
+
writer.uint32(26).string(v);
|
|
9744
|
+
}
|
|
9745
|
+
for (const v of message.rooms) {
|
|
9746
|
+
writer.uint32(34).string(v);
|
|
9747
|
+
}
|
|
9748
|
+
return writer;
|
|
9749
|
+
},
|
|
9750
|
+
decode(input, length) {
|
|
9751
|
+
const reader = input instanceof BinaryReader6 ? input : new BinaryReader6(input);
|
|
9752
|
+
const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
|
|
9753
|
+
if (previousRecursionDepth >= 100) {
|
|
9754
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
9755
|
+
}
|
|
9756
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
9757
|
+
try {
|
|
9758
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
9759
|
+
const message = createBaseSocketPushRequest();
|
|
9760
|
+
while (reader.pos < end) {
|
|
9761
|
+
const tag = reader.uint32();
|
|
9762
|
+
switch (tag >>> 3) {
|
|
9763
|
+
case 1: {
|
|
9764
|
+
if (tag !== 10) {
|
|
9765
|
+
break;
|
|
9766
|
+
}
|
|
9767
|
+
message.event = reader.string();
|
|
9768
|
+
continue;
|
|
9769
|
+
}
|
|
9770
|
+
case 2: {
|
|
9771
|
+
if (tag !== 18) {
|
|
9772
|
+
break;
|
|
9773
|
+
}
|
|
9774
|
+
message.data = reader.string();
|
|
9775
|
+
continue;
|
|
9776
|
+
}
|
|
9777
|
+
case 3: {
|
|
9778
|
+
if (tag !== 26) {
|
|
9779
|
+
break;
|
|
9780
|
+
}
|
|
9781
|
+
message.receivers.push(reader.string());
|
|
9782
|
+
continue;
|
|
9783
|
+
}
|
|
9784
|
+
case 4: {
|
|
9785
|
+
if (tag !== 34) {
|
|
9786
|
+
break;
|
|
9787
|
+
}
|
|
9788
|
+
message.rooms.push(reader.string());
|
|
9789
|
+
continue;
|
|
9790
|
+
}
|
|
9791
|
+
}
|
|
9792
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
9793
|
+
break;
|
|
9794
|
+
}
|
|
9795
|
+
reader.skip(tag & 7);
|
|
9796
|
+
}
|
|
9797
|
+
return message;
|
|
9798
|
+
} finally {
|
|
9799
|
+
reader.__tsProtoDecodeDepth = previousRecursionDepth;
|
|
9800
|
+
}
|
|
9801
|
+
},
|
|
9802
|
+
fromJSON(object) {
|
|
9803
|
+
return {
|
|
9804
|
+
event: isSet5(object.event) ? globalThis.String(object.event) : "",
|
|
9805
|
+
data: isSet5(object.data) ? globalThis.String(object.data) : void 0,
|
|
9806
|
+
receivers: globalThis.Array.isArray(object?.receivers) ? object.receivers.map((e) => globalThis.String(e)) : [],
|
|
9807
|
+
rooms: globalThis.Array.isArray(object?.rooms) ? object.rooms.map((e) => globalThis.String(e)) : []
|
|
9808
|
+
};
|
|
9809
|
+
},
|
|
9810
|
+
toJSON(message) {
|
|
9811
|
+
const obj = {};
|
|
9812
|
+
if (message.event !== "") {
|
|
9813
|
+
obj.event = message.event;
|
|
9814
|
+
}
|
|
9815
|
+
if (message.data !== void 0) {
|
|
9816
|
+
obj.data = message.data;
|
|
9817
|
+
}
|
|
9818
|
+
if (message.receivers?.length) {
|
|
9819
|
+
obj.receivers = message.receivers;
|
|
9820
|
+
}
|
|
9821
|
+
if (message.rooms?.length) {
|
|
9822
|
+
obj.rooms = message.rooms;
|
|
9823
|
+
}
|
|
9824
|
+
return obj;
|
|
9825
|
+
},
|
|
9826
|
+
create(base) {
|
|
9827
|
+
return SocketPushRequest.fromPartial(base ?? {});
|
|
9828
|
+
},
|
|
9829
|
+
fromPartial(object) {
|
|
9830
|
+
const message = createBaseSocketPushRequest();
|
|
9831
|
+
message.event = object.event ?? "";
|
|
9832
|
+
message.data = object.data ?? void 0;
|
|
9833
|
+
message.receivers = object.receivers?.map((e) => e) || [];
|
|
9834
|
+
message.rooms = object.rooms?.map((e) => e) || [];
|
|
9835
|
+
return message;
|
|
9836
|
+
}
|
|
9837
|
+
};
|
|
9501
9838
|
function createBaseRegisterAdminRouteRequest() {
|
|
9502
9839
|
return { routes: [], routerUrl: void 0 };
|
|
9503
9840
|
}
|
|
@@ -11573,6 +11910,14 @@ var AdminDefinition = {
|
|
|
11573
11910
|
responseType: Empty,
|
|
11574
11911
|
responseStream: false,
|
|
11575
11912
|
options: {}
|
|
11913
|
+
},
|
|
11914
|
+
socketPush: {
|
|
11915
|
+
name: "SocketPush",
|
|
11916
|
+
requestType: SocketPushRequest,
|
|
11917
|
+
requestStream: false,
|
|
11918
|
+
responseType: Empty,
|
|
11919
|
+
responseStream: false,
|
|
11920
|
+
options: {}
|
|
11576
11921
|
}
|
|
11577
11922
|
}
|
|
11578
11923
|
};
|
|
@@ -22588,6 +22933,11 @@ var PostgresIndexType = /* @__PURE__ */ ((PostgresIndexType2) => {
|
|
|
22588
22933
|
PostgresIndexType2["BRIN"] = "BRIN";
|
|
22589
22934
|
return PostgresIndexType2;
|
|
22590
22935
|
})(PostgresIndexType || {});
|
|
22936
|
+
var CompatibleIndexType = /* @__PURE__ */ ((CompatibleIndexType2) => {
|
|
22937
|
+
CompatibleIndexType2["Ascending"] = "Ascending";
|
|
22938
|
+
CompatibleIndexType2["Descending"] = "Descending";
|
|
22939
|
+
return CompatibleIndexType2;
|
|
22940
|
+
})(CompatibleIndexType || {});
|
|
22591
22941
|
var ConduitModelOptionsPermModifyType = [
|
|
22592
22942
|
"Everything",
|
|
22593
22943
|
"Nothing",
|
|
@@ -23216,6 +23566,9 @@ var Admin = class extends ConduitModule {
|
|
|
23216
23566
|
};
|
|
23217
23567
|
return this.client.registerAdminRoute(request);
|
|
23218
23568
|
}
|
|
23569
|
+
socketPush(data) {
|
|
23570
|
+
return this.client.socketPush(data);
|
|
23571
|
+
}
|
|
23219
23572
|
patchRouteMiddlewares(path, action, middlewares) {
|
|
23220
23573
|
return this.client.patchRouteMiddlewares({
|
|
23221
23574
|
path,
|
|
@@ -23318,6 +23671,9 @@ var Chat = class extends ConduitModule {
|
|
|
23318
23671
|
editMessage(messageData) {
|
|
23319
23672
|
return this.client.editMessage(EditMessageRequest.fromPartial(messageData));
|
|
23320
23673
|
}
|
|
23674
|
+
deleteMessage(messageData) {
|
|
23675
|
+
return this.client.deleteMessage(DeleteMessageRequest.fromPartial(messageData));
|
|
23676
|
+
}
|
|
23321
23677
|
createRoom(name, participants) {
|
|
23322
23678
|
return this.client.createRoom({ name, participants });
|
|
23323
23679
|
}
|
|
@@ -23407,6 +23763,9 @@ var Authentication = class extends ConduitModule {
|
|
|
23407
23763
|
changePass(email, password) {
|
|
23408
23764
|
return this.client.changePass({ email, password });
|
|
23409
23765
|
}
|
|
23766
|
+
changeEmail(userId, newEmail) {
|
|
23767
|
+
return this.client.changeEmail({ userId, newEmail });
|
|
23768
|
+
}
|
|
23410
23769
|
getTeam(teamId) {
|
|
23411
23770
|
return this.client.getTeam({ teamId });
|
|
23412
23771
|
}
|
|
@@ -23732,72 +24091,136 @@ import crypto from "crypto";
|
|
|
23732
24091
|
var EventBus = class {
|
|
23733
24092
|
_clientSubscriber;
|
|
23734
24093
|
_clientPublisher;
|
|
23735
|
-
|
|
23736
|
-
|
|
24094
|
+
/** channelName -> subscriberId -> callback */
|
|
24095
|
+
_channelCallbacks;
|
|
24096
|
+
/** subscriberId -> channelName */
|
|
24097
|
+
_subscriberChannels;
|
|
24098
|
+
/** channels with a successful Redis SUBSCRIBE */
|
|
24099
|
+
_redisSubscribedChannels;
|
|
24100
|
+
_subscribeInFlight = /* @__PURE__ */ new Map();
|
|
23737
24101
|
_signature;
|
|
24102
|
+
_anonymousSubscriberSeq = 0;
|
|
24103
|
+
_shuttingDown = false;
|
|
23738
24104
|
constructor(redisManager) {
|
|
23739
|
-
this.
|
|
23740
|
-
this.
|
|
24105
|
+
this._channelCallbacks = /* @__PURE__ */ new Map();
|
|
24106
|
+
this._subscriberChannels = /* @__PURE__ */ new Map();
|
|
24107
|
+
this._redisSubscribedChannels = /* @__PURE__ */ new Set();
|
|
23741
24108
|
this._clientSubscriber = redisManager.getClient({ keyPrefix: "bus_" });
|
|
23742
24109
|
this._clientPublisher = redisManager.getClient({ keyPrefix: "bus_" });
|
|
23743
24110
|
this._signature = crypto.randomBytes(20).toString("hex");
|
|
23744
24111
|
this._clientSubscriber.on("ready", () => {
|
|
23745
24112
|
getLogger().log("The Bus is in the station...hehe");
|
|
23746
24113
|
});
|
|
24114
|
+
this._clientSubscriber.on("message", (channel, message) => {
|
|
24115
|
+
this.dispatch(channel, message);
|
|
24116
|
+
});
|
|
23747
24117
|
process.on("exit", () => {
|
|
23748
|
-
this.
|
|
23749
|
-
this._clientPublisher.quit();
|
|
24118
|
+
this.quit();
|
|
23750
24119
|
});
|
|
23751
24120
|
}
|
|
24121
|
+
quit() {
|
|
24122
|
+
if (this._shuttingDown) return;
|
|
24123
|
+
this._shuttingDown = true;
|
|
24124
|
+
void this._clientSubscriber.quit();
|
|
24125
|
+
void this._clientPublisher.quit();
|
|
24126
|
+
}
|
|
23752
24127
|
unsubscribe(subscriberId) {
|
|
23753
|
-
|
|
23754
|
-
|
|
23755
|
-
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
24128
|
+
const channelName = this._subscriberChannels.get(subscriberId);
|
|
24129
|
+
if (!channelName) {
|
|
24130
|
+
return;
|
|
24131
|
+
}
|
|
24132
|
+
const callbacks = this._channelCallbacks.get(channelName);
|
|
24133
|
+
callbacks?.delete(subscriberId);
|
|
24134
|
+
this._subscriberChannels.delete(subscriberId);
|
|
24135
|
+
if (callbacks && callbacks.size === 0) {
|
|
24136
|
+
this._channelCallbacks.delete(channelName);
|
|
24137
|
+
if (this._redisSubscribedChannels.delete(channelName)) {
|
|
23759
24138
|
this._clientSubscriber.unsubscribe(channelName, () => {
|
|
23760
24139
|
});
|
|
23761
24140
|
}
|
|
23762
24141
|
}
|
|
23763
24142
|
}
|
|
23764
24143
|
subscribe(channelName, callback, subscriberId) {
|
|
24144
|
+
void this.subscribeAck(channelName, callback, subscriberId).catch((err) => {
|
|
24145
|
+
getLogger().error(
|
|
24146
|
+
`EventBus subscribe failed for ${channelName}: ${err instanceof Error ? err.message : String(err)}`
|
|
24147
|
+
);
|
|
24148
|
+
});
|
|
24149
|
+
}
|
|
24150
|
+
async subscribeAck(channelName, callback, subscriberId) {
|
|
24151
|
+
if (this._shuttingDown) {
|
|
24152
|
+
return;
|
|
24153
|
+
}
|
|
24154
|
+
const id = subscriberId ?? `anon:${channelName}:${++this._anonymousSubscriberSeq}:${crypto.randomBytes(4).toString("hex")}`;
|
|
23765
24155
|
if (subscriberId) {
|
|
23766
24156
|
this.unsubscribe(subscriberId);
|
|
23767
24157
|
}
|
|
23768
|
-
|
|
23769
|
-
|
|
23770
|
-
|
|
23771
|
-
|
|
23772
|
-
|
|
23773
|
-
|
|
23774
|
-
|
|
23775
|
-
|
|
24158
|
+
let callbacks = this._channelCallbacks.get(channelName);
|
|
24159
|
+
if (!callbacks) {
|
|
24160
|
+
callbacks = /* @__PURE__ */ new Map();
|
|
24161
|
+
this._channelCallbacks.set(channelName, callbacks);
|
|
24162
|
+
}
|
|
24163
|
+
callbacks.set(id, callback);
|
|
24164
|
+
this._subscriberChannels.set(id, channelName);
|
|
24165
|
+
if (this._redisSubscribedChannels.has(channelName)) {
|
|
23776
24166
|
return;
|
|
23777
24167
|
}
|
|
23778
|
-
this.
|
|
23779
|
-
|
|
23780
|
-
|
|
23781
|
-
|
|
23782
|
-
|
|
23783
|
-
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
|
|
23787
|
-
|
|
23788
|
-
});
|
|
23789
|
-
}
|
|
23790
|
-
} else {
|
|
23791
|
-
self._subscribedChannels[channelName].forEach((fn) => {
|
|
23792
|
-
fn(message);
|
|
24168
|
+
let inFlight = this._subscribeInFlight.get(channelName);
|
|
24169
|
+
if (!inFlight) {
|
|
24170
|
+
inFlight = new Promise((resolve, reject) => {
|
|
24171
|
+
this._clientSubscriber.subscribe(channelName, (err) => {
|
|
24172
|
+
if (err) {
|
|
24173
|
+
reject(err);
|
|
24174
|
+
return;
|
|
24175
|
+
}
|
|
24176
|
+
this._redisSubscribedChannels.add(channelName);
|
|
24177
|
+
resolve();
|
|
23793
24178
|
});
|
|
24179
|
+
}).finally(() => {
|
|
24180
|
+
this._subscribeInFlight.delete(channelName);
|
|
24181
|
+
});
|
|
24182
|
+
this._subscribeInFlight.set(channelName, inFlight);
|
|
24183
|
+
}
|
|
24184
|
+
try {
|
|
24185
|
+
await inFlight;
|
|
24186
|
+
} catch (err) {
|
|
24187
|
+
if (!this._redisSubscribedChannels.has(channelName)) {
|
|
24188
|
+
this.removeChannelCallbacks(channelName);
|
|
23794
24189
|
}
|
|
23795
|
-
|
|
24190
|
+
this.unsubscribe(id);
|
|
24191
|
+
throw err;
|
|
24192
|
+
}
|
|
23796
24193
|
}
|
|
23797
24194
|
publish(channelName, message) {
|
|
23798
24195
|
message = message + `CND_Signature:${this._signature}`;
|
|
23799
24196
|
this._clientPublisher.publish(channelName, message);
|
|
23800
24197
|
}
|
|
24198
|
+
removeChannelCallbacks(channelName) {
|
|
24199
|
+
const callbacks = this._channelCallbacks.get(channelName);
|
|
24200
|
+
if (!callbacks) {
|
|
24201
|
+
return;
|
|
24202
|
+
}
|
|
24203
|
+
for (const subId of callbacks.keys()) {
|
|
24204
|
+
this._subscriberChannels.delete(subId);
|
|
24205
|
+
}
|
|
24206
|
+
this._channelCallbacks.delete(channelName);
|
|
24207
|
+
}
|
|
24208
|
+
dispatch(channel, message) {
|
|
24209
|
+
const callbacks = this._channelCallbacks.get(channel);
|
|
24210
|
+
if (!callbacks || callbacks.size === 0) {
|
|
24211
|
+
return;
|
|
24212
|
+
}
|
|
24213
|
+
let payload = message;
|
|
24214
|
+
if (message.indexOf("CND_Signature") !== -1) {
|
|
24215
|
+
if (message.indexOf(this._signature) !== -1) {
|
|
24216
|
+
return;
|
|
24217
|
+
}
|
|
24218
|
+
payload = message.split("CND_Signature:")[0];
|
|
24219
|
+
}
|
|
24220
|
+
for (const fn of callbacks.values()) {
|
|
24221
|
+
fn(payload);
|
|
24222
|
+
}
|
|
24223
|
+
}
|
|
23801
24224
|
};
|
|
23802
24225
|
|
|
23803
24226
|
// src/utilities/RedisManager.ts
|
|
@@ -23934,6 +24357,9 @@ var StateManager = class {
|
|
|
23934
24357
|
getKey(keyName) {
|
|
23935
24358
|
return this.redisClient.get(keyName);
|
|
23936
24359
|
}
|
|
24360
|
+
incr(keyName) {
|
|
24361
|
+
return this.redisClient.incr(keyName);
|
|
24362
|
+
}
|
|
23937
24363
|
};
|
|
23938
24364
|
|
|
23939
24365
|
// src/index.ts
|
|
@@ -24647,6 +25073,7 @@ export {
|
|
|
24647
25073
|
ColumnExistenceResponse,
|
|
24648
25074
|
Communications,
|
|
24649
25075
|
CommunicationsDefinition,
|
|
25076
|
+
CompatibleIndexType,
|
|
24650
25077
|
ConduitAuthorizedResource,
|
|
24651
25078
|
ConduitError,
|
|
24652
25079
|
ConduitGrpcSdk,
|
|
@@ -24680,6 +25107,7 @@ export {
|
|
|
24680
25107
|
DeleteEmbeddingConfigRequest,
|
|
24681
25108
|
DeleteEmbeddingConfigResponse,
|
|
24682
25109
|
DeleteFileResponse,
|
|
25110
|
+
DeleteMessageRequest,
|
|
24683
25111
|
DeleteResourceRequest,
|
|
24684
25112
|
DeleteRoomRequest,
|
|
24685
25113
|
DeleteVectorIndexRequest,
|
|
@@ -24843,6 +25271,7 @@ export {
|
|
|
24843
25271
|
SetNotificationTokenRequest,
|
|
24844
25272
|
SetNotificationTokenResponse,
|
|
24845
25273
|
SocketData,
|
|
25274
|
+
SocketPushRequest,
|
|
24846
25275
|
SocketRequest,
|
|
24847
25276
|
SocketResponse,
|
|
24848
25277
|
StartBackfillRequest,
|
|
@@ -24864,6 +25293,8 @@ export {
|
|
|
24864
25293
|
UpdateTemplateRequest,
|
|
24865
25294
|
UpsertConfigRequest,
|
|
24866
25295
|
UpsertConfigResponse,
|
|
25296
|
+
UserChangeEmail,
|
|
25297
|
+
UserChangeEmailResponse,
|
|
24867
25298
|
UserChangePass,
|
|
24868
25299
|
UserCreateByUsernameRequest,
|
|
24869
25300
|
UserCreateRequest,
|