@stonyx/orm 0.3.2-beta.79 → 0.3.2-beta.80
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.
|
@@ -366,7 +366,11 @@ export default class DynamoDBDB {
|
|
|
366
366
|
const changedData = {};
|
|
367
367
|
for (const col of Object.keys(schema.columns)) {
|
|
368
368
|
if (currentData[col] !== oldState[col]) {
|
|
369
|
-
|
|
369
|
+
const value = currentData[col] ?? null;
|
|
370
|
+
// Date objects must be serialized to ISO-8601 strings for DynamoDB 'S' storage
|
|
371
|
+
changedData[col] = (schema.columns[col] === 'date' && value instanceof Date)
|
|
372
|
+
? value.toISOString()
|
|
373
|
+
: value;
|
|
370
374
|
}
|
|
371
375
|
}
|
|
372
376
|
// FK changes
|
|
@@ -533,8 +537,13 @@ export default class DynamoDBDB {
|
|
|
533
537
|
if (data.id !== undefined)
|
|
534
538
|
item.id = data.id;
|
|
535
539
|
for (const col of Object.keys(schema.columns)) {
|
|
536
|
-
if (data[col] !== undefined)
|
|
537
|
-
|
|
540
|
+
if (data[col] !== undefined) {
|
|
541
|
+
const value = data[col];
|
|
542
|
+
// Date objects must be serialized to ISO-8601 strings for DynamoDB 'S' storage
|
|
543
|
+
item[col] = (schema.columns[col] === 'date' && value instanceof Date)
|
|
544
|
+
? value.toISOString()
|
|
545
|
+
: value;
|
|
546
|
+
}
|
|
538
547
|
}
|
|
539
548
|
for (const fkCol of Object.keys(schema.foreignKeys)) {
|
|
540
549
|
const relName = fkCol.replace(/_id$/, '');
|
package/package.json
CHANGED
|
@@ -523,7 +523,11 @@ export default class DynamoDBDB {
|
|
|
523
523
|
|
|
524
524
|
for (const col of Object.keys(schema.columns)) {
|
|
525
525
|
if (currentData[col] !== oldState[col]) {
|
|
526
|
-
|
|
526
|
+
const value = currentData[col] ?? null;
|
|
527
|
+
// Date objects must be serialized to ISO-8601 strings for DynamoDB 'S' storage
|
|
528
|
+
changedData[col] = (schema.columns[col] === 'date' && value instanceof Date)
|
|
529
|
+
? value.toISOString()
|
|
530
|
+
: value;
|
|
527
531
|
}
|
|
528
532
|
}
|
|
529
533
|
|
|
@@ -739,7 +743,13 @@ export default class DynamoDBDB {
|
|
|
739
743
|
if (data.id !== undefined) item.id = data.id;
|
|
740
744
|
|
|
741
745
|
for (const col of Object.keys(schema.columns)) {
|
|
742
|
-
if (data[col] !== undefined)
|
|
746
|
+
if (data[col] !== undefined) {
|
|
747
|
+
const value = data[col];
|
|
748
|
+
// Date objects must be serialized to ISO-8601 strings for DynamoDB 'S' storage
|
|
749
|
+
item[col] = (schema.columns[col] === 'date' && value instanceof Date)
|
|
750
|
+
? value.toISOString()
|
|
751
|
+
: value;
|
|
752
|
+
}
|
|
743
753
|
}
|
|
744
754
|
|
|
745
755
|
for (const fkCol of Object.keys(schema.foreignKeys)) {
|