@conduitplatform/grpc-sdk 0.16.24 → 0.16.26

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
  };
@@ -7781,6 +7795,14 @@ const DatabaseProviderDefinition = {
7781
7795
  responseStream: false,
7782
7796
  options: {},
7783
7797
  },
7798
+ generateId: {
7799
+ name: "GenerateId",
7800
+ requestType: Empty,
7801
+ requestStream: false,
7802
+ responseType: GetDatabaseTypeResponse,
7803
+ responseStream: false,
7804
+ options: {},
7805
+ },
7784
7806
  /** Database queries */
7785
7807
  findOne: {
7786
7808
  name: "findOne",
@@ -8218,6 +8240,114 @@ const RegisterTemplateResponse = {
8218
8240
  return message;
8219
8241
  },
8220
8242
  };
8243
+ function createBaseAttachment() {
8244
+ return { filename: "", contentType: undefined, content: undefined, href: undefined, httpHeaders: undefined };
8245
+ }
8246
+ const Attachment = {
8247
+ encode(message, writer = _m0.Writer.create()) {
8248
+ if (message.filename !== "") {
8249
+ writer.uint32(10).string(message.filename);
8250
+ }
8251
+ if (message.contentType !== undefined) {
8252
+ writer.uint32(18).string(message.contentType);
8253
+ }
8254
+ if (message.content !== undefined) {
8255
+ writer.uint32(26).bytes(message.content);
8256
+ }
8257
+ if (message.href !== undefined) {
8258
+ writer.uint32(34).string(message.href);
8259
+ }
8260
+ if (message.httpHeaders !== undefined) {
8261
+ writer.uint32(42).string(message.httpHeaders);
8262
+ }
8263
+ return writer;
8264
+ },
8265
+ decode(input, length) {
8266
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
8267
+ let end = length === undefined ? reader.len : reader.pos + length;
8268
+ const message = createBaseAttachment();
8269
+ while (reader.pos < end) {
8270
+ const tag = reader.uint32();
8271
+ switch (tag >>> 3) {
8272
+ case 1:
8273
+ if (tag !== 10) {
8274
+ break;
8275
+ }
8276
+ message.filename = reader.string();
8277
+ continue;
8278
+ case 2:
8279
+ if (tag !== 18) {
8280
+ break;
8281
+ }
8282
+ message.contentType = reader.string();
8283
+ continue;
8284
+ case 3:
8285
+ if (tag !== 26) {
8286
+ break;
8287
+ }
8288
+ message.content = reader.bytes();
8289
+ continue;
8290
+ case 4:
8291
+ if (tag !== 34) {
8292
+ break;
8293
+ }
8294
+ message.href = reader.string();
8295
+ continue;
8296
+ case 5:
8297
+ if (tag !== 42) {
8298
+ break;
8299
+ }
8300
+ message.httpHeaders = reader.string();
8301
+ continue;
8302
+ }
8303
+ if ((tag & 7) === 4 || tag === 0) {
8304
+ break;
8305
+ }
8306
+ reader.skipType(tag & 7);
8307
+ }
8308
+ return message;
8309
+ },
8310
+ fromJSON(object) {
8311
+ return {
8312
+ filename: isSet$6(object.filename) ? globalThis.String(object.filename) : "",
8313
+ contentType: isSet$6(object.contentType) ? globalThis.String(object.contentType) : undefined,
8314
+ content: isSet$6(object.content) ? bytesFromBase64(object.content) : undefined,
8315
+ href: isSet$6(object.href) ? globalThis.String(object.href) : undefined,
8316
+ httpHeaders: isSet$6(object.httpHeaders) ? globalThis.String(object.httpHeaders) : undefined,
8317
+ };
8318
+ },
8319
+ toJSON(message) {
8320
+ const obj = {};
8321
+ if (message.filename !== "") {
8322
+ obj.filename = message.filename;
8323
+ }
8324
+ if (message.contentType !== undefined) {
8325
+ obj.contentType = message.contentType;
8326
+ }
8327
+ if (message.content !== undefined) {
8328
+ obj.content = base64FromBytes(message.content);
8329
+ }
8330
+ if (message.href !== undefined) {
8331
+ obj.href = message.href;
8332
+ }
8333
+ if (message.httpHeaders !== undefined) {
8334
+ obj.httpHeaders = message.httpHeaders;
8335
+ }
8336
+ return obj;
8337
+ },
8338
+ create(base) {
8339
+ return Attachment.fromPartial(base ?? {});
8340
+ },
8341
+ fromPartial(object) {
8342
+ const message = createBaseAttachment();
8343
+ message.filename = object.filename ?? "";
8344
+ message.contentType = object.contentType ?? undefined;
8345
+ message.content = object.content ?? undefined;
8346
+ message.href = object.href ?? undefined;
8347
+ message.httpHeaders = object.httpHeaders ?? undefined;
8348
+ return message;
8349
+ },
8350
+ };
8221
8351
  function createBaseSendEmailRequest() {
8222
8352
  return { templateName: "", params: undefined };
8223
8353
  }
@@ -8322,7 +8452,7 @@ const SendEmailRequest_SendEmailParams = {
8322
8452
  writer.uint32(42).string(message.replyTo);
8323
8453
  }
