s3db.js 4.1.3 → 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 +1 -1
- package/dist/s3db.cjs.js +27 -12
- package/dist/s3db.cjs.min.js +3 -3
- package/dist/s3db.es.js +27 -12
- package/dist/s3db.es.min.js +6 -6
- package/dist/s3db.iife.js +27 -12
- package/dist/s3db.iife.min.js +3 -3
- package/package.json +1 -1
package/dist/s3db.iife.js
CHANGED
|
@@ -893,10 +893,10 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
893
893
|
Bucket: this.config.bucket,
|
|
894
894
|
Key: this.config.keyPrefix ? path.join(this.config.keyPrefix, key) : key,
|
|
895
895
|
Metadata: { ...metadata },
|
|
896
|
-
Body: body ||
|
|
897
|
-
ContentType: contentType,
|
|
898
|
-
ContentEncoding: contentEncoding
|
|
896
|
+
Body: body || Buffer.alloc(0)
|
|
899
897
|
};
|
|
898
|
+
if (contentType !== void 0) options2.ContentType = contentType;
|
|
899
|
+
if (contentEncoding !== void 0) options2.ContentEncoding = contentEncoding;
|
|
900
900
|
try {
|
|
901
901
|
const response = await this.sendCommand(new clientS3.PutObjectCommand(options2));
|
|
902
902
|
this.emit("putObject", response, options2);
|
|
@@ -3474,6 +3474,7 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
3474
3474
|
this.attributes = attributes || {};
|
|
3475
3475
|
this.passphrase = passphrase ?? "secret";
|
|
3476
3476
|
this.options = lodashEs.merge({}, this.defaultOptions(), options);
|
|
3477
|
+
this.allNestedObjectsOptional = this.options.allNestedObjectsOptional ?? false;
|
|
3477
3478
|
const processedAttributes = this.preprocessAttributesForValidation(this.attributes);
|
|
3478
3479
|
this.validator = new ValidatorManager({ autoEncrypt: false }).compile(lodashEs.merge(
|
|
3479
3480
|
{ $$async: true },
|
|
@@ -3671,11 +3672,17 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
3671
3672
|
const processed = {};
|
|
3672
3673
|
for (const [key, value] of Object.entries(attributes)) {
|
|
3673
3674
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
3674
|
-
|
|
3675
|
+
const isExplicitRequired = value.$$type && value.$$type.includes("required");
|
|
3676
|
+
const isExplicitOptional = value.$$type && value.$$type.includes("optional");
|
|
3677
|
+
const objectConfig = {
|
|
3675
3678
|
type: "object",
|
|
3676
3679
|
properties: this.preprocessAttributesForValidation(value),
|
|
3677
3680
|
strict: false
|
|
3678
3681
|
};
|
|
3682
|
+
if (isExplicitRequired) ; else if (isExplicitOptional || this.allNestedObjectsOptional) {
|
|
3683
|
+
objectConfig.optional = true;
|
|
3684
|
+
}
|
|
3685
|
+
processed[key] = objectConfig;
|
|
3679
3686
|
} else {
|
|
3680
3687
|
processed[key] = value;
|
|
3681
3688
|
}
|
|
@@ -8485,12 +8492,16 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
8485
8492
|
}
|
|
8486
8493
|
write(chunk) {
|
|
8487
8494
|
this.buffer.push(chunk);
|
|
8488
|
-
this._maybeWrite()
|
|
8495
|
+
this._maybeWrite().catch((error) => {
|
|
8496
|
+
this.emit("error", error);
|
|
8497
|
+
});
|
|
8489
8498
|
return true;
|
|
8490
8499
|
}
|
|
8491
8500
|
end() {
|
|
8492
8501
|
this.ended = true;
|
|
8493
|
-
this._maybeWrite()
|
|
8502
|
+
this._maybeWrite().catch((error) => {
|
|
8503
|
+
this.emit("error", error);
|
|
8504
|
+
});
|
|
8494
8505
|
}
|
|
8495
8506
|
async _maybeWrite() {
|
|
8496
8507
|
if (this.writing) return;
|
|
@@ -8587,7 +8598,7 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
8587
8598
|
return Object.values(sizes).reduce((total, size) => total + size, 0);
|
|
8588
8599
|
}
|
|
8589
8600
|
|
|
8590
|
-
const S3_METADATA_LIMIT_BYTES$3 =
|
|
8601
|
+
const S3_METADATA_LIMIT_BYTES$3 = 2e3;
|
|
8591
8602
|
async function handleInsert$3({ resource, data, mappedData }) {
|
|
8592
8603
|
const totalSize = calculateTotalSize(mappedData);
|
|
8593
8604
|
if (totalSize > S3_METADATA_LIMIT_BYTES$3) {
|
|
@@ -8641,7 +8652,7 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
8641
8652
|
handleUpsert: handleUpsert$3
|
|
8642
8653
|
});
|
|
8643
8654
|
|
|
8644
|
-
const S3_METADATA_LIMIT_BYTES$2 =
|
|
8655
|
+
const S3_METADATA_LIMIT_BYTES$2 = 2e3;
|
|
8645
8656
|
async function handleInsert$2({ resource, data, mappedData }) {
|
|
8646
8657
|
const totalSize = calculateTotalSize(mappedData);
|
|
8647
8658
|
if (totalSize > S3_METADATA_LIMIT_BYTES$2) {
|
|
@@ -8675,7 +8686,7 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
8675
8686
|
handleUpsert: handleUpsert$2
|
|
8676
8687
|
});
|
|
8677
8688
|
|
|
8678
|
-
const S3_METADATA_LIMIT_BYTES$1 =
|
|
8689
|
+
const S3_METADATA_LIMIT_BYTES$1 = 2e3;
|
|
8679
8690
|
const TRUNCATE_SUFFIX = "...";
|
|
8680
8691
|
const TRUNCATE_SUFFIX_BYTES = calculateUTF8Bytes(TRUNCATE_SUFFIX);
|
|
8681
8692
|
async function handleInsert$1({ resource, data, mappedData }) {
|
|
@@ -8733,7 +8744,7 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
8733
8744
|
handleUpsert: handleUpsert$1
|
|
8734
8745
|
});
|
|
8735
8746
|
|
|
8736
|
-
const S3_METADATA_LIMIT_BYTES =
|
|
8747
|
+
const S3_METADATA_LIMIT_BYTES = 2e3;
|
|
8737
8748
|
const OVERFLOW_FLAG = "$overflow";
|
|
8738
8749
|
const OVERFLOW_FLAG_VALUE = "true";
|
|
8739
8750
|
const OVERFLOW_FLAG_BYTES = calculateUTF8Bytes(OVERFLOW_FLAG) + calculateUTF8Bytes(OVERFLOW_FLAG_VALUE);
|
|
@@ -8837,6 +8848,7 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
8837
8848
|
partitions: {},
|
|
8838
8849
|
paranoid: true,
|
|
8839
8850
|
// Security flag for dangerous operations
|
|
8851
|
+
allNestedObjectsOptional: options.allNestedObjectsOptional ?? false,
|
|
8840
8852
|
...options
|
|
8841
8853
|
};
|
|
8842
8854
|
this.hooks = {
|
|
@@ -8871,7 +8883,10 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
8871
8883
|
attributes: this.attributes,
|
|
8872
8884
|
passphrase,
|
|
8873
8885
|
version: this.version,
|
|
8874
|
-
options:
|
|
8886
|
+
options: {
|
|
8887
|
+
...this.options,
|
|
8888
|
+
allNestedObjectsOptional: this.options.allNestedObjectsOptional ?? false
|
|
8889
|
+
}
|
|
8875
8890
|
});
|
|
8876
8891
|
this.validatePartitions();
|
|
8877
8892
|
this.setupPartitionHooks();
|
|
@@ -9798,7 +9813,7 @@ ${JSON.stringify(validation, null, 2)}`
|
|
|
9798
9813
|
this.version = "1";
|
|
9799
9814
|
this.s3dbVersion = (() => {
|
|
9800
9815
|
try {
|
|
9801
|
-
return true ? "4.1.
|
|
9816
|
+
return true ? "4.1.4" : "latest";
|
|
9802
9817
|
} catch (e) {
|
|
9803
9818
|
return "latest";
|
|
9804
9819
|
}
|