@conduitplatform/grpc-sdk 0.16.24 → 0.16.25

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
@@ -3396,7 +3396,7 @@ const CreateRoomRequest = {
3396
3396
  },
3397
3397
  };
3398
3398
  function createBaseSendMessageRequest() {
3399
- return { message: "", userId: "", roomId: "", messageType: undefined };
3399
+ return { message: "", userId: "", roomId: "", messageType: undefined, persist: undefined };
3400
3400
  }
3401
3401
  const SendMessageRequest = {
3402
3402
  encode(message, writer = _m0.Writer.create()) {
@@ -3412,6 +3412,9 @@ const SendMessageRequest = {
3412
3412
  if (message.messageType !== undefined) {
3413
3413
  writer.uint32(34).string(message.messageType);
3414
3414
  }
3415
+ if (message.persist !== undefined) {
3416
+ writer.uint32(40).bool(message.persist);
3417
+ }
3415
3418
  return writer;
3416
3419
  },
3417
3420
  decode(input, length) {
@@ -3445,6 +3448,12 @@ const SendMessageRequest = {
3445
3448
  }
3446
3449
  message.messageType = reader.string();
3447
3450
  continue;
3451
+ case 5:
3452
+ if (tag !== 40) {
3453
+ break;
3454
+ }
3455
+ message.persist = reader.bool();
3456
+ continue;
3448
3457
  }
3449
3458
  if ((tag & 7) === 4 || tag === 0) {
3450
3459
  break;
@@ -3459,6 +3468,7 @@ const SendMessageRequest = {
3459
3468
  userId: isSet$9(object.userId) ? globalThis.String(object.userId) : "",
3460
3469
  roomId: isSet$9(object.roomId) ? globalThis.String(object.roomId) : "",
3461
3470
  messageType: isSet$9(object.messageType) ? globalThis.String(object.messageType) : undefined,
3471
+ persist: isSet$9(object.persist) ? globalThis.Boolean(object.persist) : undefined,
3462
3472
  };
3463
3473
  },
3464
3474
  toJSON(message) {
@@ -3475,6 +3485,9 @@ const SendMessageRequest = {
3475
3485
  if (message.messageType !== undefined) {
3476
3486
  obj.messageType = message.messageType;
3477
3487
  }
3488
+ if (message.persist !== undefined) {
3489
+ obj.persist = message.persist;
3490
+ }
3478
3491
  return obj;
3479
3492
  },
3480
3493
  create(base) {
@@ -3486,6 +3499,7 @@ const SendMessageRequest = {
3486
3499
  message.userId = object.userId ?? "";
3487
3500
  message.roomId = object.roomId ?? "";
3488
3501
  message.messageType = object.messageType ?? undefined;
3502
+ message.persist = object.persist ?? undefined;
3489
3503
  return message;
3490
3504
  },
3491
3505
  };
@@ -8218,6 +8232,114 @@ const RegisterTemplateResponse = {
8218
8232
  return message;
8219
8233
  },
8220
8234
  };
8235
+ function createBaseAttachment() {
8236
+ return { filename: "", contentType: undefined, content: undefined, href: undefined, httpHeaders: undefined };
8237
+ }
8238
+ const Attachment = {
8239
+ encode(message, writer = _m0.Writer.create()) {
8240
+ if (message.filename !== "") {
8241
+ writer.uint32(10).string(message.filename);
8242
+ }
8243
+ if (message.contentType !== undefined) {
8244
+ writer.uint32(18).string(message.contentType);
8245
+ }
8246
+ if (message.content !== undefined) {
8247
+ writer.uint32(26).bytes(message.content);
8248
+ }
8249
+ if (message.href !== undefined) {
8250
+ writer.uint32(34).string(message.href);
8251
+ }
8252
+ if (message.httpHeaders !== undefined) {
8253
+ writer.uint32(42).string(message.httpHeaders);
8254
+ }
8255
+ return writer;
8256
+ },
8257
+ decode(input, length) {
8258
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
8259
+ let end = length === undefined ? reader.len : reader.pos + length;
8260
+ const message = createBaseAttachment();
8261
+ while (reader.pos < end) {
8262
+ const tag = reader.uint32();
8263
+ switch (tag >>> 3) {
8264
+ case 1:
8265
+ if (tag !== 10) {
8266
+ break;
8267
+ }
8268
+ message.filename = reader.string();
8269
+ continue;
8270
+ case 2:
8271
+ if (tag !== 18) {
8272
+ break;
8273
+ }
8274
+ message.contentType = reader.string();
8275
+ continue;
8276
+ case 3:
8277
+ if (tag !== 26) {
8278
+ break;
8279
+ }
8280
+ message.content = reader.bytes();
8281
+ continue;
8282
+ case 4:
8283
+ if (tag !== 34) {
8284
+ break;
8285
+ }
8286
+ message.href = reader.string();
8287
+ continue;
8288
+ case 5:
8289
+ if (tag !== 42) {
8290
+ break;
8291
+ }
8292
+ message.httpHeaders = reader.string();
8293
+ continue;
8294
+ }
8295
+ if ((tag & 7) === 4 || tag === 0) {
8296
+ break;
8297
+ }
8298
+ reader.skipType(tag & 7);
8299
+ }
8300
+ return message;
8301
+ },
8302
+ fromJSON(object) {
8303
+ return {
8304
+ filename: isSet$6(object.filename) ? globalThis.String(object.filename) : "",
8305
+ contentType: isSet$6(object.contentType) ? globalThis.String(object.contentType) : undefined,
8306
+ content: isSet$6(object.content) ? bytesFromBase64(object.content) : undefined,
8307
+ href: isSet$6(object.href) ? globalThis.String(object.href) : undefined,
8308
+ httpHeaders: isSet$6(object.httpHeaders) ? globalThis.String(object.httpHeaders) : undefined,
8309
+ };
8310
+ },
8311
+ toJSON(message) {
8312
+ const obj = {};
8313
+ if (message.filename !== "") {
8314
+ obj.filename = message.filename;
8315
+ }
8316
+ if (message.contentType !== undefined) {
8317
+ obj.contentType = message.contentType;
8318
+ }
8319
+ if (message.content !== undefined) {
8320
+ obj.content = base64FromBytes(message.content);
8321
+ }
8322
+ if (message.href !== undefined) {
8323
+ obj.href = message.href;
8324
+ }
8325
+ if (message.httpHeaders !== undefined) {
8326
+ obj.httpHeaders = message.httpHeaders;
8327
+ }
8328
+ return obj;
8329
+ },
8330
+ create(base) {
8331
+ return Attachment.fromPartial(base ?? {});
8332
+ },
8333
+ fromPartial(object) {
8334
+ const message = createBaseAttachment();
8335
+ message.filename = object.filename ?? "";
8336
+ message.contentType = object.contentType ?? undefined;
8337
+ message.content = object.content ?? undefined;
8338
+ message.href = object.href ?? undefined;
8339
+ message.httpHeaders = object.httpHeaders ?? undefined;
8340
+ return message;
8341
+ },
8342
+ };
8221
8343
  function createBaseSendEmailRequest() {
8222
8344
  return { templateName: "", params: undefined };
8223
8345
  }
@@ -8322,7 +8444,7 @@ const SendEmailRequest_SendEmailParams = {
8322
8444
  writer.uint32(42).string(message.replyTo);
8323
8445
  }
8324
8446
  for (const v of message.attachments) {
8325
- writer.uint32(50).string(v);
8447
+ Attachment.encode(v, writer.uint32(50).fork()).ldelim();
8326
8448
  }
8327
8449
  return writer;
8328
8450
  },
@@ -8379,7 +8501,7 @@ const SendEmailRequest_SendEmailParams = {
8379
8501
  if (tag !== 50) {
8380
8502
  break;
8381
8503
  }
8382
- message.attachments.push(reader.string());
8504
+ message.attachments.push(Attachment.decode(reader, reader.uint32()));
8383
8505
  continue;
8384
8506
  }
8385
8507
  if ((tag & 7) === 4 || tag === 0) {
@@ -8399,7 +8521,7 @@ const SendEmailRequest_SendEmailParams = {
8399
8521
  cc: globalThis.Array.isArray(object?.cc) ? object.cc.map((e) => globalThis.String(e)) : [],
8400
8522
  replyTo: isSet$6(object.replyTo) ? globalThis.String(object.replyTo) : undefined,
8401
8523
  attachments: globalThis.Array.isArray(object?.attachments)
8402
- ? object.attachments.map((e) => globalThis.String(e))
8524
+ ? object.attachments.map((e) => Attachment.fromJSON(e))
8403
8525
  : [],
8404
8526
  };
8405
8527
  },
@@ -8427,7 +8549,7 @@ const SendEmailRequest_SendEmailParams = {
8427
8549
  obj.replyTo = message.replyTo;
8428
8550
  }
8429
8551
  if (message.attachments?.length) {
8430
- obj.attachments = message.attachments;
8552
+ obj.attachments = message.attachments.map((e) => Attachment.toJSON(e));
8431
8553
  }
8432
8554
  return obj;
8433
8555
  },