8324
8454
  for (const v of message.attachments) {
8325
- writer.uint32(50).string(v);
8455
+ Attachment.encode(v, writer.uint32(50).fork()).ldelim();
8326
8456
  }
8327
8457
  return writer;
8328
8458
  },
@@ -8379,7 +8509,7 @@ const SendEmailRequest_SendEmailParams = {
8379
8509
  if (tag !== 50) {
8380
8510
  break;
8381
8511
  }
8382
- message.attachments.push(reader.string());
8512
+ message.attachments.push(Attachment.decode(reader, reader.uint32()));
8383
8513
  continue;
8384
8514
  }
8385
8515
  if ((tag & 7) === 4 || tag === 0) {
@@ -8399,7 +8529,7 @@ const SendEmailRequest_SendEmailParams = {
8399
8529
  cc: globalThis.Array.isArray(object?.cc) ? object.cc.map((e) => globalThis.String(e)) : [],
8400
8530
  replyTo: isSet$6(object.replyTo) ? globalThis.String(object.replyTo) : undefined,
8401
8531
  attachments: globalThis.Array.isArray(object?.attachments)
8402
- ? object.attachments.map((e) => globalThis.String(e))
8532
+ ? object.attachments.map((e) => Attachment.fromJSON(e))
8403
8533
  : [],
8404
8534
  };
8405
8535
  },
@@ -8427,7 +8557,7 @@ const SendEmailRequest_SendEmailParams = {
8427
8557
  obj.replyTo = message.replyTo;
8428
8558
  }
8429
8559
  if (message.attachments?.length) {
8430
- obj.attachments = message.attachments;
8560
+ obj.attachments = message.attachments.map((e) => Attachment.toJSON(e));
8431
8561
  }
8432
8562
  return obj;
8433
8563
  },
@@ -8443,7 +8573,7 @@ const SendEmailRequest_SendEmailParams = {
8443
8573
  message.sender = object.sender ?? undefined;
8444
8574
  message.cc = object.cc?.map((e) => e) || [];
8445
8575
  message.replyTo = object.replyTo ?? undefined;
8446
- message.attachments = object.attachments?.map((e) => e) || [];
8576
+ message.attachments = object.attachments?.map((e) => Attachment.fromPartial(e)) || [];
8447
8577
  return message;
8448
8578
  },
8449
8579
  };
@@ -8743,6 +8873,31 @@ const EmailDefinition = {
8743
8873
  },
8744
8874
  },
8745
8875
  };
8876
+ function bytesFromBase64(b64) {
8877
+ if (globalThis.Buffer) {
8878
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
8879
+ }
8880
+ else {
8881
+ const bin = globalThis.atob(b64);
8882
+ const arr = new Uint8Array(bin.length);
8883
+ for (let i = 0; i < bin.length; ++i) {
8884
+ arr[i] = bin.charCodeAt(i);
8885
+ }
8886
+ return arr;
8887
+ }
8888
+ }
8889
+ function base64FromBytes(arr) {
8890
+ if (globalThis.Buffer) {
8891
+ return globalThis.Buffer.from(arr).toString("base64");
8892
+ }
8893
+ else {
8894
+ const bin = [];
8895
+ arr.forEach((byte) => {
8896
+ bin.push(globalThis.String.fromCharCode(byte));
8897
+ });
8898
+ return globalThis.btoa(bin.join(""));
8899
+ }
8900
+ }
8746
8901
  function isSet$6(value) {
8747
8902
  return value !== null && value !== undefined;
8748
8903
  }
@@ -13497,7 +13652,13 @@ class Email extends ConduitModule {
13497
13652
  sender: params.sender,
13498
13653
  replyTo: params.replyTo,
13499
13654
  cc: params.cc ?? [],
13500
- attachments: params.attachments ?? [],
13655
+ attachments: params.attachments?.map(attachment => ({
13656
+ ...attachment,
13657
+ content: attachment.content ? new Uint8Array(attachment.content) : undefined,
13658
+ httpHeaders: attachment.httpHeaders
13659
+ ? JSON.stringify(attachment.httpHeaders)
13660
+ : undefined,
13661
+ })) ?? [],
13501
13662
  },
13502
13663
  }).then(res => {
13503
13664
  return res.sentMessageInfo;
@@ -13806,6 +13967,9 @@ class DatabaseProvider extends ConduitModule {
13806
13967
  getDatabaseType() {
13807
13968
  return this.client.getDatabaseType({});
13808
13969
  }
13970
+ generateId() {
13971
+ return this.client.generateId({}).then(res => res.result);
13972
+ }
13809
13973
  constructSortObj(sort) {
13810
13974
  const sortObj = {};
13811
13975
  sort.forEach((sortVal) => {
@@ -15035,6 +15199,7 @@ exports.AdminRouterDefinition = AdminRouterDefinition;
15035
15199
  exports.AllowedResourcesRequest = AllowedResourcesRequest;
15036
15200
  exports.AllowedResourcesResponse = AllowedResourcesResponse;
15037
15201
  exports.AnonymousUserCreateRequest = AnonymousUserCreateRequest;
15202
+ exports.Attachment = Attachment;
15038
15203
  exports.Authentication = Authentication;
15039
15204
  exports.AuthenticationDefinition = AuthenticationDefinition;
15040
15205
  exports.Authorization = Authorization;