s3db.js 4.1.4 → 4.1.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/README.md CHANGED
@@ -440,7 +440,7 @@ try {
440
440
  });
441
441
  } catch (error) {
442
442
  console.error("Operation failed:", error.message);
443
- // Error: S3 metadata size exceeds 2KB limit. Current size: 2500 bytes, limit: 2048 bytes
443
+ // Error: S3 metadata size exceeds 2KB limit. Current size: 2500 bytes, limit: 2000 bytes
444
444
  }
445
445
  ```
446
446
 
package/dist/s3db.cjs.js CHANGED
@@ -901,10 +901,10 @@ class Client extends EventEmitter {
901
901
  Bucket: this.config.bucket,
902
902
  Key: this.config.keyPrefix ? path.join(this.config.keyPrefix, key) : key,
903
903
  Metadata: { ...metadata },
904
- Body: body || "",
905
- ContentType: contentType,
906
- ContentEncoding: contentEncoding
904
+ Body: body || Buffer.alloc(0)
907
905
  };
906
+ if (contentType !== void 0) options2.ContentType = contentType;
907
+ if (contentEncoding !== void 0) options2.ContentEncoding = contentEncoding;
908
908
  try {
909
909
  const response = await this.sendCommand(new clientS3.PutObjectCommand(options2));
910
910
  this.emit("putObject", response, options2);
@@ -8500,12 +8500,16 @@ class ResourceWriter extends EventEmitter {
8500
8500
  }
8501
8501
  write(chunk) {
8502
8502
  this.buffer.push(chunk);
8503
- this._maybeWrite();
8503
+ this._maybeWrite().catch((error) => {
8504
+ this.emit("error", error);
8505
+ });
8504
8506
  return true;
8505
8507
  }
8506
8508
  end() {
8507
8509
  this.ended = true;
8508
- this._maybeWrite();
8510
+ this._maybeWrite().catch((error) => {
8511
+ this.emit("error", error);
8512
+ });
8509
8513
  }
8510
8514
  async _maybeWrite() {
8511
8515
  if (this.writing) return;
@@ -8602,7 +8606,7 @@ function calculateTotalSize(mappedObject) {
8602
8606
  return Object.values(sizes).reduce((total, size) => total + size, 0);
8603
8607
  }
8604
8608
 
8605
- const S3_METADATA_LIMIT_BYTES$3 = 2048;
8609
+ const S3_METADATA_LIMIT_BYTES$3 = 2e3;
8606
8610
  async function handleInsert$3({ resource, data, mappedData }) {
8607
8611
  const totalSize = calculateTotalSize(mappedData);
8608
8612
  if (totalSize > S3_METADATA_LIMIT_BYTES$3) {
@@ -8656,7 +8660,7 @@ var userManagement = /*#__PURE__*/Object.freeze({
8656
8660
  handleUpsert: handleUpsert$3
8657
8661
  });
8658
8662
 
8659
- const S3_METADATA_LIMIT_BYTES$2 = 2048;
8663
+ const S3_METADATA_LIMIT_BYTES$2 = 2e3;
8660
8664
  async function handleInsert$2({ resource, data, mappedData }) {
8661
8665
  const totalSize = calculateTotalSize(mappedData);
8662
8666
  if (totalSize > S3_METADATA_LIMIT_BYTES$2) {
@@ -8690,7 +8694,7 @@ var enforceLimits = /*#__PURE__*/Object.freeze({
8690
8694
  handleUpsert: handleUpsert$2
8691
8695
  });
8692
8696
 
8693
- const S3_METADATA_LIMIT_BYTES$1 = 2048;
8697
+ const S3_METADATA_LIMIT_BYTES$1 = 2e3;
8694
8698
  const TRUNCATE_SUFFIX = "...";
8695
8699
  const TRUNCATE_SUFFIX_BYTES = calculateUTF8Bytes(TRUNCATE_SUFFIX);
8696
8700
  async function handleInsert$1({ resource, data, mappedData }) {
@@ -8748,7 +8752,7 @@ var dataTruncate = /*#__PURE__*/Object.freeze({
8748
8752
  handleUpsert: handleUpsert$1
8749
8753
  });
8750
8754
 
8751
- const S3_METADATA_LIMIT_BYTES = 2048;
8755
+ const S3_METADATA_LIMIT_BYTES = 2e3;
8752
8756
  const OVERFLOW_FLAG = "$overflow";
8753
8757
  const OVERFLOW_FLAG_VALUE = "true";
8754
8758
  const OVERFLOW_FLAG_BYTES = calculateUTF8Bytes(OVERFLOW_FLAG) + calculateUTF8Bytes(OVERFLOW_FLAG_VALUE);
@@ -9817,7 +9821,7 @@ class Database extends EventEmitter {
9817
9821
  this.version = "1";
9818
9822
  this.s3dbVersion = (() => {
9819
9823
  try {
9820
- return true ? "4.1.3" : "latest";
9824
+ return true ? "4.1.4" : "latest";
9821
9825
  } catch (e) {
9822
9826
  return "latest";
9823
9827
  }