@@ -8443,7 +8565,7 @@ const SendEmailRequest_SendEmailParams = {
8443
8565
  message.sender = object.sender ?? undefined;
8444
8566
  message.cc = object.cc?.map((e) => e) || [];
8445
8567
  message.replyTo = object.replyTo ?? undefined;
8446
- message.attachments = object.attachments?.map((e) => e) || [];
8568
+ message.attachments = object.attachments?.map((e) => Attachment.fromPartial(e)) || [];
8447
8569
  return message;
8448
8570
  },
8449
8571
  };
@@ -8743,6 +8865,31 @@ const EmailDefinition = {
8743
8865
  },
8744
8866
  },
8745
8867
  };
8868
+ function bytesFromBase64(b64) {
8869
+ if (globalThis.Buffer) {
8870
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
8871
+ }
8872
+ else {
8873
+ const bin = globalThis.atob(b64);
8874
+ const arr = new Uint8Array(bin.length);
8875
+ for (let i = 0; i < bin.length; ++i) {
8876
+ arr[i] = bin.charCodeAt(i);
8877
+ }
8878
+ return arr;
8879
+ }
8880
+ }
8881
+ function base64FromBytes(arr) {
8882
+ if (globalThis.Buffer) {
8883
+ return globalThis.Buffer.from(arr).toString("base64");
8884
+ }
8885
+ else {
8886
+ const bin = [];
8887
+ arr.forEach((byte) => {
8888
+ bin.push(globalThis.String.fromCharCode(byte));
8889
+ });
8890
+ return globalThis.btoa(bin.join(""));
8891
+ }
8892
+ }
8746
8893
  function isSet$6(value) {
8747
8894
  return value !== null && value !== undefined;
8748
8895
  }
