dyna-record 0.6.7 → 0.7.1
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 +23 -7
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -22
- package/dist/src/DynaRecord.d.ts +3 -3
- package/dist/src/DynaRecord.d.ts.map +1 -1
- package/dist/src/DynaRecord.js +24 -59
- package/dist/src/Logger.js +1 -3
- package/dist/src/decorators/Entity.d.ts +1 -1
- package/dist/src/decorators/Entity.d.ts.map +1 -1
- package/dist/src/decorators/Entity.js +3 -8
- package/dist/src/decorators/Table.d.ts +2 -2
- package/dist/src/decorators/Table.d.ts.map +1 -1
- package/dist/src/decorators/Table.js +3 -8
- package/dist/src/decorators/attributes/BooleanAttribute.d.ts +2 -2
- package/dist/src/decorators/attributes/BooleanAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/BooleanAttribute.js +5 -10
- package/dist/src/decorators/attributes/DateAttribute.d.ts +2 -2
- package/dist/src/decorators/attributes/DateAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/DateAttribute.js +7 -12
- package/dist/src/decorators/attributes/EnumAttribute.d.ts +2 -2
- package/dist/src/decorators/attributes/EnumAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/EnumAttribute.js +5 -10
- package/dist/src/decorators/attributes/ForeignKeyAttribute.d.ts +3 -3
- package/dist/src/decorators/attributes/ForeignKeyAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/ForeignKeyAttribute.js +5 -10
- package/dist/src/decorators/attributes/IdAttribute.d.ts +1 -1
- package/dist/src/decorators/attributes/IdAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/IdAttribute.js +3 -8
- package/dist/src/decorators/attributes/NumberAttribute.d.ts +2 -2
- package/dist/src/decorators/attributes/NumberAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/NumberAttribute.js +5 -10
- package/dist/src/decorators/attributes/ObjectAttribute.d.ts +3 -3
- package/dist/src/decorators/attributes/ObjectAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/ObjectAttribute.js +16 -21
- package/dist/src/decorators/attributes/PartitionKeyAttribute.d.ts +3 -3
- package/dist/src/decorators/attributes/PartitionKeyAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/PartitionKeyAttribute.js +5 -10
- package/dist/src/decorators/attributes/SortKeyAttribute.d.ts +3 -3
- package/dist/src/decorators/attributes/SortKeyAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/SortKeyAttribute.js +5 -10
- package/dist/src/decorators/attributes/StringAttribute.d.ts +2 -2
- package/dist/src/decorators/attributes/StringAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/StringAttribute.js +5 -10
- package/dist/src/decorators/attributes/index.d.ts +13 -13
- package/dist/src/decorators/attributes/index.d.ts.map +1 -1
- package/dist/src/decorators/attributes/index.js +11 -41
- package/dist/src/decorators/attributes/serializers.d.ts +2 -2
- package/dist/src/decorators/attributes/serializers.d.ts.map +1 -1
- package/dist/src/decorators/attributes/serializers.js +5 -12
- package/dist/src/decorators/attributes/types.js +1 -2
- package/dist/src/decorators/index.d.ts +5 -5
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +5 -27
- package/dist/src/decorators/relationships/BelongsTo.d.ts +4 -4
- package/dist/src/decorators/relationships/BelongsTo.d.ts.map +1 -1
- package/dist/src/decorators/relationships/BelongsTo.js +3 -8
- package/dist/src/decorators/relationships/HasAndBelongsToMany.d.ts +3 -3
- package/dist/src/decorators/relationships/HasAndBelongsToMany.d.ts.map +1 -1
- package/dist/src/decorators/relationships/HasAndBelongsToMany.js +4 -9
- package/dist/src/decorators/relationships/HasMany.d.ts +3 -3
- package/dist/src/decorators/relationships/HasMany.d.ts.map +1 -1
- package/dist/src/decorators/relationships/HasMany.js +4 -9
- package/dist/src/decorators/relationships/HasOne.d.ts +3 -3
- package/dist/src/decorators/relationships/HasOne.d.ts.map +1 -1
- package/dist/src/decorators/relationships/HasOne.js +3 -8
- package/dist/src/decorators/relationships/index.d.ts +5 -5
- package/dist/src/decorators/relationships/index.d.ts.map +1 -1
- package/dist/src/decorators/relationships/index.js +5 -29
- package/dist/src/decorators/relationships/types.d.ts +3 -3
- package/dist/src/decorators/relationships/types.d.ts.map +1 -1
- package/dist/src/decorators/relationships/types.js +1 -2
- package/dist/src/decorators/types.d.ts +3 -3
- package/dist/src/decorators/types.d.ts.map +1 -1
- package/dist/src/decorators/types.js +1 -2
- package/dist/src/dynamo-utils/DynamoClient.d.ts +1 -1
- package/dist/src/dynamo-utils/DynamoClient.d.ts.map +1 -1
- package/dist/src/dynamo-utils/DynamoClient.js +13 -18
- package/dist/src/dynamo-utils/TransactGetBuilder.d.ts +1 -1
- package/dist/src/dynamo-utils/TransactGetBuilder.d.ts.map +1 -1
- package/dist/src/dynamo-utils/TransactGetBuilder.js +5 -10
- package/dist/src/dynamo-utils/TransactWriteBuilder.d.ts +1 -1
- package/dist/src/dynamo-utils/TransactWriteBuilder.d.ts.map +1 -1
- package/dist/src/dynamo-utils/TransactWriteBuilder.js +11 -16
- package/dist/src/dynamo-utils/errors.js +2 -7
- package/dist/src/dynamo-utils/index.d.ts +7 -7
- package/dist/src/dynamo-utils/index.d.ts.map +1 -1
- package/dist/src/dynamo-utils/index.js +7 -30
- package/dist/src/dynamo-utils/types.js +1 -2
- package/dist/src/errors.js +3 -9
- package/dist/src/id.d.ts +12 -0
- package/dist/src/id.d.ts.map +1 -0
- package/dist/src/id.js +11 -0
- package/dist/src/index.d.ts +8 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -20
- package/dist/src/metadata/AttributeMetadata.d.ts +4 -4
- package/dist/src/metadata/AttributeMetadata.d.ts.map +1 -1
- package/dist/src/metadata/AttributeMetadata.js +1 -3
- package/dist/src/metadata/EntityMetadata.d.ts +3 -3
- package/dist/src/metadata/EntityMetadata.d.ts.map +1 -1
- package/dist/src/metadata/EntityMetadata.js +18 -23
- package/dist/src/metadata/JoinTableMetadata.d.ts +3 -3
- package/dist/src/metadata/JoinTableMetadata.d.ts.map +1 -1
- package/dist/src/metadata/JoinTableMetadata.js +1 -3
- package/dist/src/metadata/MetadataStorage.d.ts +7 -7
- package/dist/src/metadata/MetadataStorage.d.ts.map +1 -1
- package/dist/src/metadata/MetadataStorage.js +12 -17
- package/dist/src/metadata/TableMetadata.d.ts +3 -3
- package/dist/src/metadata/TableMetadata.d.ts.map +1 -1
- package/dist/src/metadata/TableMetadata.js +17 -20
- package/dist/src/metadata/index.d.ts +9 -9
- package/dist/src/metadata/index.d.ts.map +1 -1
- package/dist/src/metadata/index.js +11 -34
- package/dist/src/metadata/relationship-metadata/BelongsToRelationship.d.ts +2 -2
- package/dist/src/metadata/relationship-metadata/BelongsToRelationship.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/BelongsToRelationship.js +3 -8
- package/dist/src/metadata/relationship-metadata/HasAndBelongsToManyRelationship.d.ts +1 -1
- package/dist/src/metadata/relationship-metadata/HasAndBelongsToManyRelationship.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/HasAndBelongsToManyRelationship.js +3 -8
- package/dist/src/metadata/relationship-metadata/HasManyRelationship.d.ts +2 -2
- package/dist/src/metadata/relationship-metadata/HasManyRelationship.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/HasManyRelationship.js +3 -8
- package/dist/src/metadata/relationship-metadata/HasOneRelationship.d.ts +2 -2
- package/dist/src/metadata/relationship-metadata/HasOneRelationship.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/HasOneRelationship.js +3 -8
- package/dist/src/metadata/relationship-metadata/OwnedByRelationship.d.ts +2 -2
- package/dist/src/metadata/relationship-metadata/OwnedByRelationship.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/OwnedByRelationship.js +3 -8
- package/dist/src/metadata/relationship-metadata/RelationshipMetadata.d.ts +2 -2
- package/dist/src/metadata/relationship-metadata/RelationshipMetadata.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/RelationshipMetadata.js +1 -3
- package/dist/src/metadata/relationship-metadata/index.d.ts +6 -6
- package/dist/src/metadata/relationship-metadata/index.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/index.js +7 -31
- package/dist/src/metadata/relationship-metadata/types.d.ts +5 -5
- package/dist/src/metadata/relationship-metadata/types.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/types.js +1 -2
- package/dist/src/metadata/relationship-metadata/utils.d.ts +1 -1
- package/dist/src/metadata/relationship-metadata/utils.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/utils.js +11 -18
- package/dist/src/metadata/schemas.d.ts +3 -3
- package/dist/src/metadata/schemas.d.ts.map +1 -1
- package/dist/src/metadata/schemas.js +34 -37
- package/dist/src/metadata/types.d.ts +4 -4
- package/dist/src/metadata/types.d.ts.map +1 -1
- package/dist/src/metadata/types.js +1 -2
- package/dist/src/metadata/utils.d.ts +5 -5
- package/dist/src/metadata/utils.d.ts.map +1 -1
- package/dist/src/metadata/utils.js +14 -29
- package/dist/src/operations/Create/Create.d.ts +5 -5
- package/dist/src/operations/Create/Create.d.ts.map +1 -1
- package/dist/src/operations/Create/Create.js +18 -23
- package/dist/src/operations/Create/index.d.ts +2 -2
- package/dist/src/operations/Create/index.d.ts.map +1 -1
- package/dist/src/operations/Create/index.js +2 -23
- package/dist/src/operations/Create/types.d.ts +2 -2
- package/dist/src/operations/Create/types.d.ts.map +1 -1
- package/dist/src/operations/Create/types.js +1 -2
- package/dist/src/operations/Delete/Delete.d.ts +3 -3
- package/dist/src/operations/Delete/Delete.d.ts.map +1 -1
- package/dist/src/operations/Delete/Delete.js +28 -33
- package/dist/src/operations/Delete/index.d.ts +1 -1
- package/dist/src/operations/Delete/index.d.ts.map +1 -1
- package/dist/src/operations/Delete/index.js +1 -8
- package/dist/src/operations/Delete/types.js +1 -2
- package/dist/src/operations/FindById/FindById.d.ts +4 -4
- package/dist/src/operations/FindById/FindById.d.ts.map +1 -1
- package/dist/src/operations/FindById/FindById.js +17 -22
- package/dist/src/operations/FindById/index.d.ts +2 -2
- package/dist/src/operations/FindById/index.d.ts.map +1 -1
- package/dist/src/operations/FindById/index.js +2 -23
- package/dist/src/operations/FindById/types.d.ts +3 -3
- package/dist/src/operations/FindById/types.d.ts.map +1 -1
- package/dist/src/operations/FindById/types.js +1 -2
- package/dist/src/operations/OperationBase.d.ts +3 -3
- package/dist/src/operations/OperationBase.d.ts.map +1 -1
- package/dist/src/operations/OperationBase.js +4 -9
- package/dist/src/operations/Query/Query.d.ts +4 -4
- package/dist/src/operations/Query/Query.d.ts.map +1 -1
- package/dist/src/operations/Query/Query.js +15 -20
- package/dist/src/operations/Query/index.d.ts +2 -2
- package/dist/src/operations/Query/index.d.ts.map +1 -1
- package/dist/src/operations/Query/index.js +2 -23
- package/dist/src/operations/Query/types.d.ts +8 -8
- package/dist/src/operations/Query/types.d.ts.map +1 -1
- package/dist/src/operations/Query/types.js +1 -2
- package/dist/src/operations/Update/Update.d.ts +5 -5
- package/dist/src/operations/Update/Update.d.ts.map +1 -1
- package/dist/src/operations/Update/Update.js +37 -42
- package/dist/src/operations/Update/UpdateDryRun.d.ts +2 -2
- package/dist/src/operations/Update/UpdateDryRun.d.ts.map +1 -1
- package/dist/src/operations/Update/UpdateDryRun.js +3 -8
- package/dist/src/operations/Update/index.d.ts +3 -3
- package/dist/src/operations/Update/index.d.ts.map +1 -1
- package/dist/src/operations/Update/index.js +3 -25
- package/dist/src/operations/Update/types.d.ts +2 -2
- package/dist/src/operations/Update/types.d.ts.map +1 -1
- package/dist/src/operations/Update/types.js +1 -2
- package/dist/src/operations/index.d.ts +6 -6
- package/dist/src/operations/index.d.ts.map +1 -1
- package/dist/src/operations/index.js +6 -22
- package/dist/src/operations/types.d.ts +3 -3
- package/dist/src/operations/types.d.ts.map +1 -1
- package/dist/src/operations/types.js +1 -2
- package/dist/src/operations/utils/expressionBuilder.d.ts +2 -2
- package/dist/src/operations/utils/expressionBuilder.d.ts.map +1 -1
- package/dist/src/operations/utils/expressionBuilder.js +1 -5
- package/dist/src/operations/utils/flattenObjectForUpdate.d.ts +2 -2
- package/dist/src/operations/utils/flattenObjectForUpdate.d.ts.map +1 -1
- package/dist/src/operations/utils/flattenObjectForUpdate.js +3 -6
- package/dist/src/operations/utils/index.d.ts +5 -5
- package/dist/src/operations/utils/index.d.ts.map +1 -1
- package/dist/src/operations/utils/index.js +5 -21
- package/dist/src/operations/utils/mergePartialObjectAttributes.d.ts +1 -1
- package/dist/src/operations/utils/mergePartialObjectAttributes.d.ts.map +1 -1
- package/dist/src/operations/utils/mergePartialObjectAttributes.js +1 -4
- package/dist/src/operations/utils/types.js +1 -2
- package/dist/src/operations/utils/utils.d.ts +4 -4
- package/dist/src/operations/utils/utils.d.ts.map +1 -1
- package/dist/src/operations/utils/utils.js +13 -23
- package/dist/src/query-utils/Filters.d.ts +2 -2
- package/dist/src/query-utils/Filters.d.ts.map +1 -1
- package/dist/src/query-utils/Filters.js +1 -4
- package/dist/src/query-utils/QueryBuilder.d.ts +1 -1
- package/dist/src/query-utils/QueryBuilder.d.ts.map +1 -1
- package/dist/src/query-utils/QueryBuilder.js +8 -13
- package/dist/src/query-utils/index.d.ts +2 -2
- package/dist/src/query-utils/index.d.ts.map +1 -1
- package/dist/src/query-utils/index.js +2 -23
- package/dist/src/query-utils/types.js +1 -2
- package/dist/src/relationships/JoinTable.d.ts +2 -2
- package/dist/src/relationships/JoinTable.d.ts.map +1 -1
- package/dist/src/relationships/JoinTable.js +14 -19
- package/dist/src/relationships/index.d.ts +1 -1
- package/dist/src/relationships/index.d.ts.map +1 -1
- package/dist/src/relationships/index.js +1 -8
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -2
- package/dist/src/utils.d.ts +3 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +16 -31
- package/package.json +28 -24
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./FindById"), exports);
|
|
18
|
-
__exportStar(require("./Query"), exports);
|
|
19
|
-
__exportStar(require("./Update"), exports);
|
|
20
|
-
__exportStar(require("./Create"), exports);
|
|
21
|
-
__exportStar(require("./Delete"), exports);
|
|
22
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * from "./FindById/index.js";
|
|
2
|
+
export * from "./Query/index.js";
|
|
3
|
+
export * from "./Update/index.js";
|
|
4
|
+
export * from "./Create/index.js";
|
|
5
|
+
export * from "./Delete/index.js";
|
|
6
|
+
export * from "./types.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type DynaRecord from "../DynaRecord";
|
|
2
|
-
import { type DefaultFields } from "../metadata";
|
|
3
|
-
import type { ForeignKey, NullableForeignKey, Optional, PartitionKey, SortKey } from "../types";
|
|
1
|
+
import type DynaRecord from "../DynaRecord.js";
|
|
2
|
+
import { type DefaultFields } from "../metadata/index.js";
|
|
3
|
+
import type { ForeignKey, NullableForeignKey, Optional, PartitionKey, SortKey } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Represents the type of the partition key attribute for a given entity. It identifies the specific property of the entity that is marked as the partition key, which uniquely identifies each instance of the entity in the database.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DynamoTableItem } from "../../types";
|
|
2
|
-
import type { UpdateExpression, DocumentPathOperation } from "./types";
|
|
1
|
+
import type { DynamoTableItem } from "../../types.js";
|
|
2
|
+
import type { UpdateExpression, DocumentPathOperation } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds a dynamo expression given the table attributes and optional document path operations
|
|
5
5
|
* @param tableAttrs The table aliases of the entity attributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expressionBuilder.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/expressionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"expressionBuilder.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/expressionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAGhB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAyBpB;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,eAAe,EAC3B,kBAAkB,qBAAqB,EAAE,KACxC,gBAiEF,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expressionBuilder = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Builds a dynamo expression given the table attributes and optional document path operations
|
|
6
3
|
* @param tableAttrs The table aliases of the entity attributes
|
|
7
4
|
* @param documentPathOps Optional document path operations for partial ObjectAttribute updates
|
|
8
5
|
* @returns
|
|
9
6
|
*/
|
|
10
|
-
const expressionBuilder = (tableAttrs, documentPathOps) => {
|
|
7
|
+
export const expressionBuilder = (tableAttrs, documentPathOps) => {
|
|
11
8
|
const sorted = sortAttributesByOperand(tableAttrs);
|
|
12
9
|
const setExpression = buildUpdateSetExpression(sorted.set);
|
|
13
10
|
const removeExpression = buildUpdateRemoveExpression(sorted.remove);
|
|
@@ -57,7 +54,6 @@ const expressionBuilder = (tableAttrs, documentPathOps) => {
|
|
|
57
54
|
.join(" ")
|
|
58
55
|
};
|
|
59
56
|
};
|
|
60
|
-
exports.expressionBuilder = expressionBuilder;
|
|
61
57
|
/**
|
|
62
58
|
* Build document path expressions from DocumentPathOperations
|
|
63
59
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ObjectSchema } from "../../decorators/attributes/types";
|
|
2
|
-
import type { DocumentPathOperation } from "./types";
|
|
1
|
+
import type { ObjectSchema } from "../../decorators/attributes/types.js";
|
|
2
|
+
import type { DocumentPathOperation } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Flattens a partial object value into document path operations for DynamoDB
|
|
5
5
|
* update expressions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flattenObjectForUpdate.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/flattenObjectForUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"flattenObjectForUpdate.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/flattenObjectForUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAAE,EACpB,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,qBAAqB,EAAE,CAkCzB"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flattenObjectForUpdate = flattenObjectForUpdate;
|
|
4
|
-
const serializers_1 = require("../../decorators/attributes/serializers");
|
|
1
|
+
import { convertFieldToTableItem } from "../../decorators/attributes/serializers.js";
|
|
5
2
|
/**
|
|
6
3
|
* Flattens a partial object value into document path operations for DynamoDB
|
|
7
4
|
* update expressions.
|
|
@@ -18,7 +15,7 @@ const serializers_1 = require("../../decorators/attributes/serializers");
|
|
|
18
15
|
* @param partialValue The partial object value to flatten
|
|
19
16
|
* @returns Array of DocumentPathOperation for use in expressionBuilder
|
|
20
17
|
*/
|
|
21
|
-
function flattenObjectForUpdate(parentPath, schema, partialValue) {
|
|
18
|
+
export function flattenObjectForUpdate(parentPath, schema, partialValue) {
|
|
22
19
|
const ops = [];
|
|
23
20
|
for (const [key, val] of Object.entries(partialValue)) {
|
|
24
21
|
if (!(key in schema))
|
|
@@ -38,7 +35,7 @@ function flattenObjectForUpdate(parentPath, schema, partialValue) {
|
|
|
38
35
|
ops.push(...nestedOps);
|
|
39
36
|
continue;
|
|
40
37
|
}
|
|
41
|
-
const serialized =
|
|
38
|
+
const serialized = convertFieldToTableItem(fieldDef, val);
|
|
42
39
|
ops.push({ type: "set", path: fieldPath, value: serialized });
|
|
43
40
|
}
|
|
44
41
|
return ops;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./expressionBuilder";
|
|
2
|
-
export * from "./flattenObjectForUpdate";
|
|
3
|
-
export * from "./mergePartialObjectAttributes";
|
|
4
|
-
export * from "./types";
|
|
5
|
-
export * from "./utils";
|
|
1
|
+
export * from "./expressionBuilder.js";
|
|
2
|
+
export * from "./flattenObjectForUpdate.js";
|
|
3
|
+
export * from "./mergePartialObjectAttributes.js";
|
|
4
|
+
export * from "./types.js";
|
|
5
|
+
export * from "./utils.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./expressionBuilder"), exports);
|
|
18
|
-
__exportStar(require("./flattenObjectForUpdate"), exports);
|
|
19
|
-
__exportStar(require("./mergePartialObjectAttributes"), exports);
|
|
20
|
-
__exportStar(require("./types"), exports);
|
|
21
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
export * from "./expressionBuilder.js";
|
|
2
|
+
export * from "./flattenObjectForUpdate.js";
|
|
3
|
+
export * from "./mergePartialObjectAttributes.js";
|
|
4
|
+
export * from "./types.js";
|
|
5
|
+
export * from "./utils.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttributeMetadataStorage } from "../../metadata";
|
|
1
|
+
import type { AttributeMetadataStorage } from "../../metadata/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Deep merges partial ObjectAttribute updates into the target object.
|
|
4
4
|
* For ObjectAttribute fields: recursively merges using the schema, removing null fields.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergePartialObjectAttributes.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/mergePartialObjectAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mergePartialObjectAttributes.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/mergePartialObjectAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGxE;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,WAAW,EAAE,wBAAwB,GACpC,IAAI,CAqBN"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergePartialObjectAttributes = mergePartialObjectAttributes;
|
|
4
1
|
/**
|
|
5
2
|
* Deep merges partial ObjectAttribute updates into the target object.
|
|
6
3
|
* For ObjectAttribute fields: recursively merges using the schema, removing null fields.
|
|
7
4
|
* For regular fields: shallow assigns (existing behavior).
|
|
8
5
|
*/
|
|
9
|
-
function mergePartialObjectAttributes(target, partial, entityAttrs) {
|
|
6
|
+
export function mergePartialObjectAttributes(target, partial, entityAttrs) {
|
|
10
7
|
for (const [key, val] of Object.entries(partial)) {
|
|
11
8
|
if (!(key in entityAttrs)) {
|
|
12
9
|
target[key] = val;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import type { BelongsToOrOwnedByRelationship, RelationshipMetadata } from "../../metadata";
|
|
3
|
-
import type { DynamoTableItem, EntityClass, ForeignKey, RelationshipMetaObj } from "../../types";
|
|
4
|
-
import { type EntityAttributesOnly } from "../types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import type { BelongsToOrOwnedByRelationship, RelationshipMetadata } from "../../metadata/index.js";
|
|
3
|
+
import type { DynamoTableItem, EntityClass, ForeignKey, RelationshipMetaObj } from "../../types.js";
|
|
4
|
+
import { type EntityAttributesOnly } from "../types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates an object including
|
|
7
7
|
* - relationsLookup: Object to look up RelationshipMetadata by Entity name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/operations/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EACV,8BAA8B,EAC9B,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GACzC,eAAe,oBAAoB,EAAE,KACpC,mBAaF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,oBAAoB,EAC7B,QAAQ,OAAO,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,KAChD,UAAU,GAAG,IAAI,GAAG,SAKtB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAChC,aAAa,WAAW,CAAC,UAAU,CAAC,EACpC,UAAU,MAAM,EAChB,SAAS,8BAA8B,EACvC,YAAY,MAAM,KACjB,eAqBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,KAAG,OAEjD,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.consistentReadVal = exports.buildBelongsToLinkKey = exports.extractForeignKeyFromEntity = exports.buildEntityRelationshipMetaObj = void 0;
|
|
7
|
-
const metadata_1 = __importDefault(require("../../metadata"));
|
|
8
|
-
const utils_1 = require("../../metadata/utils");
|
|
9
|
-
const utils_2 = require("../../utils");
|
|
1
|
+
import Metadata from "../../metadata/index.js";
|
|
2
|
+
import { doesEntityBelongToRelAsHasMany, doesEntityBelongToRelAsHasOne, isBelongsToRelationship, isRelationshipMetadataWithForeignKey } from "../../metadata/utils.js";
|
|
3
|
+
import { isKeyOfObject } from "../../utils.js";
|
|
10
4
|
/**
|
|
11
5
|
* Creates an object including
|
|
12
6
|
* - relationsLookup: Object to look up RelationshipMetadata by Entity name
|
|
@@ -14,29 +8,27 @@ const utils_2 = require("../../utils");
|
|
|
14
8
|
* @param includedRelationships
|
|
15
9
|
* @returns
|
|
16
10
|
*/
|
|
17
|
-
const buildEntityRelationshipMetaObj = (relationships) => {
|
|
11
|
+
export const buildEntityRelationshipMetaObj = (relationships) => {
|
|
18
12
|
return Object.values(relationships).reduce((acc, rel) => {
|
|
19
|
-
if (
|
|
13
|
+
if (isBelongsToRelationship(rel)) {
|
|
20
14
|
acc.belongsToRelationships.push(rel);
|
|
21
15
|
}
|
|
22
16
|
acc.relationsLookup[rel.target.name] = rel;
|
|
23
17
|
return acc;
|
|
24
18
|
}, { relationsLookup: {}, belongsToRelationships: [] });
|
|
25
19
|
};
|
|
26
|
-
exports.buildEntityRelationshipMetaObj = buildEntityRelationshipMetaObj;
|
|
27
20
|
/**
|
|
28
21
|
* Extracts a ForeignKey value from an entity instance
|
|
29
22
|
* @param relMeta - RelationshipMetadata for associated foreignKey
|
|
30
23
|
* @param entity - instance of DynaRecord
|
|
31
24
|
* @returns
|
|
32
25
|
*/
|
|
33
|
-
const extractForeignKeyFromEntity = (relMeta, entity) => {
|
|
34
|
-
return
|
|
35
|
-
|
|
26
|
+
export const extractForeignKeyFromEntity = (relMeta, entity) => {
|
|
27
|
+
return isRelationshipMetadataWithForeignKey(relMeta) &&
|
|
28
|
+
isKeyOfObject(entity, relMeta.foreignKey)
|
|
36
29
|
? entity[relMeta.foreignKey]
|
|
37
30
|
: undefined;
|
|
38
31
|
};
|
|
39
|
-
exports.extractForeignKeyFromEntity = extractForeignKeyFromEntity;
|
|
40
32
|
/**
|
|
41
33
|
* Creates the PK and SK (key) for a table item that BelongsTo another as HasMany or HasOne
|
|
42
34
|
* @param entityClass
|
|
@@ -45,17 +37,17 @@ exports.extractForeignKeyFromEntity = extractForeignKeyFromEntity;
|
|
|
45
37
|
* @param foreignKey
|
|
46
38
|
* @returns
|
|
47
39
|
*/
|
|
48
|
-
const buildBelongsToLinkKey = (entityClass, entityId, relMeta, foreignKey) => {
|
|
49
|
-
const tableMeta =
|
|
40
|
+
export const buildBelongsToLinkKey = (entityClass, entityId, relMeta, foreignKey) => {
|
|
41
|
+
const tableMeta = Metadata.getEntityTable(entityClass.name);
|
|
50
42
|
const partitionKeyAlias = tableMeta.partitionKeyAttribute.alias;
|
|
51
43
|
const sortKeyAlias = tableMeta.sortKeyAttribute.alias;
|
|
52
|
-
if (
|
|
44
|
+
if (doesEntityBelongToRelAsHasMany(entityClass, relMeta)) {
|
|
53
45
|
return {
|
|
54
46
|
[partitionKeyAlias]: relMeta.target.partitionKeyValue(foreignKey),
|
|
55
47
|
[sortKeyAlias]: entityClass.partitionKeyValue(entityId)
|
|
56
48
|
};
|
|
57
49
|
}
|
|
58
|
-
if (
|
|
50
|
+
if (doesEntityBelongToRelAsHasOne(entityClass, relMeta)) {
|
|
59
51
|
return {
|
|
60
52
|
[partitionKeyAlias]: relMeta.target.partitionKeyValue(foreignKey),
|
|
61
53
|
[sortKeyAlias]: entityClass.name
|
|
@@ -63,12 +55,10 @@ const buildBelongsToLinkKey = (entityClass, entityId, relMeta, foreignKey) => {
|
|
|
63
55
|
}
|
|
64
56
|
throw new Error("Failed to build BelongsTo key for linked record");
|
|
65
57
|
};
|
|
66
|
-
exports.buildBelongsToLinkKey = buildBelongsToLinkKey;
|
|
67
58
|
/**
|
|
68
59
|
* Consistent read value.
|
|
69
60
|
* @default false
|
|
70
61
|
*/
|
|
71
|
-
const consistentReadVal = (val) => {
|
|
62
|
+
export const consistentReadVal = (val) => {
|
|
72
63
|
return val ?? false;
|
|
73
64
|
};
|
|
74
|
-
exports.consistentReadVal = consistentReadVal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type RelationshipMetadata } from "../metadata";
|
|
2
|
-
import { type OrFilter } from "./types";
|
|
1
|
+
import { type RelationshipMetadata } from "../metadata/index.js";
|
|
2
|
+
import { type OrFilter } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds the filter so that relationships that are included in the query will have their relationships included in the query
|
|
5
5
|
* @param parentClassName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Filters.d.ts","sourceRoot":"","sources":["../../../src/query-utils/Filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Filters.d.ts","sourceRoot":"","sources":["../../../src/query-utils/Filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,qBAAqB,EAAE,oBAAoB,EAAE,GAC5C,QAAQ,CASV"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.includedRelationshipsFilter = includedRelationshipsFilter;
|
|
4
1
|
/**
|
|
5
2
|
* Builds the filter so that relationships that are included in the query will have their relationships included in the query
|
|
6
3
|
* @param parentClassName
|
|
7
4
|
* @param includedRelationships
|
|
8
5
|
* @returns
|
|
9
6
|
*/
|
|
10
|
-
function includedRelationshipsFilter(parentClassName, includedRelationships) {
|
|
7
|
+
export function includedRelationshipsFilter(parentClassName, includedRelationships) {
|
|
11
8
|
const includedTypes = [
|
|
12
9
|
parentClassName,
|
|
13
10
|
...includedRelationships.map(rel => rel.target.name)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import type { QueryCommandProps } from "./types";
|
|
2
|
+
import type { QueryCommandProps } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Constructs and formats a DynamoDB query command based on provided key conditions and query options. This class simplifies the creation of complex DynamoDB queries by abstracting the underlying AWS SDK query command structure, particularly handling the construction of key condition expressions, filter expressions, and expression attribute names and values.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/query-utils/QueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO/D,OAAO,KAAK,EAUV,iBAAiB,EAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"QueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/query-utils/QueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO/D,OAAO,KAAK,EAUV,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAgBpB;;;;GAIG;AACH,cAAM,YAAY;;gBASJ,KAAK,EAAE,iBAAiB;IAmBpC;;;OAGG;IACI,KAAK,IAAI,iBAAiB;IAwBjC;;;;;OAKG;IACH,OAAO,CAAC,8BAA8B;IAgBtC;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAgChC;;;;;;;;;OASG;IACH,OAAO,CAAC,YAAY;IAWpB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IASnB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAejB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAkCpB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IAkCvB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAehB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAUnB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAGnB;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const metadata_1 = __importDefault(require("../metadata"));
|
|
7
|
-
const utils_1 = require("../operations/utils");
|
|
1
|
+
import Metadata from "../metadata/index.js";
|
|
2
|
+
import { consistentReadVal } from "../operations/utils/index.js";
|
|
8
3
|
/**
|
|
9
4
|
* Constructs and formats a DynamoDB query command based on provided key conditions and query options. This class simplifies the creation of complex DynamoDB queries by abstracting the underlying AWS SDK query command structure, particularly handling the construction of key condition expressions, filter expressions, and expression attribute names and values.
|
|
10
5
|
*
|
|
@@ -21,10 +16,10 @@ class QueryBuilder {
|
|
|
21
16
|
constructor(props) {
|
|
22
17
|
this.#props = props;
|
|
23
18
|
this.#attrCounter = 0;
|
|
24
|
-
const entityMetadata =
|
|
25
|
-
this.#tableMetadata =
|
|
26
|
-
const relationshipsAttributesMeta = Object.values(entityMetadata.relationships).map(relMeta =>
|
|
27
|
-
const entityAttrMeta =
|
|
19
|
+
const entityMetadata = Metadata.getEntity(props.entityClassName);
|
|
20
|
+
this.#tableMetadata = Metadata.getTable(entityMetadata.tableClassName);
|
|
21
|
+
const relationshipsAttributesMeta = Object.values(entityMetadata.relationships).map(relMeta => Metadata.getEntityAttributes(relMeta.target.name));
|
|
22
|
+
const entityAttrMeta = Metadata.getEntityAttributes(props.entityClassName);
|
|
28
23
|
const allAttrMeta = [...relationshipsAttributesMeta, entityAttrMeta];
|
|
29
24
|
this.#attributeMetadata = allAttrMeta.reduce((allAttrMeta, attrMeta) => {
|
|
30
25
|
return { ...allAttrMeta, ...attrMeta };
|
|
@@ -47,7 +42,7 @@ class QueryBuilder {
|
|
|
47
42
|
KeyConditionExpression: keyFilter.expression,
|
|
48
43
|
ExpressionAttributeNames: this.expressionAttributeNames(),
|
|
49
44
|
ExpressionAttributeValues: this.expressionAttributeValueParams(keyFilter, filterParams),
|
|
50
|
-
ConsistentRead:
|
|
45
|
+
ConsistentRead: consistentReadVal(this.#props.options?.consistentRead)
|
|
51
46
|
};
|
|
52
47
|
}
|
|
53
48
|
/**
|
|
@@ -273,4 +268,4 @@ class QueryBuilder {
|
|
|
273
268
|
return filter.$or !== undefined;
|
|
274
269
|
}
|
|
275
270
|
}
|
|
276
|
-
|
|
271
|
+
export default QueryBuilder;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as QueryBuilder } from "./QueryBuilder";
|
|
2
|
-
export * from "./types";
|
|
1
|
+
export { default as QueryBuilder } from "./QueryBuilder.js";
|
|
2
|
+
export * from "./types.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/query-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/query-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,cAAc,YAAY,CAAC"}
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.QueryBuilder = void 0;
|
|
21
|
-
var QueryBuilder_1 = require("./QueryBuilder");
|
|
22
|
-
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return __importDefault(QueryBuilder_1).default; } });
|
|
23
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export { default as QueryBuilder } from "./QueryBuilder.js";
|
|
2
|
+
export * from "./types.js";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type DynaRecord from "../DynaRecord";
|
|
2
|
-
import type { ForeignKey, EntityClass } from "../types";
|
|
1
|
+
import type DynaRecord from "../DynaRecord.js";
|
|
2
|
+
import type { ForeignKey, EntityClass } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Exclude the type1 type2 instance keys
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JoinTable.d.ts","sourceRoot":"","sources":["../../../src/relationships/JoinTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"JoinTable.d.ts","sourceRoot":"","sources":["../../../src/relationships/JoinTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAW/C,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAE5E;;GAEG;AACH,KAAK,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;AAOrC;;GAEG;AACH,KAAK,oBAAoB,CAAC,CAAC,IAAI;KAC5B,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,UAAU,GACzD,MAAM,GACN,KAAK;CACV,CAAC;AAYF;;GAEG;AACH,UAAU,gBAAgB;IACxB;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAWD;;;;;;;;;;;;;GAaG;AACH,uBAAe,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU;IAE/D,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EACrB,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAGxC;;;;;;OAMG;WACiB,MAAM,CACxB,SAAS,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACjC,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,UAAU,EAEpB,IAAI,EAAE,KAAK,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,EACrE,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,EACrC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC;IA6BhB;;;;;OAKG;WACiB,MAAM,CACxB,SAAS,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACjC,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,UAAU,EAEpB,IAAI,EAAE,KAAK,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,EACrE,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;mBAWK,QAAQ;IAoD7B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IA8CpC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAcpC;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IA0BzB,OAAO,CAAC,MAAM,CAAC,YAAY;IAoB3B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAoB/B,OAAO,CAAC,MAAM,CAAC,4BAA4B;CA+B5C;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const dynamo_utils_1 = require("../dynamo-utils");
|
|
7
|
-
const TransactWriteBuilder_1 = __importDefault(require("../dynamo-utils/TransactWriteBuilder"));
|
|
8
|
-
const errors_1 = require("../errors");
|
|
9
|
-
const metadata_1 = __importDefault(require("../metadata"));
|
|
1
|
+
import { TransactGetBuilder } from "../dynamo-utils/index.js";
|
|
2
|
+
import TransactionBuilder from "../dynamo-utils/TransactWriteBuilder.js";
|
|
3
|
+
import { NotFoundError } from "../errors.js";
|
|
4
|
+
import Metadata from "../metadata/index.js";
|
|
10
5
|
/**
|
|
11
6
|
* Abstract class representing a join table for HasAndBelongsToMany relationships.
|
|
12
7
|
* This class should be extended for specific join table implementations.
|
|
@@ -37,8 +32,8 @@ class JoinTable {
|
|
|
37
32
|
*/
|
|
38
33
|
static async create(keys, options) {
|
|
39
34
|
const referentialIntegrityCheck = options?.referentialIntegrityCheck ?? true;
|
|
40
|
-
const transactionBuilder = new
|
|
41
|
-
const [rel1, rel2] =
|
|
35
|
+
const transactionBuilder = new TransactionBuilder();
|
|
36
|
+
const [rel1, rel2] = Metadata.getJoinTable(this.name);
|
|
42
37
|
const transactionProps = JoinTable.transactionProps(keys, rel2, rel1);
|
|
43
38
|
const lookupTableItem = await JoinTable.preFetch(transactionProps);
|
|
44
39
|
JoinTable.denormalizeLinkRecord(transactionBuilder, keys, rel1, rel2, lookupTableItem[transactionProps.ids.linkedEntityId], referentialIntegrityCheck);
|
|
@@ -52,8 +47,8 @@ class JoinTable {
|
|
|
52
47
|
* @param keys
|
|
53
48
|
*/
|
|
54
49
|
static async delete(keys) {
|
|
55
|
-
const transactionBuilder = new
|
|
56
|
-
const [rel1, rel2] =
|
|
50
|
+
const transactionBuilder = new TransactionBuilder();
|
|
51
|
+
const [rel1, rel2] = Metadata.getJoinTable(this.name);
|
|
57
52
|
JoinTable.deleteLink(transactionBuilder, keys, rel1, rel2);
|
|
58
53
|
JoinTable.deleteLink(transactionBuilder, keys, rel2, rel1);
|
|
59
54
|
await transactionBuilder.executeTransaction();
|
|
@@ -63,7 +58,7 @@ class JoinTable {
|
|
|
63
58
|
const idAlias = tableProps.defaultAttributes.id.alias;
|
|
64
59
|
const parentKey = JoinTable.buildForeignEntityKey(tableProps, entities.linkedEntity, ids.parentId);
|
|
65
60
|
const linkedKey = JoinTable.buildForeignEntityKey(tableProps, entities.parentEntity, ids.linkedEntityId);
|
|
66
|
-
const transactionGetBuilder = new
|
|
61
|
+
const transactionGetBuilder = new TransactGetBuilder();
|
|
67
62
|
transactionGetBuilder.addGet({
|
|
68
63
|
TableName: tableProps.name,
|
|
69
64
|
Key: parentKey
|
|
@@ -75,7 +70,7 @@ class JoinTable {
|
|
|
75
70
|
const transactionResults = await transactionGetBuilder.executeTransaction();
|
|
76
71
|
if (transactionResults.length !== 2) {
|
|
77
72
|
const errorMessage = this.preFetchNotFoundErrorMessage(transactionResults, entities, ids);
|
|
78
|
-
throw new
|
|
73
|
+
throw new NotFoundError(errorMessage);
|
|
79
74
|
}
|
|
80
75
|
return transactionResults.reduce((acc, res) => {
|
|
81
76
|
if (res.Item !== undefined) {
|
|
@@ -147,7 +142,7 @@ class JoinTable {
|
|
|
147
142
|
const { entity: linkedEntity, foreignKey: linkedKey } = linkedEntityMeta;
|
|
148
143
|
const parentId = keys[parentKey];
|
|
149
144
|
const linkedEntityId = keys[linkedKey];
|
|
150
|
-
const { name: tableName, partitionKeyAttribute } =
|
|
145
|
+
const { name: tableName, partitionKeyAttribute } = Metadata.getEntityTable(parentEntity.name);
|
|
151
146
|
transactionBuilder.addDelete({
|
|
152
147
|
TableName: tableName,
|
|
153
148
|
Key: this.joinTableKey(keys, parentEntityMeta, linkedEntityMeta),
|
|
@@ -167,7 +162,7 @@ class JoinTable {
|
|
|
167
162
|
static transactionProps(keys, parentEntityMeta, linkedEntityMeta) {
|
|
168
163
|
const { entity: parentEntity, foreignKey: parentFK } = parentEntityMeta;
|
|
169
164
|
const { entity: linkedEntity, foreignKey: linkedFK } = linkedEntityMeta;
|
|
170
|
-
const tableMetadata =
|
|
165
|
+
const tableMetadata = Metadata.getEntityTable(parentEntity.name);
|
|
171
166
|
const parentId = keys[parentFK];
|
|
172
167
|
const linkedEntityId = keys[linkedFK];
|
|
173
168
|
return {
|
|
@@ -181,7 +176,7 @@ class JoinTable {
|
|
|
181
176
|
{ entityId: ids.parentId, entityName: entities.linkedEntity.name },
|
|
182
177
|
{ entityId: ids.linkedEntityId, entityName: entities.parentEntity.name }
|
|
183
178
|
];
|
|
184
|
-
const tableMeta =
|
|
179
|
+
const tableMeta = Metadata.getEntityTable(entities.parentEntity.name);
|
|
185
180
|
const idAlias = tableMeta.defaultAttributes.id.alias;
|
|
186
181
|
const foundEntityIds = new Set(transactionResults
|
|
187
182
|
.filter(result => result.Item !== undefined)
|
|
@@ -195,4 +190,4 @@ class JoinTable {
|
|
|
195
190
|
return `Entities not found: ${missingEntityStr}`;
|
|
196
191
|
}
|
|
197
192
|
}
|
|
198
|
-
|
|
193
|
+
export default JoinTable;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as JoinTable } from "./JoinTable";
|
|
1
|
+
export { default as JoinTable } from "./JoinTable.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/relationships/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/relationships/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.JoinTable = void 0;
|
|
7
|
-
var JoinTable_1 = require("./JoinTable");
|
|
8
|
-
Object.defineProperty(exports, "JoinTable", { enumerable: true, get: function () { return __importDefault(JoinTable_1).default; } });
|
|
1
|
+
export { default as JoinTable } from "./JoinTable.js";
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NativeAttributeValue } from "@aws-sdk/util-dynamodb";
|
|
2
|
-
import type { BelongsToRelationship, RelationshipMetadata } from "./metadata";
|
|
3
|
-
import type DynaRecord from "./DynaRecord";
|
|
2
|
+
import type { BelongsToRelationship, RelationshipMetadata } from "./metadata/index.js";
|
|
3
|
+
import type DynaRecord from "./DynaRecord.js";
|
|
4
4
|
/**
|
|
5
5
|
* A utility type for branding primitives to ensure type safety with unique identifiers.
|
|
6
6
|
*/
|