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,5 +1,5 @@
|
|
|
1
|
-
import type { ForeignKeyProperty } from "../../types";
|
|
2
|
-
import RelationshipMetadata from "./RelationshipMetadata";
|
|
1
|
+
import type { ForeignKeyProperty } from "../../types.js";
|
|
2
|
+
import RelationshipMetadata from "./RelationshipMetadata.js";
|
|
3
3
|
/**
|
|
4
4
|
* Extends `RelationshipMetadata` to specifically handle "HasMany" relationship metadata within the ORM system.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HasManyRelationship.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/HasManyRelationship.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"HasManyRelationship.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/HasManyRelationship.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;;GAQG;AACH,cAAM,mBAAoB,SAAQ,oBAAoB;IACpD,IAAI,EAAG,SAAS,CAAU;IAC1B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAS;gBAErB,IAAI,EAAE,oBAAoB;CAIvC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
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
|
-
const RelationshipMetadata_1 = __importDefault(require("./RelationshipMetadata"));
|
|
1
|
+
import RelationshipMetadata from "./RelationshipMetadata.js";
|
|
7
2
|
/**
|
|
8
3
|
* Extends `RelationshipMetadata` to specifically handle "HasMany" relationship metadata within the ORM system.
|
|
9
4
|
*
|
|
@@ -13,7 +8,7 @@ const RelationshipMetadata_1 = __importDefault(require("./RelationshipMetadata")
|
|
|
13
8
|
*
|
|
14
9
|
* @param {RelationshipMetadata} item - An existing set of relationship metadata that should be applied to the newly created `HasManyRelationship` instance. This parameter allows for the inheritance and augmentation of relationship properties.
|
|
15
10
|
*/
|
|
16
|
-
class HasManyRelationship extends
|
|
11
|
+
class HasManyRelationship extends RelationshipMetadata {
|
|
17
12
|
type = "HasMany";
|
|
18
13
|
foreignKey;
|
|
19
14
|
uniDirectional = false;
|
|
@@ -22,4 +17,4 @@ class HasManyRelationship extends RelationshipMetadata_1.default {
|
|
|
22
17
|
Object.assign(this, item);
|
|
23
18
|
}
|
|
24
19
|
}
|
|
25
|
-
|
|
20
|
+
export default HasManyRelationship;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ForeignKeyProperty } from "../../types";
|
|
2
|
-
import RelationshipMetadata from "./RelationshipMetadata";
|
|
1
|
+
import type { ForeignKeyProperty } from "../../types.js";
|
|
2
|
+
import RelationshipMetadata from "./RelationshipMetadata.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents the metadata for a "HasOne" relationship metadata in the ORM system,
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HasOneRelationship.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/HasOneRelationship.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"HasOneRelationship.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/HasOneRelationship.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;GAOG;AACH,cAAM,kBAAmB,SAAQ,oBAAoB;IACnD,IAAI,EAAG,QAAQ,CAAU;IACzB,UAAU,EAAE,kBAAkB,CAAC;gBAEnB,IAAI,EAAE,oBAAoB;CAIvC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
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
|
-
const RelationshipMetadata_1 = __importDefault(require("./RelationshipMetadata"));
|
|
1
|
+
import RelationshipMetadata from "./RelationshipMetadata.js";
|
|
7
2
|
/**
|
|
8
3
|
* Represents the metadata for a "HasOne" relationship metadata in the ORM system,
|
|
9
4
|
*
|
|
@@ -12,7 +7,7 @@ const RelationshipMetadata_1 = __importDefault(require("./RelationshipMetadata")
|
|
|
12
7
|
*
|
|
13
8
|
* @param {RelationshipMetadata} item - An instance of `RelationshipMetadata` containing the initial settings for the relationship. This can include the `foreignKey` and other properties relevant to establishing a "HasOne" relationship.
|
|
14
9
|
*/
|
|
15
|
-
class HasOneRelationship extends
|
|
10
|
+
class HasOneRelationship extends RelationshipMetadata {
|
|
16
11
|
type = "HasOne";
|
|
17
12
|
foreignKey;
|
|
18
13
|
constructor(item) {
|
|
@@ -20,4 +15,4 @@ class HasOneRelationship extends RelationshipMetadata_1.default {
|
|
|
20
15
|
Object.assign(this, item);
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
|
-
|
|
18
|
+
export default HasOneRelationship;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ForeignKeyProperty } from "../../types";
|
|
2
|
-
import RelationshipMetadata from "./RelationshipMetadata";
|
|
1
|
+
import type { ForeignKeyProperty } from "../../types.js";
|
|
2
|
+
import RelationshipMetadata from "./RelationshipMetadata.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents an "Owned By" relationship metadata within the ORM system. These are uni-directional relationships to the parent
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwnedByRelationship.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/OwnedByRelationship.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"OwnedByRelationship.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/OwnedByRelationship.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;;GAQG;AACH,cAAM,mBAAoB,SAAQ,oBAAoB;IACpD,IAAI,EAAG,SAAS,CAAU;IAC1B,UAAU,EAAE,kBAAkB,CAAC;gBAEnB,IAAI,EAAE,oBAAoB;CAIvC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
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
|
-
const RelationshipMetadata_1 = __importDefault(require("./RelationshipMetadata"));
|
|
1
|
+
import RelationshipMetadata from "./RelationshipMetadata.js";
|
|
7
2
|
/**
|
|
8
3
|
* Represents an "Owned By" relationship metadata within the ORM system. These are uni-directional relationships to the parent
|
|
9
4
|
*
|
|
@@ -13,7 +8,7 @@ const RelationshipMetadata_1 = __importDefault(require("./RelationshipMetadata")
|
|
|
13
8
|
*
|
|
14
9
|
* @param {RelationshipMetadata} item - The initial relationship metadata to be copied into this "Owned By" relationship instance. This facilitates the creation and setup of relationship metadata based on existing configurations.
|
|
15
10
|
*/
|
|
16
|
-
class OwnedByRelationship extends
|
|
11
|
+
class OwnedByRelationship extends RelationshipMetadata {
|
|
17
12
|
type = "OwnedBy";
|
|
18
13
|
foreignKey;
|
|
19
14
|
constructor(item) {
|
|
@@ -21,4 +16,4 @@ class OwnedByRelationship extends RelationshipMetadata_1.default {
|
|
|
21
16
|
Object.assign(this, item);
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
|
-
|
|
19
|
+
export default OwnedByRelationship;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import type { EntityClass } from "../../types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import type { EntityClass } from "../../types.js";
|
|
3
3
|
type RelationshipType = "HasMany" | "BelongsTo" | "HasOne" | "HasAndBelongsToMany" | "OwnedBy";
|
|
4
4
|
/**
|
|
5
5
|
* Serves as the base class for defining metadata related to various types of relationships within the ORM system, such as "HasMany", "BelongsTo", "HasOne", and "HasAndBelongsToMany". This abstract class provides a common structure for relationship metadata, encapsulating the relationship type, target entity, and property name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipMetadata.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/RelationshipMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"RelationshipMetadata.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/RelationshipMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,KAAK,gBAAgB,GACjB,SAAS,GACT,WAAW,GACX,QAAQ,GACR,qBAAqB,GACrB,SAAS,CAAC;AAEd;;;;;;;;;;GAUG;AACH,uBAAe,oBAAoB;IACjC,SAAgB,IAAI,EAAE,gBAAgB,CAAC;IAChC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAChC,YAAY,EAAE,MAAM,UAAU,CAAC;CACvC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* Serves as the base class for defining metadata related to various types of relationships within the ORM system, such as "HasMany", "BelongsTo", "HasOne", and "HasAndBelongsToMany". This abstract class provides a common structure for relationship metadata, encapsulating the relationship type, target entity, and property name.
|
|
5
3
|
*
|
|
@@ -15,4 +13,4 @@ class RelationshipMetadata {
|
|
|
15
13
|
target;
|
|
16
14
|
propertyName;
|
|
17
15
|
}
|
|
18
|
-
|
|
16
|
+
export default RelationshipMetadata;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import BelongsToRelationship from "./BelongsToRelationship";
|
|
2
|
-
import HasAndBelongsToManyRelationship from "./HasAndBelongsToManyRelationship";
|
|
3
|
-
import HasManyRelationship from "./HasManyRelationship";
|
|
4
|
-
import HasOneRelationship from "./HasOneRelationship";
|
|
5
|
-
import OwnedByRelationship from "./OwnedByRelationship";
|
|
6
|
-
export * from "./types";
|
|
1
|
+
import BelongsToRelationship from "./BelongsToRelationship.js";
|
|
2
|
+
import HasAndBelongsToManyRelationship from "./HasAndBelongsToManyRelationship.js";
|
|
3
|
+
import HasManyRelationship from "./HasManyRelationship.js";
|
|
4
|
+
import HasOneRelationship from "./HasOneRelationship.js";
|
|
5
|
+
import OwnedByRelationship from "./OwnedByRelationship.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
7
|
export { BelongsToRelationship, HasAndBelongsToManyRelationship, HasManyRelationship, HasOneRelationship, OwnedByRelationship };
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,+BAA+B,MAAM,sCAAsC,CAAC;AACnF,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,cAAc,YAAY,CAAC;AAE3B,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACpB,CAAC"}
|
|
@@ -1,31 +1,7 @@
|
|
|
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
|
-
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.OwnedByRelationship = exports.HasOneRelationship = exports.HasManyRelationship = exports.HasAndBelongsToManyRelationship = exports.BelongsToRelationship = void 0;
|
|
21
|
-
const BelongsToRelationship_1 = __importDefault(require("./BelongsToRelationship"));
|
|
22
|
-
exports.BelongsToRelationship = BelongsToRelationship_1.default;
|
|
23
|
-
const HasAndBelongsToManyRelationship_1 = __importDefault(require("./HasAndBelongsToManyRelationship"));
|
|
24
|
-
exports.HasAndBelongsToManyRelationship = HasAndBelongsToManyRelationship_1.default;
|
|
25
|
-
const HasManyRelationship_1 = __importDefault(require("./HasManyRelationship"));
|
|
26
|
-
exports.HasManyRelationship = HasManyRelationship_1.default;
|
|
27
|
-
const HasOneRelationship_1 = __importDefault(require("./HasOneRelationship"));
|
|
28
|
-
exports.HasOneRelationship = HasOneRelationship_1.default;
|
|
29
|
-
const OwnedByRelationship_1 = __importDefault(require("./OwnedByRelationship"));
|
|
30
|
-
exports.OwnedByRelationship = OwnedByRelationship_1.default;
|
|
31
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import BelongsToRelationship from "./BelongsToRelationship.js";
|
|
2
|
+
import HasAndBelongsToManyRelationship from "./HasAndBelongsToManyRelationship.js";
|
|
3
|
+
import HasManyRelationship from "./HasManyRelationship.js";
|
|
4
|
+
import HasOneRelationship from "./HasOneRelationship.js";
|
|
5
|
+
import OwnedByRelationship from "./OwnedByRelationship.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
export { BelongsToRelationship, HasAndBelongsToManyRelationship, HasManyRelationship, HasOneRelationship, OwnedByRelationship };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type BelongsToRelationship from "./BelongsToRelationship";
|
|
2
|
-
import type HasAndBelongsToManyRelationship from "./HasAndBelongsToManyRelationship";
|
|
3
|
-
import type HasManyRelationship from "./HasManyRelationship";
|
|
4
|
-
import type HasOneRelationship from "./HasOneRelationship";
|
|
5
|
-
import type OwnedByRelationship from "./OwnedByRelationship";
|
|
1
|
+
import type BelongsToRelationship from "./BelongsToRelationship.js";
|
|
2
|
+
import type HasAndBelongsToManyRelationship from "./HasAndBelongsToManyRelationship.js";
|
|
3
|
+
import type HasManyRelationship from "./HasManyRelationship.js";
|
|
4
|
+
import type HasOneRelationship from "./HasOneRelationship.js";
|
|
5
|
+
import type OwnedByRelationship from "./OwnedByRelationship.js";
|
|
6
6
|
/**
|
|
7
7
|
* A union type that encompasses all possible relationship metadata classes within the ORM system. This type is used to represent the metadata for various types of relationships that can exist between entities, such as "BelongsTo", "HasMany", "HasOne", and "HasAndBelongsToMany" relationships.
|
|
8
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,+BAA+B,MAAM,sCAAsC,CAAC;AACxF,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAEhE;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,GAC5B,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,GAClB,+BAA+B,GAC/B,mBAAmB,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAClC,mBAAmB,GAAG,kBAAkB,GAAG,+BAA+B,CAC3E,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/metadata/relationship-metadata/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,0BAA0B,GACrC,SAAS,oBAAoB,KAC5B,oBAeF,CAAC"}
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const BelongsToRelationship_1 = __importDefault(require("./BelongsToRelationship"));
|
|
8
|
-
const HasAndBelongsToManyRelationship_1 = __importDefault(require("./HasAndBelongsToManyRelationship"));
|
|
9
|
-
const HasManyRelationship_1 = __importDefault(require("./HasManyRelationship"));
|
|
10
|
-
const HasOneRelationship_1 = __importDefault(require("./HasOneRelationship"));
|
|
11
|
-
const OwnedByRelationship_1 = __importDefault(require("./OwnedByRelationship"));
|
|
12
|
-
const createRelationshipInstance = (options) => {
|
|
1
|
+
import BelongsToRelationship from "./BelongsToRelationship.js";
|
|
2
|
+
import HasAndBelongsToManyRelationship from "./HasAndBelongsToManyRelationship.js";
|
|
3
|
+
import HasManyRelationship from "./HasManyRelationship.js";
|
|
4
|
+
import HasOneRelationship from "./HasOneRelationship.js";
|
|
5
|
+
import OwnedByRelationship from "./OwnedByRelationship.js";
|
|
6
|
+
export const createRelationshipInstance = (options) => {
|
|
13
7
|
switch (options.type) {
|
|
14
8
|
case "BelongsTo":
|
|
15
|
-
return new
|
|
9
|
+
return new BelongsToRelationship(options);
|
|
16
10
|
case "HasAndBelongsToMany":
|
|
17
|
-
return new
|
|
11
|
+
return new HasAndBelongsToManyRelationship(options);
|
|
18
12
|
case "HasMany":
|
|
19
|
-
return new
|
|
13
|
+
return new HasManyRelationship(options);
|
|
20
14
|
case "HasOne":
|
|
21
|
-
return new
|
|
15
|
+
return new HasOneRelationship(options);
|
|
22
16
|
case "OwnedBy":
|
|
23
|
-
return new
|
|
17
|
+
return new OwnedByRelationship(options);
|
|
24
18
|
default:
|
|
25
19
|
throw new Error("Invalid relationship type");
|
|
26
20
|
}
|
|
27
21
|
};
|
|
28
|
-
exports.createRelationshipInstance = createRelationshipInstance;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { EntityClass } from "../types";
|
|
3
|
-
import type DynaRecord from "../DynaRecord";
|
|
4
|
-
import type { ObjectSchema } from "../decorators/attributes/types";
|
|
2
|
+
import type { EntityClass } from "../types.js";
|
|
3
|
+
import type DynaRecord from "../DynaRecord.js";
|
|
4
|
+
import type { ObjectSchema } from "../decorators/attributes/types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Zod schema that transforms table metadata to a serializable format.
|
|
7
7
|
* This is the main schema used to serialize {@link TableMetadata} instances,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/metadata/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/metadata/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AA6HtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQjC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TableMetadataTransform = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
1
|
+
import { z } from "zod";
|
|
5
2
|
/**
|
|
6
3
|
* Common serialized fields shared by every attribute kind.
|
|
7
4
|
*/
|
|
8
5
|
const baseAttributeShape = {
|
|
9
|
-
name:
|
|
10
|
-
alias:
|
|
11
|
-
nullable:
|
|
6
|
+
name: z.string(),
|
|
7
|
+
alias: z.string(),
|
|
8
|
+
nullable: z.boolean()
|
|
12
9
|
};
|
|
13
|
-
const simpleAttributeShape = (kind) =>
|
|
10
|
+
const simpleAttributeShape = (kind) => z.object({ ...baseAttributeShape, kind: z.literal(kind) });
|
|
14
11
|
/**
|
|
15
12
|
* Zod schema that transforms attribute metadata to a serializable format.
|
|
16
13
|
*
|
|
@@ -23,36 +20,36 @@ const simpleAttributeShape = (kind) => zod_1.z.object({ ...baseAttributeShape, k
|
|
|
23
20
|
*
|
|
24
21
|
* Non-serializable internals (Zod types, serializers, partial types) are dropped.
|
|
25
22
|
*/
|
|
26
|
-
const AttributeMetadataTransform =
|
|
23
|
+
const AttributeMetadataTransform = z.discriminatedUnion("kind", [
|
|
27
24
|
simpleAttributeShape("string"),
|
|
28
25
|
simpleAttributeShape("number"),
|
|
29
26
|
simpleAttributeShape("boolean"),
|
|
30
27
|
simpleAttributeShape("date"),
|
|
31
|
-
|
|
28
|
+
z
|
|
32
29
|
.object({
|
|
33
30
|
...baseAttributeShape,
|
|
34
|
-
kind:
|
|
35
|
-
enumValues:
|
|
31
|
+
kind: z.literal("enum"),
|
|
32
|
+
enumValues: z.array(z.string()).nonempty()
|
|
36
33
|
})
|
|
37
34
|
.transform(({ enumValues, ...rest }) => ({
|
|
38
35
|
...rest,
|
|
39
36
|
values: enumValues
|
|
40
37
|
})),
|
|
41
|
-
|
|
38
|
+
z
|
|
42
39
|
.object({
|
|
43
40
|
...baseAttributeShape,
|
|
44
|
-
kind:
|
|
45
|
-
objectSchema:
|
|
41
|
+
kind: z.literal("object"),
|
|
42
|
+
objectSchema: z.custom()
|
|
46
43
|
})
|
|
47
44
|
.transform(({ objectSchema, ...rest }) => ({
|
|
48
45
|
...rest,
|
|
49
46
|
schema: objectSchema
|
|
50
47
|
})),
|
|
51
|
-
|
|
48
|
+
z
|
|
52
49
|
.object({
|
|
53
50
|
...baseAttributeShape,
|
|
54
|
-
kind:
|
|
55
|
-
foreignKeyTarget:
|
|
51
|
+
kind: z.literal("foreignKey"),
|
|
52
|
+
foreignKeyTarget: z.custom()
|
|
56
53
|
})
|
|
57
54
|
.transform(({ foreignKeyTarget, ...rest }) => ({
|
|
58
55
|
...rest,
|
|
@@ -72,14 +69,14 @@ const AttributeMetadataTransform = zod_1.z.discriminatedUnion("kind", [
|
|
|
72
69
|
*
|
|
73
70
|
* @returns A serialized relationship metadata object with EntityClass references converted to strings
|
|
74
71
|
*/
|
|
75
|
-
const RelationshipMetadataTransform =
|
|
72
|
+
const RelationshipMetadataTransform = z
|
|
76
73
|
.object({
|
|
77
|
-
type:
|
|
78
|
-
propertyName:
|
|
79
|
-
target:
|
|
80
|
-
foreignKey:
|
|
81
|
-
joinTableName:
|
|
82
|
-
uniDirectional:
|
|
74
|
+
type: z.string(),
|
|
75
|
+
propertyName: z.string(),
|
|
76
|
+
target: z.custom().optional(),
|
|
77
|
+
foreignKey: z.string().optional(),
|
|
78
|
+
joinTableName: z.string().optional(),
|
|
79
|
+
uniDirectional: z.boolean().optional()
|
|
83
80
|
})
|
|
84
81
|
.transform(rel => ({
|
|
85
82
|
type: rel.type,
|
|
@@ -103,13 +100,13 @@ const RelationshipMetadataTransform = zod_1.z
|
|
|
103
100
|
*
|
|
104
101
|
* @returns A serialized entity metadata object with all nested metadata transformed
|
|
105
102
|
*/
|
|
106
|
-
const EntityMetadataTransform =
|
|
103
|
+
const EntityMetadataTransform = z
|
|
107
104
|
.object({
|
|
108
|
-
tableClassName:
|
|
109
|
-
attributes:
|
|
110
|
-
tableAttributes:
|
|
111
|
-
relationships:
|
|
112
|
-
idField:
|
|
105
|
+
tableClassName: z.string(),
|
|
106
|
+
attributes: z.record(z.string(), AttributeMetadataTransform),
|
|
107
|
+
tableAttributes: z.record(z.string(), AttributeMetadataTransform),
|
|
108
|
+
relationships: z.record(z.string(), RelationshipMetadataTransform),
|
|
109
|
+
idField: z.string().optional()
|
|
113
110
|
})
|
|
114
111
|
.transform(entity => ({
|
|
115
112
|
tableClassName: entity.tableClassName,
|
|
@@ -140,12 +137,12 @@ const EntityMetadataTransform = zod_1.z
|
|
|
140
137
|
* // Returns a plain object with all EntityClass references converted to strings
|
|
141
138
|
* ```
|
|
142
139
|
*/
|
|
143
|
-
|
|
144
|
-
name:
|
|
145
|
-
delimiter:
|
|
146
|
-
defaultAttributes:
|
|
147
|
-
defaultTableAttributes:
|
|
140
|
+
export const TableMetadataTransform = z.object({
|
|
141
|
+
name: z.string(),
|
|
142
|
+
delimiter: z.string(),
|
|
143
|
+
defaultAttributes: z.record(z.string(), AttributeMetadataTransform),
|
|
144
|
+
defaultTableAttributes: z.record(z.string(), AttributeMetadataTransform),
|
|
148
145
|
partitionKeyAttribute: AttributeMetadataTransform,
|
|
149
146
|
sortKeyAttribute: AttributeMetadataTransform,
|
|
150
|
-
entities:
|
|
147
|
+
entities: z.record(z.string(), EntityMetadataTransform)
|
|
151
148
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { NativeAttributeValue } from "@aws-sdk/util-dynamodb";
|
|
2
|
-
import type { AttributeMetadata, BelongsToRelationship, EntityMetadata, JoinTableMetadata, OwnedByRelationship, RelationshipMetadata, TableMetadata } from ".";
|
|
3
|
-
import type DynaRecord from "../DynaRecord";
|
|
4
|
-
import type { EntityClass, MakeOptional } from "../types";
|
|
2
|
+
import type { AttributeMetadata, BelongsToRelationship, EntityMetadata, JoinTableMetadata, OwnedByRelationship, RelationshipMetadata, TableMetadata } from "./index.js";
|
|
3
|
+
import type DynaRecord from "../DynaRecord.js";
|
|
4
|
+
import type { EntityClass, MakeOptional } from "../types.js";
|
|
5
5
|
import type { ZodType } from "zod";
|
|
6
|
-
import type { ObjectSchema } from "../decorators/attributes/types";
|
|
6
|
+
import type { ObjectSchema } from "../decorators/attributes/types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Represents relationship metadata that includes a foreign key reference to another entity.
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/metadata/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/metadata/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { RelationshipMetadata, HasManyRelationship, BelongsToRelationship, HasOneRelationship, HasAndBelongsToManyRelationship, OwnedByRelationship, ForeignKeyAttributeMetadata } from ".";
|
|
2
|
-
import type DynaRecord from "../DynaRecord";
|
|
3
|
-
import type { BelongsToOrOwnedByRelationship, RelationshipMetadataWithForeignKey } from "./types";
|
|
4
|
-
import type { EntityClass } from "../types";
|
|
5
|
-
import type AttributeMetadata from "./AttributeMetadata";
|
|
1
|
+
import type { RelationshipMetadata, HasManyRelationship, BelongsToRelationship, HasOneRelationship, HasAndBelongsToManyRelationship, OwnedByRelationship, ForeignKeyAttributeMetadata } from "./index.js";
|
|
2
|
+
import type DynaRecord from "../DynaRecord.js";
|
|
3
|
+
import type { BelongsToOrOwnedByRelationship, RelationshipMetadataWithForeignKey } from "./types.js";
|
|
4
|
+
import type { EntityClass } from "../types.js";
|
|
5
|
+
import type AttributeMetadata from "./AttributeMetadata.js";
|
|
6
6
|
/**
|
|
7
7
|
* Type guard to check if the relationship is a HasMany
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/metadata/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,+BAA+B,EAC/B,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/metadata/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,+BAA+B,EAC/B,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EACV,8BAA8B,EAC9B,kCAAkC,EACnC,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,KAAK,oBAAoB,KACxB,GAAG,IAAI,mBAET,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,KAAK,oBAAoB,KACxB,GAAG,IAAI,qBAET,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,KAAK,oBAAoB,KACxB,GAAG,IAAI,kBAET,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,GAC5C,KAAK,oBAAoB,KACxB,GAAG,IAAI,+BAET,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,KAAK,oBAAoB,KACxB,GAAG,IAAI,mBAET,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,GAC/C,KAAK,oBAAoB,KACxB,GAAG,IAAI,kCAET,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GACxC,MAAM,iBAAiB,KACtB,IAAI,IAAI,2BAEV,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,CAAC,SAAS,UAAU,EAChE,QAAQ,WAAW,CAAC,CAAC,CAAC,EACtB,KAAK,8BAA8B,KAClC,OAMF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GAAI,CAAC,SAAS,UAAU,EACjE,QAAQ,WAAW,CAAC,CAAC,CAAC,EACtB,KAAK,8BAA8B,KAClC,OAMF,CAAC"}
|
|
@@ -1,73 +1,59 @@
|
|
|
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.doesEntityBelongToRelAsHasMany = exports.doesEntityBelongToRelAsHasOne = exports.isForeignKeyAttributeMetadata = exports.isRelationshipMetadataWithForeignKey = exports.isOwnedByRelationship = exports.isHasAndBelongsToManyRelationship = exports.isHasOneRelationship = exports.isBelongsToRelationship = exports.isHasManyRelationship = void 0;
|
|
7
|
-
const _1 = __importDefault(require("./"));
|
|
1
|
+
import Metadata from "./index.js";
|
|
8
2
|
/**
|
|
9
3
|
* Type guard to check if the relationship is a HasMany
|
|
10
4
|
*/
|
|
11
|
-
const isHasManyRelationship = (rel) => {
|
|
5
|
+
export const isHasManyRelationship = (rel) => {
|
|
12
6
|
return rel.type === "HasMany" && "foreignKey" in rel;
|
|
13
7
|
};
|
|
14
|
-
exports.isHasManyRelationship = isHasManyRelationship;
|
|
15
8
|
/**
|
|
16
9
|
* Type guard to check if the relationship is a BelongsTo
|
|
17
10
|
*/
|
|
18
|
-
const isBelongsToRelationship = (rel) => {
|
|
11
|
+
export const isBelongsToRelationship = (rel) => {
|
|
19
12
|
return rel.type === "BelongsTo" && "foreignKey" in rel;
|
|
20
13
|
};
|
|
21
|
-
exports.isBelongsToRelationship = isBelongsToRelationship;
|
|
22
14
|
/**
|
|
23
15
|
* Type guard to check if the relationship is a HasOne
|
|
24
16
|
*/
|
|
25
|
-
const isHasOneRelationship = (rel) => {
|
|
17
|
+
export const isHasOneRelationship = (rel) => {
|
|
26
18
|
return rel.type === "HasOne" && "foreignKey" in rel;
|
|
27
19
|
};
|
|
28
|
-
exports.isHasOneRelationship = isHasOneRelationship;
|
|
29
20
|
/**
|
|
30
21
|
* Type guard to check if the relationship is a HasOne
|
|
31
22
|
*/
|
|
32
|
-
const isHasAndBelongsToManyRelationship = (rel) => {
|
|
23
|
+
export const isHasAndBelongsToManyRelationship = (rel) => {
|
|
33
24
|
return rel.type === "HasAndBelongsToMany" && "joinTableName" in rel;
|
|
34
25
|
};
|
|
35
|
-
exports.isHasAndBelongsToManyRelationship = isHasAndBelongsToManyRelationship;
|
|
36
26
|
/**
|
|
37
27
|
* Type guard to check if the relationship is of type OwnedBy
|
|
38
28
|
*/
|
|
39
|
-
const isOwnedByRelationship = (rel) => {
|
|
29
|
+
export const isOwnedByRelationship = (rel) => {
|
|
40
30
|
return rel.type === "OwnedBy";
|
|
41
31
|
};
|
|
42
|
-
exports.isOwnedByRelationship = isOwnedByRelationship;
|
|
43
32
|
/**
|
|
44
33
|
* Type guard to check if the relationship metadata includes a foreignKey
|
|
45
34
|
* @param rel
|
|
46
35
|
* @returns
|
|
47
36
|
*/
|
|
48
|
-
const isRelationshipMetadataWithForeignKey = (rel) => {
|
|
37
|
+
export const isRelationshipMetadataWithForeignKey = (rel) => {
|
|
49
38
|
return "foreignKey" in rel;
|
|
50
39
|
};
|
|
51
|
-
exports.isRelationshipMetadataWithForeignKey = isRelationshipMetadataWithForeignKey;
|
|
52
40
|
/**
|
|
53
41
|
* Type guard that checks whether attribute metadata represents a foreign key.
|
|
54
42
|
* Returns {@link ForeignKeyAttributeMetadata} with a guaranteed target entity.
|
|
55
43
|
*/
|
|
56
|
-
const isForeignKeyAttributeMetadata = (attr) => {
|
|
44
|
+
export const isForeignKeyAttributeMetadata = (attr) => {
|
|
57
45
|
return attr.foreignKeyTarget !== undefined;
|
|
58
46
|
};
|
|
59
|
-
exports.isForeignKeyAttributeMetadata = isForeignKeyAttributeMetadata;
|
|
60
47
|
/**
|
|
61
48
|
* Returns true if an "Entity" BelongsTo the provided relationship as a HasOne
|
|
62
49
|
* @param Entity
|
|
63
50
|
* @param rel
|
|
64
51
|
* @returns
|
|
65
52
|
*/
|
|
66
|
-
const doesEntityBelongToRelAsHasOne = (Entity, rel) => {
|
|
67
|
-
const relMetadata =
|
|
68
|
-
return Object.values(relMetadata.relationships).some(rel =>
|
|
53
|
+
export const doesEntityBelongToRelAsHasOne = (Entity, rel) => {
|
|
54
|
+
const relMetadata = Metadata.getEntity(rel.target.name);
|
|
55
|
+
return Object.values(relMetadata.relationships).some(rel => isHasOneRelationship(rel) && rel.target === Entity);
|
|
69
56
|
};
|
|
70
|
-
exports.doesEntityBelongToRelAsHasOne = doesEntityBelongToRelAsHasOne;
|
|
71
57
|
/**
|
|
72
58
|
* Returns true if an "Entity" BelongsTo the provided relationship as a HasMany
|
|
73
59
|
* @param Entity
|
|
@@ -75,8 +61,7 @@ exports.doesEntityBelongToRelAsHasOne = doesEntityBelongToRelAsHasOne;
|
|
|
75
61
|
* @param foreignKey
|
|
76
62
|
* @returns
|
|
77
63
|
*/
|
|
78
|
-
const doesEntityBelongToRelAsHasMany = (Entity, rel) => {
|
|
79
|
-
const relMetadata =
|
|
80
|
-
return Object.values(relMetadata.relationships).some(rel =>
|
|
64
|
+
export const doesEntityBelongToRelAsHasMany = (Entity, rel) => {
|
|
65
|
+
const relMetadata = Metadata.getEntity(rel.target.name);
|
|
66
|
+
return Object.values(relMetadata.relationships).some(rel => isHasManyRelationship(rel) && rel.target === Entity);
|
|
81
67
|
};
|
|
82
|
-
exports.doesEntityBelongToRelAsHasMany = doesEntityBelongToRelAsHasMany;
|