@@ -13497,7 +13644,13 @@ class Email extends ConduitModule {
13497
13644
  sender: params.sender,
13498
13645
  replyTo: params.replyTo,
13499
13646
  cc: params.cc ?? [],
13500
- attachments: params.attachments ?? [],
13647
+ attachments: params.attachments?.map(attachment => ({
13648
+ ...attachment,
13649
+ content: attachment.content ? new Uint8Array(attachment.content) : undefined,
13650
+ httpHeaders: attachment.httpHeaders
13651
+ ? JSON.stringify(attachment.httpHeaders)
13652
+ : undefined,
13653
+ })) ?? [],
13501
13654
  },
13502
13655
  }).then(res => {
13503
13656
  return res.sentMessageInfo;
@@ -15035,6 +15188,7 @@ exports.AdminRouterDefinition = AdminRouterDefinition;
15035
15188
  exports.AllowedResourcesRequest = AllowedResourcesRequest;
15036
15189
  exports.AllowedResourcesResponse = AllowedResourcesResponse;
15037
15190
  exports.AnonymousUserCreateRequest = AnonymousUserCreateRequest;
15191
+ exports.Attachment = Attachment;
15038
15192
  exports.Authentication = Authentication;
15039
15193
  exports.AuthenticationDefinition = AuthenticationDefinition;
15040
15194
  exports.Authorization = Authorization;