@conduitplatform/grpc-sdk 0.17.0-alpha.4 → 0.17.0-alpha.5

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.esm.js CHANGED
@@ -3484,7 +3484,7 @@ var CreateRoomRequest = {
3484
3484
  }
3485
3485
  };
3486
3486
  function createBaseSendMessageRequest() {
3487
- return { message: "", userId: "", roomId: "", messageType: void 0, persist: void 0 };
3487
+ return { message: "", userId: "", roomId: "", messageType: void 0, persist: void 0, files: [] };
3488
3488
  }
3489
3489
  var SendMessageRequest = {
3490
3490
  encode(message, writer = new BinaryWriter4()) {
@@ -3503,6 +3503,9 @@ var SendMessageRequest = {
3503
3503
  if (message.persist !== void 0) {
3504
3504
  writer.uint32(40).bool(message.persist);
3505
3505
  }
3506
+ for (const v of message.files) {
3507
+ writer.uint32(50).string(v);
3508
+ }
3506
3509
  return writer;
3507
3510
  },
3508
3511
  decode(input, length) {
@@ -3547,6 +3550,13 @@ var SendMessageRequest = {
3547
3550
  message.persist = reader.bool();
3548
3551
  continue;
3549
3552
  }
3553
+ case 6: {
3554
+ if (tag !== 50) {
3555
+ break;
3556
+ }
3557
+ message.files.push(reader.string());
3558
+ continue;
3559
+ }
3550
3560
  }
3551
3561
  if ((tag & 7) === 4 || tag === 0) {
3552
3562
  break;
@@ -3561,7 +3571,8 @@ var SendMessageRequest = {
3561
3571
  userId: isSet3(object.userId) ? globalThis.String(object.userId) : "",
3562
3572
  roomId: isSet3(object.roomId) ? globalThis.String(object.roomId) : "",
3563
3573
  messageType: isSet3(object.messageType) ? globalThis.String(object.messageType) : void 0,
3564
- persist: isSet3(object.persist) ? globalThis.Boolean(object.persist) : void 0
3574
+ persist: isSet3(object.persist) ? globalThis.Boolean(object.persist) : void 0,
3575
+ files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => globalThis.String(e)) : []
3565
3576
  };
3566
3577
  },
3567
3578
  toJSON(message) {
@@ -3581,6 +3592,9 @@ var SendMessageRequest = {
3581
3592
  if (message.persist !== void 0) {
3582
3593
  obj.persist = message.persist;
3583
3594
  }
3595
+ if (message.files?.length) {
3596
+ obj.files = message.files;
3597
+ }
3584
3598
  return obj;
3585
3599
  },
3586
3600
  create(base) {
@@ -3593,6 +3607,7 @@ var SendMessageRequest = {
3593
3607
  message.roomId = object.roomId ?? "";
3594
3608
  message.messageType = object.messageType ?? void 0;
3595
3609
  message.persist = object.persist ?? void 0;
3610
+ message.files = object.files?.map((e) => e) || [];
3596
3611
  return message;
3597
3612
  }
3598
3613
  };
@@ -7139,15 +7154,24 @@ var SendWithFallbackResponse_ChannelResult = {
7139
7154
  }
7140
7155
  };
7141
7156
  function createBaseRegisterCommunicationTemplateRequest() {
7142
- return { name: "", template: void 0 };
7157
+ return { name: "", channels: [], description: void 0, template: void 0, variables: [] };
7143
7158
  }
7144
7159
  var RegisterCommunicationTemplateRequest = {
7145
7160
  encode(message, writer = new BinaryWriter5()) {
7146
7161
  if (message.name !== "") {
7147
7162
  writer.uint32(10).string(message.name);
7148
7163
  }
7164
+ for (const v of message.channels) {
7165
+ writer.uint32(18).string(v);
7166
+ }
7167
+ if (message.description !== void 0) {
7168
+ writer.uint32(26).string(message.description);
7169
+ }
7149
7170
  if (message.template !== void 0) {
7150
- RegisterCommunicationTemplateRequest_CommunicationTemplate.encode(message.template, writer.uint32(18).fork()).join();
7171
+ RegisterCommunicationTemplateRequest_CommunicationTemplate.encode(message.template, writer.uint32(34).fork()).join();
7172
+ }
7173
+ for (const v of message.variables) {
7174
+ writer.uint32(42).string(v);
7151
7175
  }
7152
7176
  return writer;
7153
7177
  },
@@ -7169,9 +7193,30 @@ var RegisterCommunicationTemplateRequest = {
7169
7193
  if (tag !== 18) {
7170
7194
  break;
7171
7195
  }
7196
+ message.channels.push(reader.string());
7197
+ continue;
7198
+ }
7199
+ case 3: {
7200
+ if (tag !== 26) {
7201
+ break;
7202
+ }
7203
+ message.description = reader.string();
7204
+ continue;
7205
+ }
7206
+ case 4: {
7207
+ if (tag !== 34) {
7208
+ break;
7209
+ }
7172
7210
  message.template = RegisterCommunicationTemplateRequest_CommunicationTemplate.decode(reader, reader.uint32());
7173
7211
  continue;
7174
7212
  }
7213
+ case 5: {
7214
+ if (tag !== 42) {
7215
+ break;
7216
+ }
7217
+ message.variables.push(reader.string());
7218
+ continue;
7219
+ }
7175
7220
  }
7176
7221
  if ((tag & 7) === 4 || tag === 0) {
7177
7222
  break;
@@ -7183,7 +7228,10 @@ var RegisterCommunicationTemplateRequest = {
7183
7228
  fromJSON(object) {
7184
7229
  return {
7185
7230
  name: isSet4(object.name) ? globalThis.String(object.name) : "",
7186
- template: isSet4(object.template) ? RegisterCommunicationTemplateRequest_CommunicationTemplate.fromJSON(object.template) : void 0
7231
+ channels: globalThis.Array.isArray(object?.channels) ? object.channels.map((e) => globalThis.String(e)) : [],
7232
+ description: isSet4(object.description) ? globalThis.String(object.description) : void 0,
7233
+ template: isSet4(object.template) ? RegisterCommunicationTemplateRequest_CommunicationTemplate.fromJSON(object.template) : void 0,
7234
+ variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : []
7187
7235
  };
7188
7236
  },
7189
7237
  toJSON(message) {
@@ -7191,9 +7239,18 @@ var RegisterCommunicationTemplateRequest = {
7191
7239
  if (message.name !== "") {
7192
7240
  obj.name = message.name;
7193
7241
  }
7242
+ if (message.channels?.length) {
7243
+ obj.channels = message.channels;
7244
+ }
7245
+ if (message.description !== void 0) {
7246
+ obj.description = message.description;
7247
+ }
7194
7248
  if (message.template !== void 0) {
7195
7249
  obj.template = RegisterCommunicationTemplateRequest_CommunicationTemplate.toJSON(message.template);
7196
7250
  }
7251
+ if (message.variables?.length) {
7252
+ obj.variables = message.variables;
7253
+ }
7197
7254
  return obj;
7198
7255
  },
7199
7256
  create(base) {
@@ -7202,7 +7259,10 @@ var RegisterCommunicationTemplateRequest = {
7202
7259
  fromPartial(object) {
7203
7260
  const message = createBaseRegisterCommunicationTemplateRequest();
7204
7261
  message.name = object.name ?? "";
7262
+ message.channels = object.channels?.map((e) => e) || [];
7263
+ message.description = object.description ?? void 0;
7205
7264
  message.template = object.template !== void 0 && object.template !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate.fromPartial(object.template) : void 0;
7265
+ message.variables = object.variables?.map((e) => e) || [];
7206
7266
  return message;
7207
7267
  }
7208
7268
  };
@@ -7262,10 +7322,552 @@ var RegisterCommunicationTemplateRequest_CommunicationTemplate = {
7262
7322
  if (tag !== 26) {
7263
7323
  break;
7264
7324
  }
7265
- message.sms = RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.decode(
7266
- reader,
7267
- reader.uint32()
7268
- );
7325
+ message.sms = RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.decode(
7326
+ reader,
7327
+ reader.uint32()
7328
+ );
7329
+ continue;
7330
+ }
7331
+ }
7332
+ if ((tag & 7) === 4 || tag === 0) {
7333
+ break;
7334
+ }
7335
+ reader.skip(tag & 7);
7336
+ }
7337
+ return message;
7338
+ },
7339
+ fromJSON(object) {
7340
+ return {
7341
+ email: isSet4(object.email) ? RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.fromJSON(object.email) : void 0,
7342
+ push: isSet4(object.push) ? RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.fromJSON(object.push) : void 0,
7343
+ sms: isSet4(object.sms) ? RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.fromJSON(object.sms) : void 0
7344
+ };
7345
+ },
7346
+ toJSON(message) {
7347
+ const obj = {};
7348
+ if (message.email !== void 0) {
7349
+ obj.email = RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.toJSON(message.email);
7350
+ }
7351
+ if (message.push !== void 0) {
7352
+ obj.push = RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.toJSON(message.push);
7353
+ }
7354
+ if (message.sms !== void 0) {
7355
+ obj.sms = RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.toJSON(message.sms);
7356
+ }
7357
+ return obj;
7358
+ },
7359
+ create(base) {
7360
+ return RegisterCommunicationTemplateRequest_CommunicationTemplate.fromPartial(base ?? {});
7361
+ },
7362
+ fromPartial(object) {
7363
+ const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate();
7364
+ message.email = object.email !== void 0 && object.email !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.fromPartial(object.email) : void 0;
7365
+ message.push = object.push !== void 0 && object.push !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.fromPartial(object.push) : void 0;
7366
+ message.sms = object.sms !== void 0 && object.sms !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.fromPartial(object.sms) : void 0;
7367
+ return message;
7368
+ }
7369
+ };
7370
+ function createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate() {
7371
+ return { subject: "", body: "", variables: [], sender: void 0 };
7372
+ }
7373
+ var RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate = {
7374
+ encode(message, writer = new BinaryWriter5()) {
7375
+ if (message.subject !== "") {
7376
+ writer.uint32(10).string(message.subject);
7377
+ }
7378
+ if (message.body !== "") {
7379
+ writer.uint32(18).string(message.body);
7380
+ }
7381
+ for (const v of message.variables) {
7382
+ writer.uint32(26).string(v);
7383
+ }
7384
+ if (message.sender !== void 0) {
7385
+ writer.uint32(34).string(message.sender);
7386
+ }
7387
+ return writer;
7388
+ },
7389
+ decode(input, length) {
7390
+ const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7391
+ const end = length === void 0 ? reader.len : reader.pos + length;
7392
+ const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate();
7393
+ while (reader.pos < end) {
7394
+ const tag = reader.uint32();
7395
+ switch (tag >>> 3) {
7396
+ case 1: {
7397
+ if (tag !== 10) {
7398
+ break;
7399
+ }
7400
+ message.subject = reader.string();
7401
+ continue;
7402
+ }
7403
+ case 2: {
7404
+ if (tag !== 18) {
7405
+ break;
7406
+ }
7407
+ message.body = reader.string();
7408
+ continue;
7409
+ }
7410
+ case 3: {
7411
+ if (tag !== 26) {
7412
+ break;
7413
+ }
7414
+ message.variables.push(reader.string());
7415
+ continue;
7416
+ }
7417
+ case 4: {
7418
+ if (tag !== 34) {
7419
+ break;
7420
+ }
7421
+ message.sender = reader.string();
7422
+ continue;
7423
+ }
7424
+ }
7425
+ if ((tag & 7) === 4 || tag === 0) {
7426
+ break;
7427
+ }
7428
+ reader.skip(tag & 7);
7429
+ }
7430
+ return message;
7431
+ },
7432
+ fromJSON(object) {
7433
+ return {
7434
+ subject: isSet4(object.subject) ? globalThis.String(object.subject) : "",
7435
+ body: isSet4(object.body) ? globalThis.String(object.body) : "",
7436
+ variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : [],
7437
+ sender: isSet4(object.sender) ? globalThis.String(object.sender) : void 0
7438
+ };
7439
+ },
7440
+ toJSON(message) {
7441
+ const obj = {};
7442
+ if (message.subject !== "") {
7443
+ obj.subject = message.subject;
7444
+ }
7445
+ if (message.body !== "") {
7446
+ obj.body = message.body;
7447
+ }
7448
+ if (message.variables?.length) {
7449
+ obj.variables = message.variables;
7450
+ }
7451
+ if (message.sender !== void 0) {
7452
+ obj.sender = message.sender;
7453
+ }
7454
+ return obj;
7455
+ },
7456
+ create(base) {
7457
+ return RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.fromPartial(base ?? {});
7458
+ },
7459
+ fromPartial(object) {
7460
+ const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate();
7461
+ message.subject = object.subject ?? "";
7462
+ message.body = object.body ?? "";
7463
+ message.variables = object.variables?.map((e) => e) || [];
7464
+ message.sender = object.sender ?? void 0;
7465
+ return message;
7466
+ }
7467
+ };
7468
+ function createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate() {
7469
+ return { title: "", body: "", variables: [] };
7470
+ }
7471
+ var RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate = {
7472
+ encode(message, writer = new BinaryWriter5()) {
7473
+ if (message.title !== "") {
7474
+ writer.uint32(10).string(message.title);
7475
+ }
7476
+ if (message.body !== "") {
7477
+ writer.uint32(18).string(message.body);
7478
+ }
7479
+ for (const v of message.variables) {
7480
+ writer.uint32(26).string(v);
7481
+ }
7482
+ return writer;
7483
+ },
7484
+ decode(input, length) {
7485
+ const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7486
+ const end = length === void 0 ? reader.len : reader.pos + length;
7487
+ const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate();
7488
+ while (reader.pos < end) {
7489
+ const tag = reader.uint32();
7490
+ switch (tag >>> 3) {
7491
+ case 1: {
7492
+ if (tag !== 10) {
7493
+ break;
7494
+ }
7495
+ message.title = reader.string();
7496
+ continue;
7497
+ }
7498
+ case 2: {
7499
+ if (tag !== 18) {
7500
+ break;
7501
+ }
7502
+ message.body = reader.string();
7503
+ continue;
7504
+ }
7505
+ case 3: {
7506
+ if (tag !== 26) {
7507
+ break;
7508
+ }
7509
+ message.variables.push(reader.string());
7510
+ continue;
7511
+ }
7512
+ }
7513
+ if ((tag & 7) === 4 || tag === 0) {
7514
+ break;
7515
+ }
7516
+ reader.skip(tag & 7);
7517
+ }
7518
+ return message;
7519
+ },
7520
+ fromJSON(object) {
7521
+ return {
7522
+ title: isSet4(object.title) ? globalThis.String(object.title) : "",
7523
+ body: isSet4(object.body) ? globalThis.String(object.body) : "",
7524
+ variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : []
7525
+ };
7526
+ },
7527
+ toJSON(message) {
7528
+ const obj = {};
7529
+ if (message.title !== "") {
7530
+ obj.title = message.title;
7531
+ }
7532
+ if (message.body !== "") {
7533
+ obj.body = message.body;
7534
+ }
7535
+ if (message.variables?.length) {
7536
+ obj.variables = message.variables;
7537
+ }
7538
+ return obj;
7539
+ },
7540
+ create(base) {
7541
+ return RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.fromPartial(base ?? {});
7542
+ },
7543
+ fromPartial(object) {
7544
+ const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate();
7545
+ message.title = object.title ?? "";
7546
+ message.body = object.body ?? "";
7547
+ message.variables = object.variables?.map((e) => e) || [];
7548
+ return message;
7549
+ }
7550
+ };
7551
+ function createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate() {
7552
+ return { message: "", variables: [] };
7553
+ }
7554
+ var RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate = {
7555
+ encode(message, writer = new BinaryWriter5()) {
7556
+ if (message.message !== "") {
7557
+ writer.uint32(10).string(message.message);
7558
+ }
7559
+ for (const v of message.variables) {
7560
+ writer.uint32(18).string(v);
7561
+ }
7562
+ return writer;
7563
+ },
7564
+ decode(input, length) {
7565
+ const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7566
+ const end = length === void 0 ? reader.len : reader.pos + length;
7567
+ const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate();
7568
+ while (reader.pos < end) {
7569
+ const tag = reader.uint32();
7570
+ switch (tag >>> 3) {
7571
+ case 1: {
7572
+ if (tag !== 10) {
7573
+ break;
7574
+ }
7575
+ message.message = reader.string();
7576
+ continue;
7577
+ }
7578
+ case 2: {
7579
+ if (tag !== 18) {
7580
+ break;
7581
+ }
7582
+ message.variables.push(reader.string());
7583
+ continue;
7584
+ }
7585
+ }
7586
+ if ((tag & 7) === 4 || tag === 0) {
7587
+ break;
7588
+ }
7589
+ reader.skip(tag & 7);
7590
+ }
7591
+ return message;
7592
+ },
7593
+ fromJSON(object) {
7594
+ return {
7595
+ message: isSet4(object.message) ? globalThis.String(object.message) : "",
7596
+ variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : []
7597
+ };
7598
+ },
7599
+ toJSON(message) {
7600
+ const obj = {};
7601
+ if (message.message !== "") {
7602
+ obj.message = message.message;
7603
+ }
7604
+ if (message.variables?.length) {
7605
+ obj.variables = message.variables;
7606
+ }
7607
+ return obj;
7608
+ },
7609
+ create(base) {
7610
+ return RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.fromPartial(base ?? {});
7611
+ },
7612
+ fromPartial(object) {
7613
+ const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate();
7614
+ message.message = object.message ?? "";
7615
+ message.variables = object.variables?.map((e) => e) || [];
7616
+ return message;
7617
+ }
7618
+ };
7619
+ function createBaseRegisterCommunicationTemplateResponse() {
7620
+ return { template: "" };
7621
+ }
7622
+ var RegisterCommunicationTemplateResponse = {
7623
+ encode(message, writer = new BinaryWriter5()) {
7624
+ if (message.template !== "") {
7625
+ writer.uint32(10).string(message.template);
7626
+ }
7627
+ return writer;
7628
+ },
7629
+ decode(input, length) {
7630
+ const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7631
+ const end = length === void 0 ? reader.len : reader.pos + length;
7632
+ const message = createBaseRegisterCommunicationTemplateResponse();
7633
+ while (reader.pos < end) {
7634
+ const tag = reader.uint32();
7635
+ switch (tag >>> 3) {
7636
+ case 1: {
7637
+ if (tag !== 10) {
7638
+ break;
7639
+ }
7640
+ message.template = reader.string();
7641
+ continue;
7642
+ }
7643
+ }
7644
+ if ((tag & 7) === 4 || tag === 0) {
7645
+ break;
7646
+ }
7647
+ reader.skip(tag & 7);
7648
+ }
7649
+ return message;
7650
+ },
7651
+ fromJSON(object) {
7652
+ return { template: isSet4(object.template) ? globalThis.String(object.template) : "" };
7653
+ },
7654
+ toJSON(message) {
7655
+ const obj = {};
7656
+ if (message.template !== "") {
7657
+ obj.template = message.template;
7658
+ }
7659
+ return obj;
7660
+ },
7661
+ create(base) {
7662
+ return RegisterCommunicationTemplateResponse.fromPartial(base ?? {});
7663
+ },
7664
+ fromPartial(object) {
7665
+ const message = createBaseRegisterCommunicationTemplateResponse();
7666
+ message.template = object.template ?? "";
7667
+ return message;
7668
+ }
7669
+ };
7670
+ function createBaseUpdateCommunicationTemplateRequest() {
7671
+ return { id: "", name: void 0, channels: [], description: void 0, template: void 0, variables: [] };
7672
+ }
7673
+ var UpdateCommunicationTemplateRequest = {
7674
+ encode(message, writer = new BinaryWriter5()) {
7675
+ if (message.id !== "") {
7676
+ writer.uint32(10).string(message.id);
7677
+ }
7678
+ if (message.name !== void 0) {
7679
+ writer.uint32(18).string(message.name);
7680
+ }
7681
+ for (const v of message.channels) {
7682
+ writer.uint32(26).string(v);
7683
+ }
7684
+ if (message.description !== void 0) {
7685
+ writer.uint32(34).string(message.description);
7686
+ }
7687
+ if (message.template !== void 0) {
7688
+ RegisterCommunicationTemplateRequest_CommunicationTemplate.encode(message.template, writer.uint32(42).fork()).join();
7689
+ }
7690
+ for (const v of message.variables) {
7691
+ writer.uint32(50).string(v);
7692
+ }
7693
+ return writer;
7694
+ },
7695
+ decode(input, length) {
7696
+ const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7697
+ const end = length === void 0 ? reader.len : reader.pos + length;
7698
+ const message = createBaseUpdateCommunicationTemplateRequest();
7699
+ while (reader.pos < end) {
7700
+ const tag = reader.uint32();
7701
+ switch (tag >>> 3) {
7702
+ case 1: {
7703
+ if (tag !== 10) {
7704
+ break;
7705
+ }
7706
+ message.id = reader.string();
7707
+ continue;
7708
+ }
7709
+ case 2: {
7710
+ if (tag !== 18) {
7711
+ break;
7712
+ }
7713
+ message.name = reader.string();
7714
+ continue;
7715
+ }
7716
+ case 3: {
7717
+ if (tag !== 26) {
7718
+ break;
7719
+ }
7720
+ message.channels.push(reader.string());
7721
+ continue;
7722
+ }
7723
+ case 4: {
7724
+ if (tag !== 34) {
7725
+ break;
7726
+ }
7727
+ message.description = reader.string();
7728
+ continue;
7729
+ }
7730
+ case 5: {
7731
+ if (tag !== 42) {
7732
+ break;
7733
+ }
7734
+ message.template = RegisterCommunicationTemplateRequest_CommunicationTemplate.decode(reader, reader.uint32());
7735
+ continue;
7736
+ }
7737
+ case 6: {
7738
+ if (tag !== 50) {
7739
+ break;
7740
+ }
7741
+ message.variables.push(reader.string());
7742
+ continue;
7743
+ }
7744
+ }
7745
+ if ((tag & 7) === 4 || tag === 0) {
7746
+ break;
7747
+ }
7748
+ reader.skip(tag & 7);
7749
+ }
7750
+ return message;
7751
+ },
7752
+ fromJSON(object) {
7753
+ return {
7754
+ id: isSet4(object.id) ? globalThis.String(object.id) : "",
7755
+ name: isSet4(object.name) ? globalThis.String(object.name) : void 0,
7756
+ channels: globalThis.Array.isArray(object?.channels) ? object.channels.map((e) => globalThis.String(e)) : [],
7757
+ description: isSet4(object.description) ? globalThis.String(object.description) : void 0,
7758
+ template: isSet4(object.template) ? RegisterCommunicationTemplateRequest_CommunicationTemplate.fromJSON(object.template) : void 0,
7759
+ variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : []
7760
+ };
7761
+ },
7762
+ toJSON(message) {
7763
+ const obj = {};
7764
+ if (message.id !== "") {
7765
+ obj.id = message.id;
7766
+ }
7767
+ if (message.name !== void 0) {
7768
+ obj.name = message.name;
7769
+ }
7770
+ if (message.channels?.length) {
7771
+ obj.channels = message.channels;
7772
+ }
7773
+ if (message.description !== void 0) {
7774
+ obj.description = message.description;
7775
+ }
7776
+ if (message.template !== void 0) {
7777
+ obj.template = RegisterCommunicationTemplateRequest_CommunicationTemplate.toJSON(message.template);
7778
+ }
7779
+ if (message.variables?.length) {
7780
+ obj.variables = message.variables;
7781
+ }
7782
+ return obj;
7783
+ },
7784
+ create(base) {
7785
+ return UpdateCommunicationTemplateRequest.fromPartial(base ?? {});
7786
+ },
7787
+ fromPartial(object) {
7788
+ const message = createBaseUpdateCommunicationTemplateRequest();
7789
+ message.id = object.id ?? "";
7790
+ message.name = object.name ?? void 0;
7791
+ message.channels = object.channels?.map((e) => e) || [];
7792
+ message.description = object.description ?? void 0;
7793
+ message.template = object.template !== void 0 && object.template !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate.fromPartial(object.template) : void 0;
7794
+ message.variables = object.variables?.map((e) => e) || [];
7795
+ return message;
7796
+ }
7797
+ };
7798
+ function createBaseDeleteCommunicationTemplateRequest() {
7799
+ return { id: "" };
7800
+ }
7801
+ var DeleteCommunicationTemplateRequest = {
7802
+ encode(message, writer = new BinaryWriter5()) {
7803
+ if (message.id !== "") {
7804
+ writer.uint32(10).string(message.id);
7805
+ }
7806
+ return writer;
7807
+ },
7808
+ decode(input, length) {
7809
+ const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7810
+ const end = length === void 0 ? reader.len : reader.pos + length;
7811
+ const message = createBaseDeleteCommunicationTemplateRequest();
7812
+ while (reader.pos < end) {
7813
+ const tag = reader.uint32();
7814
+ switch (tag >>> 3) {
7815
+ case 1: {
7816
+ if (tag !== 10) {
7817
+ break;
7818
+ }
7819
+ message.id = reader.string();
7820
+ continue;
7821
+ }
7822
+ }
7823
+ if ((tag & 7) === 4 || tag === 0) {
7824
+ break;
7825
+ }
7826
+ reader.skip(tag & 7);
7827
+ }
7828
+ return message;
7829
+ },
7830
+ fromJSON(object) {
7831
+ return { id: isSet4(object.id) ? globalThis.String(object.id) : "" };
7832
+ },
7833
+ toJSON(message) {
7834
+ const obj = {};
7835
+ if (message.id !== "") {
7836
+ obj.id = message.id;
7837
+ }
7838
+ return obj;
7839
+ },
7840
+ create(base) {
7841
+ return DeleteCommunicationTemplateRequest.fromPartial(base ?? {});
7842
+ },
7843
+ fromPartial(object) {
7844
+ const message = createBaseDeleteCommunicationTemplateRequest();
7845
+ message.id = object.id ?? "";
7846
+ return message;
7847
+ }
7848
+ };
7849
+ function createBaseDeleteCommunicationTemplateResponse() {
7850
+ return { deleted: false };
7851
+ }
7852
+ var DeleteCommunicationTemplateResponse = {
7853
+ encode(message, writer = new BinaryWriter5()) {
7854
+ if (message.deleted !== false) {
7855
+ writer.uint32(8).bool(message.deleted);
7856
+ }
7857
+ return writer;
7858
+ },
7859
+ decode(input, length) {
7860
+ const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7861
+ const end = length === void 0 ? reader.len : reader.pos + length;
7862
+ const message = createBaseDeleteCommunicationTemplateResponse();
7863
+ while (reader.pos < end) {
7864
+ const tag = reader.uint32();
7865
+ switch (tag >>> 3) {
7866
+ case 1: {
7867
+ if (tag !== 8) {
7868
+ break;
7869
+ }
7870
+ message.deleted = reader.bool();
7269
7871
  continue;
7270
7872
  }
7271
7873
  }
@@ -7277,59 +7879,41 @@ var RegisterCommunicationTemplateRequest_CommunicationTemplate = {
7277
7879
  return message;
7278
7880
  },
7279
7881
  fromJSON(object) {
7280
- return {
7281
- email: isSet4(object.email) ? RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.fromJSON(object.email) : void 0,
7282
- push: isSet4(object.push) ? RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.fromJSON(object.push) : void 0,
7283
- sms: isSet4(object.sms) ? RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.fromJSON(object.sms) : void 0
7284
- };
7882
+ return { deleted: isSet4(object.deleted) ? globalThis.Boolean(object.deleted) : false };
7285
7883
  },
7286
7884
  toJSON(message) {
7287
7885
  const obj = {};
7288
- if (message.email !== void 0) {
7289
- obj.email = RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.toJSON(message.email);
7290
- }
7291
- if (message.push !== void 0) {
7292
- obj.push = RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.toJSON(message.push);
7293
- }
7294
- if (message.sms !== void 0) {
7295
- obj.sms = RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.toJSON(message.sms);
7886
+ if (message.deleted !== false) {
7887
+ obj.deleted = message.deleted;
7296
7888
  }
7297
7889
  return obj;
7298
7890
  },
7299
7891
  create(base) {
7300
- return RegisterCommunicationTemplateRequest_CommunicationTemplate.fromPartial(base ?? {});
7892
+ return DeleteCommunicationTemplateResponse.fromPartial(base ?? {});
7301
7893
  },
7302
7894
  fromPartial(object) {
7303
- const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate();
7304
- message.email = object.email !== void 0 && object.email !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.fromPartial(object.email) : void 0;
7305
- message.push = object.push !== void 0 && object.push !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.fromPartial(object.push) : void 0;
7306
- message.sms = object.sms !== void 0 && object.sms !== null ? RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.fromPartial(object.sms) : void 0;
7895
+ const message = createBaseDeleteCommunicationTemplateResponse();
7896
+ message.deleted = object.deleted ?? false;
7307
7897
  return message;
7308
7898
  }
7309
7899
  };
7310
- function createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate() {
7311
- return { subject: "", body: "", variables: [], sender: void 0 };
7900
+ function createBaseGetCommunicationTemplateRequest() {
7901
+ return { id: void 0, name: void 0 };
7312
7902
  }
7313
- var RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate = {
7903
+ var GetCommunicationTemplateRequest = {
7314
7904
  encode(message, writer = new BinaryWriter5()) {
7315
- if (message.subject !== "") {
7316
- writer.uint32(10).string(message.subject);
7317
- }
7318
- if (message.body !== "") {
7319
- writer.uint32(18).string(message.body);
7320
- }
7321
- for (const v of message.variables) {
7322
- writer.uint32(26).string(v);
7905
+ if (message.id !== void 0) {
7906
+ writer.uint32(10).string(message.id);
7323
7907
  }
7324
- if (message.sender !== void 0) {
7325
- writer.uint32(34).string(message.sender);
7908
+ if (message.name !== void 0) {
7909
+ writer.uint32(18).string(message.name);
7326
7910
  }
7327
7911
  return writer;
7328
7912
  },
7329
7913
  decode(input, length) {
7330
7914
  const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7331
7915
  const end = length === void 0 ? reader.len : reader.pos + length;
7332
- const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate();
7916
+ const message = createBaseGetCommunicationTemplateRequest();
7333
7917
  while (reader.pos < end) {
7334
7918
  const tag = reader.uint32();
7335
7919
  switch (tag >>> 3) {
@@ -7337,28 +7921,14 @@ var RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate = {
7337
7921
  if (tag !== 10) {
7338
7922
  break;
7339
7923
  }
7340
- message.subject = reader.string();
7924
+ message.id = reader.string();
7341
7925
  continue;
7342
7926
  }
7343
7927
  case 2: {
7344
7928
  if (tag !== 18) {
7345
7929
  break;
7346
7930
  }
7347
- message.body = reader.string();
7348
- continue;
7349
- }
7350
- case 3: {
7351
- if (tag !== 26) {
7352
- break;
7353
- }
7354
- message.variables.push(reader.string());
7355
- continue;
7356
- }
7357
- case 4: {
7358
- if (tag !== 34) {
7359
- break;
7360
- }
7361
- message.sender = reader.string();
7931
+ message.name = reader.string();
7362
7932
  continue;
7363
7933
  }
7364
7934
  }
@@ -7371,60 +7941,44 @@ var RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate = {
7371
7941
  },
7372
7942
  fromJSON(object) {
7373
7943
  return {
7374
- subject: isSet4(object.subject) ? globalThis.String(object.subject) : "",
7375
- body: isSet4(object.body) ? globalThis.String(object.body) : "",
7376
- variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : [],
7377
- sender: isSet4(object.sender) ? globalThis.String(object.sender) : void 0
7944
+ id: isSet4(object.id) ? globalThis.String(object.id) : void 0,
7945
+ name: isSet4(object.name) ? globalThis.String(object.name) : void 0
7378
7946
  };
7379
7947
  },
7380
7948
  toJSON(message) {
7381
7949
  const obj = {};
7382
- if (message.subject !== "") {
7383
- obj.subject = message.subject;
7384
- }
7385
- if (message.body !== "") {
7386
- obj.body = message.body;
7387
- }
7388
- if (message.variables?.length) {
7389
- obj.variables = message.variables;
7950
+ if (message.id !== void 0) {
7951
+ obj.id = message.id;
7390
7952
  }
7391
- if (message.sender !== void 0) {
7392
- obj.sender = message.sender;
7953
+ if (message.name !== void 0) {
7954
+ obj.name = message.name;
7393
7955
  }
7394
7956
  return obj;
7395
7957
  },
7396
7958
  create(base) {
7397
- return RegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate.fromPartial(base ?? {});
7959
+ return GetCommunicationTemplateRequest.fromPartial(base ?? {});
7398
7960
  },
7399
7961
  fromPartial(object) {
7400
- const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_EmailTemplate();
7401
- message.subject = object.subject ?? "";
7402
- message.body = object.body ?? "";
7403
- message.variables = object.variables?.map((e) => e) || [];
7404
- message.sender = object.sender ?? void 0;
7962
+ const message = createBaseGetCommunicationTemplateRequest();
7963
+ message.id = object.id ?? void 0;
7964
+ message.name = object.name ?? void 0;
7405
7965
  return message;
7406
7966
  }
7407
7967
  };
7408
- function createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate() {
7409
- return { title: "", body: "", variables: [] };
7968
+ function createBaseGetCommunicationTemplateResponse() {
7969
+ return { template: "" };
7410
7970
  }
7411
- var RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate = {
7971
+ var GetCommunicationTemplateResponse = {
7412
7972
  encode(message, writer = new BinaryWriter5()) {
7413
- if (message.title !== "") {
7414
- writer.uint32(10).string(message.title);
7415
- }
7416
- if (message.body !== "") {
7417
- writer.uint32(18).string(message.body);
7418
- }
7419
- for (const v of message.variables) {
7420
- writer.uint32(26).string(v);
7973
+ if (message.template !== "") {
7974
+ writer.uint32(10).string(message.template);
7421
7975
  }
7422
7976
  return writer;
7423
7977
  },
7424
7978
  decode(input, length) {
7425
7979
  const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7426
7980
  const end = length === void 0 ? reader.len : reader.pos + length;
7427
- const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate();
7981
+ const message = createBaseGetCommunicationTemplateResponse();
7428
7982
  while (reader.pos < end) {
7429
7983
  const tag = reader.uint32();
7430
7984
  switch (tag >>> 3) {
@@ -7432,21 +7986,7 @@ var RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate = {
7432
7986
  if (tag !== 10) {
7433
7987
  break;
7434
7988
  }
7435
- message.title = reader.string();
7436
- continue;
7437
- }
7438
- case 2: {
7439
- if (tag !== 18) {
7440
- break;
7441
- }
7442
- message.body = reader.string();
7443
- continue;
7444
- }
7445
- case 3: {
7446
- if (tag !== 26) {
7447
- break;
7448
- }
7449
- message.variables.push(reader.string());
7989
+ message.template = reader.string();
7450
7990
  continue;
7451
7991
  }
7452
7992
  }
@@ -7458,68 +7998,66 @@ var RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate = {
7458
7998
  return message;
7459
7999
  },
7460
8000
  fromJSON(object) {
7461
- return {
7462
- title: isSet4(object.title) ? globalThis.String(object.title) : "",
7463
- body: isSet4(object.body) ? globalThis.String(object.body) : "",
7464
- variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : []
7465
- };
8001
+ return { template: isSet4(object.template) ? globalThis.String(object.template) : "" };
7466
8002
  },
7467
8003
  toJSON(message) {
7468
8004
  const obj = {};
7469
- if (message.title !== "") {
7470
- obj.title = message.title;
7471
- }
7472
- if (message.body !== "") {
7473
- obj.body = message.body;
7474
- }
7475
- if (message.variables?.length) {
7476
- obj.variables = message.variables;
8005
+ if (message.template !== "") {
8006
+ obj.template = message.template;
7477
8007
  }
7478
8008
  return obj;
7479
8009
  },
7480
8010
  create(base) {
7481
- return RegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate.fromPartial(base ?? {});
8011
+ return GetCommunicationTemplateResponse.fromPartial(base ?? {});
7482
8012
  },
7483
8013
  fromPartial(object) {
7484
- const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_PushTemplate();
7485
- message.title = object.title ?? "";
7486
- message.body = object.body ?? "";
7487
- message.variables = object.variables?.map((e) => e) || [];
8014
+ const message = createBaseGetCommunicationTemplateResponse();
8015
+ message.template = object.template ?? "";
7488
8016
  return message;
7489
8017
  }
7490
8018
  };
7491
- function createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate() {
7492
- return { message: "", variables: [] };
8019
+ function createBaseListCommunicationTemplatesRequest() {
8020
+ return { skip: 0, limit: 0, search: void 0 };
7493
8021
  }
7494
- var RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate = {
8022
+ var ListCommunicationTemplatesRequest = {
7495
8023
  encode(message, writer = new BinaryWriter5()) {
7496
- if (message.message !== "") {
7497
- writer.uint32(10).string(message.message);
8024
+ if (message.skip !== 0) {
8025
+ writer.uint32(8).int32(message.skip);
7498
8026
  }
7499
- for (const v of message.variables) {
7500
- writer.uint32(18).string(v);
8027
+ if (message.limit !== 0) {
8028
+ writer.uint32(16).int32(message.limit);
8029
+ }
8030
+ if (message.search !== void 0) {
8031
+ writer.uint32(26).string(message.search);
7501
8032
  }
7502
8033
  return writer;
7503
8034
  },
7504
8035
  decode(input, length) {
7505
8036
  const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7506
8037
  const end = length === void 0 ? reader.len : reader.pos + length;
7507
- const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate();
8038
+ const message = createBaseListCommunicationTemplatesRequest();
7508
8039
  while (reader.pos < end) {
7509
8040
  const tag = reader.uint32();
7510
8041
  switch (tag >>> 3) {
7511
8042
  case 1: {
7512
- if (tag !== 10) {
8043
+ if (tag !== 8) {
7513
8044
  break;
7514
8045
  }
7515
- message.message = reader.string();
8046
+ message.skip = reader.int32();
7516
8047
  continue;
7517
8048
  }
7518
8049
  case 2: {
7519
- if (tag !== 18) {
8050
+ if (tag !== 16) {
7520
8051
  break;
7521
8052
  }
7522
- message.variables.push(reader.string());
8053
+ message.limit = reader.int32();
8054
+ continue;
8055
+ }
8056
+ case 3: {
8057
+ if (tag !== 26) {
8058
+ break;
8059
+ }
8060
+ message.search = reader.string();
7523
8061
  continue;
7524
8062
  }
7525
8063
  }
@@ -7532,44 +8070,52 @@ var RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate = {
7532
8070
  },
7533
8071
  fromJSON(object) {
7534
8072
  return {
7535
- message: isSet4(object.message) ? globalThis.String(object.message) : "",
7536
- variables: globalThis.Array.isArray(object?.variables) ? object.variables.map((e) => globalThis.String(e)) : []
8073
+ skip: isSet4(object.skip) ? globalThis.Number(object.skip) : 0,
8074
+ limit: isSet4(object.limit) ? globalThis.Number(object.limit) : 0,
8075
+ search: isSet4(object.search) ? globalThis.String(object.search) : void 0
7537
8076
  };
7538
8077
  },
7539
8078
  toJSON(message) {
7540
8079
  const obj = {};
7541
- if (message.message !== "") {
7542
- obj.message = message.message;
8080
+ if (message.skip !== 0) {
8081
+ obj.skip = Math.round(message.skip);
7543
8082
  }
7544
- if (message.variables?.length) {
7545
- obj.variables = message.variables;
8083
+ if (message.limit !== 0) {
8084
+ obj.limit = Math.round(message.limit);
8085
+ }
8086
+ if (message.search !== void 0) {
8087
+ obj.search = message.search;
7546
8088
  }
7547
8089
  return obj;
7548
8090
  },
7549
8091
  create(base) {
7550
- return RegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate.fromPartial(base ?? {});
8092
+ return ListCommunicationTemplatesRequest.fromPartial(base ?? {});
7551
8093
  },
7552
8094
  fromPartial(object) {
7553
- const message = createBaseRegisterCommunicationTemplateRequest_CommunicationTemplate_SmsTemplate();
7554
- message.message = object.message ?? "";
7555
- message.variables = object.variables?.map((e) => e) || [];
8095
+ const message = createBaseListCommunicationTemplatesRequest();
8096
+ message.skip = object.skip ?? 0;
8097
+ message.limit = object.limit ?? 0;
8098
+ message.search = object.search ?? void 0;
7556
8099
  return message;
7557
8100
  }
7558
8101
  };
7559
- function createBaseRegisterCommunicationTemplateResponse() {
7560
- return { template: "" };
8102
+ function createBaseListCommunicationTemplatesResponse() {
8103
+ return { templates: [], count: 0 };
7561
8104
  }
7562
- var RegisterCommunicationTemplateResponse = {
8105
+ var ListCommunicationTemplatesResponse = {
7563
8106
  encode(message, writer = new BinaryWriter5()) {
7564
- if (message.template !== "") {
7565
- writer.uint32(10).string(message.template);
8107
+ for (const v of message.templates) {
8108
+ writer.uint32(10).string(v);
8109
+ }
8110
+ if (message.count !== 0) {
8111
+ writer.uint32(16).int32(message.count);
7566
8112
  }
7567
8113
  return writer;
7568
8114
  },
7569
8115
  decode(input, length) {
7570
8116
  const reader = input instanceof BinaryReader5 ? input : new BinaryReader5(input);
7571
8117
  const end = length === void 0 ? reader.len : reader.pos + length;
7572
- const message = createBaseRegisterCommunicationTemplateResponse();
8118
+ const message = createBaseListCommunicationTemplatesResponse();
7573
8119
  while (reader.pos < end) {
7574
8120
  const tag = reader.uint32();
7575
8121
  switch (tag >>> 3) {
@@ -7577,7 +8123,14 @@ var RegisterCommunicationTemplateResponse = {
7577
8123
  if (tag !== 10) {
7578
8124
  break;
7579
8125
  }
7580
- message.template = reader.string();
8126
+ message.templates.push(reader.string());
8127
+ continue;
8128
+ }
8129
+ case 2: {
8130
+ if (tag !== 16) {
8131
+ break;
8132
+ }
8133
+ message.count = reader.int32();
7581
8134
  continue;
7582
8135
  }
7583
8136
  }
@@ -7589,21 +8142,28 @@ var RegisterCommunicationTemplateResponse = {
7589
8142
  return message;
7590
8143
  },
7591
8144
  fromJSON(object) {
7592
- return { template: isSet4(object.template) ? globalThis.String(object.template) : "" };
8145
+ return {
8146
+ templates: globalThis.Array.isArray(object?.templates) ? object.templates.map((e) => globalThis.String(e)) : [],
8147
+ count: isSet4(object.count) ? globalThis.Number(object.count) : 0
8148
+ };
7593
8149
  },
7594
8150
  toJSON(message) {
7595
8151
  const obj = {};
7596
- if (message.template !== "") {
7597
- obj.template = message.template;
8152
+ if (message.templates?.length) {
8153
+ obj.templates = message.templates;
8154
+ }
8155
+ if (message.count !== 0) {
8156
+ obj.count = Math.round(message.count);
7598
8157
  }
7599
8158
  return obj;
7600
8159
  },
7601
8160
  create(base) {
7602
- return RegisterCommunicationTemplateResponse.fromPartial(base ?? {});
8161
+ return ListCommunicationTemplatesResponse.fromPartial(base ?? {});
7603
8162
  },
7604
8163
  fromPartial(object) {
7605
- const message = createBaseRegisterCommunicationTemplateResponse();
7606
- message.template = object.template ?? "";
8164
+ const message = createBaseListCommunicationTemplatesResponse();
8165
+ message.templates = object.templates?.map((e) => e) || [];
8166
+ message.count = object.count ?? 0;
7607
8167
  return message;
7608
8168
  }
7609
8169
  };
@@ -7870,6 +8430,38 @@ var CommunicationsDefinition = {
7870
8430
  responseStream: false,
7871
8431
  options: {}
7872
8432
  },
8433
+ updateCommunicationTemplate: {
8434
+ name: "UpdateCommunicationTemplate",
8435
+ requestType: UpdateCommunicationTemplateRequest,
8436
+ requestStream: false,
8437
+ responseType: RegisterCommunicationTemplateResponse,
8438
+ responseStream: false,
8439
+ options: {}
8440
+ },
8441
+ deleteCommunicationTemplate: {
8442
+ name: "DeleteCommunicationTemplate",
8443
+ requestType: DeleteCommunicationTemplateRequest,
8444
+ requestStream: false,
8445
+ responseType: DeleteCommunicationTemplateResponse,
8446
+ responseStream: false,
8447
+ options: {}
8448
+ },
8449
+ getCommunicationTemplate: {
8450
+ name: "GetCommunicationTemplate",
8451
+ requestType: GetCommunicationTemplateRequest,
8452
+ requestStream: false,
8453
+ responseType: GetCommunicationTemplateResponse,
8454
+ responseStream: false,
8455
+ options: {}
8456
+ },
8457
+ listCommunicationTemplates: {
8458
+ name: "ListCommunicationTemplates",
8459
+ requestType: ListCommunicationTemplatesRequest,
8460
+ requestStream: false,
8461
+ responseType: ListCommunicationTemplatesResponse,
8462
+ responseStream: false,
8463
+ options: {}
8464
+ },
7873
8465
  getMessageStatus: {
7874
8466
  name: "GetMessageStatus",
7875
8467
  requestType: GetMessageStatusRequest,
@@ -16832,7 +17424,7 @@ var Chat = class extends ConduitModule {
16832
17424
  }
16833
17425
  moduleName;
16834
17426
  sendMessage(messageData) {
16835
- return this.client.sendMessage(messageData);
17427
+ return this.client.sendMessage(SendMessageRequest.fromPartial(messageData));
16836
17428
  }
16837
17429
  createRoom(name, participants) {
16838
17430
  return this.client.createRoom({ name, participants });
@@ -17081,8 +17673,7 @@ var Communications = class extends ConduitModule {
17081
17673
  sendMessage(channel, params) {
17082
17674
  return this.client.sendCommunication({
17083
17675
  channel,
17084
- templateName: "",
17085
- // Not used for direct sending
17676
+ templateName: params.templateName ?? "",
17086
17677
  params: {
17087
17678
  recipient: params.recipient,
17088
17679
  subject: params.subject,
@@ -17108,8 +17699,7 @@ var Communications = class extends ConduitModule {
17108
17699
  return this.client.sendToMultipleChannels({
17109
17700
  channels,
17110
17701
  strategy,
17111
- templateName: "",
17112
- // Not used for direct sending
17702
+ templateName: params.templateName ?? "",
17113
17703
  params: {
17114
17704
  recipient: params.recipient,
17115
17705
  subject: params.subject,
@@ -17131,8 +17721,7 @@ var Communications = class extends ConduitModule {
17131
17721
  sendWithFallback(fallbackChain, params) {
17132
17722
  return this.client.sendWithFallback({
17133
17723
  fallbackChain,
17134
- templateName: "",
17135
- // Not used for direct sending
17724
+ templateName: params.templateName ?? "",
17136
17725
  params: {
17137
17726
  recipient: params.recipient,
17138
17727
  subject: params.subject,
@@ -17163,6 +17752,51 @@ var Communications = class extends ConduitModule {
17163
17752
  return JSON.parse(res.statusInfo);
17164
17753
  });
17165
17754
  }
17755
+ registerCommunicationTemplate(template) {
17756
+ return this.client.registerCommunicationTemplate({
17757
+ name: template.name,
17758
+ channels: template.channels,
17759
+ description: template.description,
17760
+ variables: template.variables ?? [],
17761
+ template: {
17762
+ email: template.email,
17763
+ push: template.push,
17764
+ sms: template.sms
17765
+ }
17766
+ }).then((res) => JSON.parse(res.template));
17767
+ }
17768
+ updateCommunicationTemplate(id, params) {
17769
+ return this.client.updateCommunicationTemplate({
17770
+ id,
17771
+ name: params.name,
17772
+ channels: params.channels ?? [],
17773
+ description: params.description,
17774
+ variables: params.variables ?? [],
17775
+ template: {
17776
+ email: params.email,
17777
+ push: params.push,
17778
+ sms: params.sms
17779
+ }
17780
+ }).then((res) => JSON.parse(res.template));
17781
+ }
17782
+ deleteCommunicationTemplate(id) {
17783
+ return this.client.deleteCommunicationTemplate({ id });
17784
+ }
17785
+ getCommunicationTemplate(params) {
17786
+ return this.client.getCommunicationTemplate(params).then((res) => {
17787
+ return JSON.parse(res.template);
17788
+ });
17789
+ }
17790
+ listCommunicationTemplates(params) {
17791
+ return this.client.listCommunicationTemplates({
17792
+ skip: params.skip ?? 0,
17793
+ limit: params.limit ?? 25,
17794
+ search: params.search
17795
+ }).then((res) => ({
17796
+ templates: res.templates.map((t) => JSON.parse(t)),
17797
+ count: res.count
17798
+ }));
17799
+ }
17166
17800
  };
17167
17801
 
17168
17802
  // src/index.ts
@@ -17295,7 +17929,24 @@ var RedisManager = class {
17295
17929
  };
17296
17930
 
17297
17931
  // src/utilities/StateManager.ts
17298
- import { Redlock } from "@sesamecare-oss/redlock";
17932
+ import {
17933
+ ExecutionError,
17934
+ Redlock,
17935
+ ResourceLockedError
17936
+ } from "@sesamecare-oss/redlock";
17937
+ async function isLockContention(error) {
17938
+ if (error instanceof ResourceLockedError) {
17939
+ return true;
17940
+ }
17941
+ if (!(error instanceof ExecutionError)) {
17942
+ return false;
17943
+ }
17944
+ const attempts = await Promise.all(error.attempts);
17945
+ const voteErrors = attempts.flatMap(
17946
+ (attempt) => Array.from(attempt.votesAgainst.values())
17947
+ );
17948
+ return voteErrors.length > 0 && voteErrors.every((voteError) => voteError instanceof ResourceLockedError);
17949
+ }
17299
17950
  var StateManager = class {
17300
17951
  redisClient;
17301
17952
  redLock;
@@ -17329,9 +17980,31 @@ var StateManager = class {
17329
17980
  async acquireLock(resource, ttl = 5e3) {
17330
17981
  return await this.redLock.acquire([resource], ttl);
17331
17982
  }
17983
+ /**
17984
+ * Attempt to acquire a lock once. Returns null when another holder owns the
17985
+ * resource (contention). Re-throws Redis/infrastructure failures.
17986
+ */
17987
+ async tryAcquireLock(resource, ttl = 5e3) {
17988
+ try {
17989
+ return await this.redLock.acquire([resource], ttl, { retryCount: 0 });
17990
+ } catch (error) {
17991
+ if (await isLockContention(error)) {
17992
+ return null;
17993
+ }
17994
+ throw error;
17995
+ }
17996
+ }
17332
17997
  async releaseLock(lock) {
17333
17998
  await lock.release();
17334
17999
  }
18000
+ async withLock(resource, ttl, fn) {
18001
+ const lock = await this.acquireLock(resource, ttl);
18002
+ try {
18003
+ return await fn();
18004
+ } finally {
18005
+ await this.releaseLock(lock);
18006
+ }
18007
+ }
17335
18008
  async modifyState(modifier) {
17336
18009
  const lock = await this.acquireLock("state_modification" /* STATE_MODIFICATION */);
17337
18010
  try {
@@ -18140,6 +18813,8 @@ export {
18140
18813
  DatabaseProviderDefinition,
18141
18814
  Decision,
18142
18815
  DeleteAllRelationsRequest,
18816
+ DeleteCommunicationTemplateRequest,
18817
+ DeleteCommunicationTemplateResponse,
18143
18818
  DeleteConfigRequest,
18144
18819
  DeleteFileResponse,
18145
18820
  DeleteResourceRequest,
@@ -18157,6 +18832,8 @@ export {
18157
18832
  FindRelationResponse,
18158
18833
  FindRequest,
18159
18834
  FindRequest_SortEntry,
18835
+ GetCommunicationTemplateRequest,
18836
+ GetCommunicationTemplateResponse,
18160
18837
  GetConfigRequest,
18161
18838
  GetConfigResponse,
18162
18839
  GetDatabaseTypeResponse,
@@ -18190,6 +18867,8 @@ export {
18190
18867
  InvitationDeleteResponse,
18191
18868
  InviteUserToTeamRequest,
18192
18869
  InviteUserToTeamResponse,
18870
+ ListCommunicationTemplatesRequest,
18871
+ ListCommunicationTemplatesResponse,
18193
18872
  MetricType,
18194
18873
  MigrateRequest,
18195
18874
  ModifyTeamMembersRequest,
@@ -18291,6 +18970,7 @@ export {
18291
18970
  Team,
18292
18971
  TeamDeleteRequest,
18293
18972
  TeamDeleteResponse,
18973
+ UpdateCommunicationTemplateRequest,
18294
18974
  UpdateConfigRequest,
18295
18975
  UpdateConfigResponse,
18296
18976
  UpdateFileByUrlRequest,