s3db.js 4.1.4 → 4.1.6

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/s3db.es.js CHANGED
@@ -899,10 +899,10 @@ class Client extends EventEmitter {
899
899
  Bucket: this.config.bucket,
900
900
  Key: this.config.keyPrefix ? path.join(this.config.keyPrefix, key) : key,
901
901
  Metadata: { ...metadata },
902
- Body: body || "",
903
- ContentType: contentType,
904
- ContentEncoding: contentEncoding
902
+ Body: body || Buffer.alloc(0)
905
903
  };
904
+ if (contentType !== void 0) options2.ContentType = contentType;
905
+ if (contentEncoding !== void 0) options2.ContentEncoding = contentEncoding;
906
906
  try {
907
907
  const response = await this.sendCommand(new PutObjectCommand(options2));
908
908
  this.emit("putObject", response, options2);
@@ -8498,12 +8498,16 @@ class ResourceWriter extends EventEmitter {
8498
8498
  }
8499
8499
  write(chunk) {
8500
8500
  this.buffer.push(chunk);
8501
- this._maybeWrite();
8501
+ this._maybeWrite().catch((error) => {
8502
+ this.emit("error", error);
8503
+ });
8502
8504
  return true;
8503
8505
  }
8504
8506
  end() {
8505
8507
  this.ended = true;
8506
- this._maybeWrite();
8508
+ this._maybeWrite().catch((error) => {
8509
+ this.emit("error", error);
8510
+ });
8507
8511
  }
8508
8512
  async _maybeWrite() {
8509
8513
  if (this.writing) return;
@@ -8600,7 +8604,7 @@ function calculateTotalSize(mappedObject) {
8600
8604
  return Object.values(sizes).reduce((total, size) => total + size, 0);
8601
8605
  }
8602
8606
 
8603
- const S3_METADATA_LIMIT_BYTES$3 = 2048;
8607
+ const S3_METADATA_LIMIT_BYTES$3 = 2e3;
8604
8608
  async function handleInsert$3({ resource, data, mappedData }) {
8605
8609
  const totalSize = calculateTotalSize(mappedData);
8606
8610
  if (totalSize > S3_METADATA_LIMIT_BYTES$3) {
@@ -8654,7 +8658,7 @@ var userManagement = /*#__PURE__*/Object.freeze({
8654
8658
  handleUpsert: handleUpsert$3
8655
8659
  });
8656
8660
 
8657
- const S3_METADATA_LIMIT_BYTES$2 = 2048;
8661
+ const S3_METADATA_LIMIT_BYTES$2 = 2e3;
8658
8662
  async function handleInsert$2({ resource, data, mappedData }) {
8659
8663
  const totalSize = calculateTotalSize(mappedData);
8660
8664
  if (totalSize > S3_METADATA_LIMIT_BYTES$2) {
@@ -8688,7 +8692,7 @@ var enforceLimits = /*#__PURE__*/Object.freeze({
8688
8692
  handleUpsert: handleUpsert$2
8689
8693
  });
8690
8694
 
8691
- const S3_METADATA_LIMIT_BYTES$1 = 2048;
8695
+ const S3_METADATA_LIMIT_BYTES$1 = 2e3;
8692
8696
  const TRUNCATE_SUFFIX = "...";
8693
8697
  const TRUNCATE_SUFFIX_BYTES = calculateUTF8Bytes(TRUNCATE_SUFFIX);
8694
8698
  async function handleInsert$1({ resource, data, mappedData }) {
@@ -8746,7 +8750,7 @@ var dataTruncate = /*#__PURE__*/Object.freeze({
8746
8750
  handleUpsert: handleUpsert$1
8747
8751
  });
8748
8752
 
8749
- const S3_METADATA_LIMIT_BYTES = 2048;
8753
+ const S3_METADATA_LIMIT_BYTES = 2e3;
8750
8754
  const OVERFLOW_FLAG = "$overflow";
8751
8755
  const OVERFLOW_FLAG_VALUE = "true";
8752
8756
  const OVERFLOW_FLAG_BYTES = calculateUTF8Bytes(OVERFLOW_FLAG) + calculateUTF8Bytes(OVERFLOW_FLAG_VALUE);
@@ -9815,7 +9819,7 @@ class Database extends EventEmitter {
9815
9819
  this.version = "1";
9816
9820
  this.s3dbVersion = (() => {
9817
9821
  try {
9818
- return true ? "4.1.3" : "latest";
9822
+ return true ? "4.1.4" : "latest";
9819
9823
  } catch (e) {
9820
9824
  return "latest";
9821
9825
  }