dyna-record 0.6.7 → 0.7.0
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 +4 -4
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/IdAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"IdAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/IdAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,iBAAS,WAAW,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,MAAM,EACzD,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,IAExB,MAAM,CAAC,EAAE,OAAO,CAAC,OAInC;AAED,eAAe,WAAW,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 metadata_1 = __importDefault(require("../../metadata"));
|
|
1
|
+
import Metadata from "../../metadata/index.js";
|
|
7
2
|
/**
|
|
8
3
|
* An optional decorator for marking class fields as the primary identifier (ID) within the context of a single-table design entity.
|
|
9
4
|
*
|
|
@@ -34,8 +29,8 @@ const metadata_1 = __importDefault(require("../../metadata"));
|
|
|
34
29
|
*/
|
|
35
30
|
function IdAttribute(_value, context) {
|
|
36
31
|
return function (value) {
|
|
37
|
-
|
|
32
|
+
Metadata.addEntityIdField(this.constructor.name, context.name.toString());
|
|
38
33
|
return value;
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
|
-
|
|
36
|
+
export default IdAttribute;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import type { AttributeDecoratorContext, AttributeOptions } from "../types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import type { AttributeDecoratorContext, AttributeOptions } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* A decorator for marking class fields as number attributes within the context of a single-table design entity
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/NumberAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"NumberAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/NumberAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,IAEP,QAAQ,SAAS,EACjB,SAAS,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,UAY9C;AAED,eAAe,eAAe,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 zod_1 = require("zod");
|
|
7
|
-
const metadata_1 = __importDefault(require("../../metadata"));
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import Metadata from "../../metadata/index.js";
|
|
8
3
|
/**
|
|
9
4
|
* A decorator for marking class fields as number attributes within the context of a single-table design entity
|
|
10
5
|
*
|
|
@@ -31,14 +26,14 @@ const metadata_1 = __importDefault(require("../../metadata"));
|
|
|
31
26
|
function NumberAttribute(props) {
|
|
32
27
|
return function (_value, context) {
|
|
33
28
|
context.addInitializer(function () {
|
|
34
|
-
|
|
29
|
+
Metadata.addEntityAttribute(this.constructor.name, {
|
|
35
30
|
attributeName: context.name.toString(),
|
|
36
31
|
kind: "number",
|
|
37
32
|
nullable: props?.nullable,
|
|
38
|
-
type:
|
|
33
|
+
type: z.number(),
|
|
39
34
|
...props
|
|
40
35
|
});
|
|
41
36
|
});
|
|
42
37
|
};
|
|
43
38
|
}
|
|
44
|
-
|
|
39
|
+
export default NumberAttribute;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import type { AttributeDecoratorContext, NonNullAttributeOptions } from "../types";
|
|
3
|
-
import type { ObjectSchema, InferObjectSchema } from "./types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import type { AttributeDecoratorContext, NonNullAttributeOptions } from "../types.js";
|
|
3
|
+
import type { ObjectSchema, InferObjectSchema } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Options for the `@ObjectAttribute` decorator.
|
|
6
6
|
* Extends {@link NonNullAttributeOptions} with a required `schema` field describing the object shape.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/ObjectAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"ObjectAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/ObjectAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EAGlB,MAAM,YAAY,CAAC;AAGpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,YAAY,CAC5D,SAAQ,uBAAuB;IAC/B;;;;OAIG;IACH,MAAM,EAAE,CAAC,CAAC;CACX;AAkKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,iBAAS,eAAe,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,CAAC,CAAC,SAAS,YAAY,EACzE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,IAG9B,QAAQ,SAAS,EACjB,SAAS,yBAAyB,CAChC,CAAC,EACD,iBAAiB,CAAC,CAAC,CAAC,EACpB,sBAAsB,CAAC,CAAC,CAAC,CAC1B,UAqBJ;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const zod_1 = require("zod");
|
|
7
|
-
const metadata_1 = __importDefault(require("../../metadata"));
|
|
8
|
-
const serializers_1 = require("./serializers");
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import Metadata from "../../metadata/index.js";
|
|
3
|
+
import { createObjectSerializer } from "./serializers.js";
|
|
9
4
|
/**
|
|
10
5
|
* Builds a Zod shape record from an {@link ObjectSchema} using the provided
|
|
11
6
|
* field converter function. Shared by both full and partial schema builders.
|
|
@@ -28,7 +23,7 @@ function buildZodShape(schema, fieldConverter) {
|
|
|
28
23
|
* @returns A ZodType that validates partial objects matching the schema
|
|
29
24
|
*/
|
|
30
25
|
function objectSchemaToZodPartial(schema) {
|
|
31
|
-
return
|
|
26
|
+
return z.object(buildZodShape(schema, fieldDefToZodPartial)).partial();
|
|
32
27
|
}
|
|
33
28
|
/**
|
|
34
29
|
* Converts a single {@link FieldDef} to the corresponding partial Zod type.
|
|
@@ -56,7 +51,7 @@ function fieldDefToZodPartial(fieldDef) {
|
|
|
56
51
|
* @returns A ZodType that validates objects matching the schema
|
|
57
52
|
*/
|
|
58
53
|
function objectSchemaToZod(schema) {
|
|
59
|
-
return
|
|
54
|
+
return z.object(buildZodShape(schema, fieldDefToZod));
|
|
60
55
|
}
|
|
61
56
|
/**
|
|
62
57
|
* Builds a Zod `discriminatedUnion` schema from a {@link DiscriminatedUnionFieldDef}.
|
|
@@ -76,10 +71,10 @@ function discriminatedUnionToZod(fieldDef) {
|
|
|
76
71
|
const variantSchemas = variantEntries.map(([variantKey, variantObjectSchema]) => {
|
|
77
72
|
const variantZod = objectSchemaToZod(variantObjectSchema);
|
|
78
73
|
return variantZod.extend({
|
|
79
|
-
[fieldDef.discriminator]:
|
|
74
|
+
[fieldDef.discriminator]: z.literal(variantKey)
|
|
80
75
|
});
|
|
81
76
|
});
|
|
82
|
-
let zodType =
|
|
77
|
+
let zodType = z.discriminatedUnion(fieldDef.discriminator, variantSchemas);
|
|
83
78
|
if (fieldDef.nullable === true) {
|
|
84
79
|
zodType = zodType.optional().nullable();
|
|
85
80
|
}
|
|
@@ -114,22 +109,22 @@ function fieldDefToZod(fieldDef) {
|
|
|
114
109
|
let zodType;
|
|
115
110
|
switch (fieldDef.type) {
|
|
116
111
|
case "array":
|
|
117
|
-
zodType =
|
|
112
|
+
zodType = z.array(fieldDefToZod(fieldDef.items));
|
|
118
113
|
break;
|
|
119
114
|
case "string":
|
|
120
|
-
zodType =
|
|
115
|
+
zodType = z.string();
|
|
121
116
|
break;
|
|
122
117
|
case "number":
|
|
123
|
-
zodType =
|
|
118
|
+
zodType = z.number();
|
|
124
119
|
break;
|
|
125
120
|
case "boolean":
|
|
126
|
-
zodType =
|
|
121
|
+
zodType = z.boolean();
|
|
127
122
|
break;
|
|
128
123
|
case "date":
|
|
129
|
-
zodType =
|
|
124
|
+
zodType = z.date();
|
|
130
125
|
break;
|
|
131
126
|
case "enum":
|
|
132
|
-
zodType =
|
|
127
|
+
zodType = z.enum(fieldDef.values);
|
|
133
128
|
break;
|
|
134
129
|
default: {
|
|
135
130
|
const _exhaustiveCheck = fieldDef;
|
|
@@ -238,9 +233,9 @@ function ObjectAttribute(props) {
|
|
|
238
233
|
const { schema, ...restProps } = props;
|
|
239
234
|
const zodSchema = objectSchemaToZod(schema);
|
|
240
235
|
const partialZodSchema = objectSchemaToZodPartial(schema);
|
|
241
|
-
const serializers =
|
|
236
|
+
const serializers = createObjectSerializer(schema);
|
|
242
237
|
context.addInitializer(function () {
|
|
243
|
-
|
|
238
|
+
Metadata.addEntityAttribute(this.constructor.name, {
|
|
244
239
|
attributeName: context.name.toString(),
|
|
245
240
|
kind: "object",
|
|
246
241
|
type: zodSchema,
|
|
@@ -253,4 +248,4 @@ function ObjectAttribute(props) {
|
|
|
253
248
|
});
|
|
254
249
|
};
|
|
255
250
|
}
|
|
256
|
-
|
|
251
|
+
export default ObjectAttribute;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import { type PartitionKey } from "../../types";
|
|
3
|
-
import type { NonNullAttributeOptions } from "../types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import { type PartitionKey } from "../../types.js";
|
|
3
|
+
import type { NonNullAttributeOptions } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* A decorator for designating the field for the partition key on the dynamo table.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/PartitionKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"PartitionKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/PartitionKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,qBAAqB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,YAAY,EACzE,KAAK,CAAC,EAAE,uBAAuB,IAG7B,QAAQ,SAAS,EACjB,SAAS,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,UAW5C;AAED,eAAe,qBAAqB,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 zod_1 = require("zod");
|
|
7
|
-
const metadata_1 = __importDefault(require("../../metadata"));
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import Metadata from "../../metadata/index.js";
|
|
8
3
|
/**
|
|
9
4
|
* A decorator for designating the field for the partition key on the dynamo table.
|
|
10
5
|
*
|
|
@@ -26,13 +21,13 @@ const metadata_1 = __importDefault(require("../../metadata"));
|
|
|
26
21
|
function PartitionKeyAttribute(props) {
|
|
27
22
|
return function (_value, context) {
|
|
28
23
|
context.addInitializer(function () {
|
|
29
|
-
|
|
24
|
+
Metadata.addPartitionKeyAttribute(this, {
|
|
30
25
|
attributeName: context.name.toString(),
|
|
31
26
|
kind: "string",
|
|
32
|
-
type:
|
|
27
|
+
type: z.string(),
|
|
33
28
|
...props
|
|
34
29
|
});
|
|
35
30
|
});
|
|
36
31
|
};
|
|
37
32
|
}
|
|
38
|
-
|
|
33
|
+
export default PartitionKeyAttribute;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import { type SortKey } from "../../types";
|
|
3
|
-
import type { NonNullAttributeOptions } from "../types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import { type SortKey } from "../../types.js";
|
|
3
|
+
import type { NonNullAttributeOptions } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* A decorator for designating the field for the sort key on the dynamo table.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/SortKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"SortKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/SortKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO,EAC/D,KAAK,CAAC,EAAE,uBAAuB,IAG7B,QAAQ,SAAS,EACjB,SAAS,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,UAW5C;AAED,eAAe,gBAAgB,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 zod_1 = require("zod");
|
|
7
|
-
const metadata_1 = __importDefault(require("../../metadata"));
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import Metadata from "../../metadata/index.js";
|
|
8
3
|
/**
|
|
9
4
|
* A decorator for designating the field for the sort key on the dynamo table.
|
|
10
5
|
*
|
|
@@ -26,13 +21,13 @@ const metadata_1 = __importDefault(require("../../metadata"));
|
|
|
26
21
|
function SortKeyAttribute(props) {
|
|
27
22
|
return function (_value, context) {
|
|
28
23
|
context.addInitializer(function () {
|
|
29
|
-
|
|
24
|
+
Metadata.addSortKeyAttribute(this, {
|
|
30
25
|
attributeName: context.name.toString(),
|
|
31
26
|
kind: "string",
|
|
32
|
-
type:
|
|
27
|
+
type: z.string(),
|
|
33
28
|
...props
|
|
34
29
|
});
|
|
35
30
|
});
|
|
36
31
|
};
|
|
37
32
|
}
|
|
38
|
-
|
|
33
|
+
export default SortKeyAttribute;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import type { AttributeDecoratorContext, AttributeOptions, NotForeignKey } from "../types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import type { AttributeDecoratorContext, AttributeOptions, NotForeignKey } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* A decorator for marking class fields as string attributes within the context of a single-table design entity, with a specific restriction against using foreign key types.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/StringAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"StringAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/StringAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EACV,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,IAEP,QAAQ,SAAS,EACjB,SAAS,yBAAyB,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAY7D;AAED,eAAe,eAAe,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 zod_1 = require("zod");
|
|
7
|
-
const metadata_1 = __importDefault(require("../../metadata"));
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import Metadata from "../../metadata/index.js";
|
|
8
3
|
/**
|
|
9
4
|
* A decorator for marking class fields as string attributes within the context of a single-table design entity, with a specific restriction against using foreign key types.
|
|
10
5
|
*
|
|
@@ -31,14 +26,14 @@ const metadata_1 = __importDefault(require("../../metadata"));
|
|
|
31
26
|
function StringAttribute(props) {
|
|
32
27
|
return function (_value, context) {
|
|
33
28
|
context.addInitializer(function () {
|
|
34
|
-
|
|
29
|
+
Metadata.addEntityAttribute(this.constructor.name, {
|
|
35
30
|
attributeName: context.name.toString(),
|
|
36
31
|
kind: "string",
|
|
37
32
|
nullable: props?.nullable,
|
|
38
|
-
type:
|
|
33
|
+
type: z.string(),
|
|
39
34
|
...props
|
|
40
35
|
});
|
|
41
36
|
});
|
|
42
37
|
};
|
|
43
38
|
}
|
|
44
|
-
|
|
39
|
+
export default StringAttribute;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { default as PartitionKeyAttribute } from "./PartitionKeyAttribute";
|
|
2
|
-
export { default as SortKeyAttribute } from "./SortKeyAttribute";
|
|
3
|
-
export { default as ForeignKeyAttribute } from "./ForeignKeyAttribute";
|
|
4
|
-
export { default as DateAttribute } from "./DateAttribute";
|
|
5
|
-
export { default as StringAttribute } from "./StringAttribute";
|
|
6
|
-
export { default as BooleanAttribute } from "./BooleanAttribute";
|
|
7
|
-
export { default as NumberAttribute } from "./NumberAttribute";
|
|
8
|
-
export { default as EnumAttribute } from "./EnumAttribute";
|
|
9
|
-
export { default as IdAttribute } from "./IdAttribute";
|
|
10
|
-
export { default as ObjectAttribute } from "./ObjectAttribute";
|
|
11
|
-
export type { ObjectAttributeOptions } from "./ObjectAttribute";
|
|
12
|
-
export * from "./serializers";
|
|
13
|
-
export type { ObjectSchema, NonUnionObjectSchema, InferObjectSchema, InferDiscriminatedUnion, FieldDef, NonUnionFieldDef, PrimitiveFieldDef, ObjectFieldDef, ArrayFieldDef, EnumFieldDef, DateFieldDef, DiscriminatedUnionFieldDef } from "./types";
|
|
1
|
+
export { default as PartitionKeyAttribute } from "./PartitionKeyAttribute.js";
|
|
2
|
+
export { default as SortKeyAttribute } from "./SortKeyAttribute.js";
|
|
3
|
+
export { default as ForeignKeyAttribute } from "./ForeignKeyAttribute.js";
|
|
4
|
+
export { default as DateAttribute } from "./DateAttribute.js";
|
|
5
|
+
export { default as StringAttribute } from "./StringAttribute.js";
|
|
6
|
+
export { default as BooleanAttribute } from "./BooleanAttribute.js";
|
|
7
|
+
export { default as NumberAttribute } from "./NumberAttribute.js";
|
|
8
|
+
export { default as EnumAttribute } from "./EnumAttribute.js";
|
|
9
|
+
export { default as IdAttribute } from "./IdAttribute.js";
|
|
10
|
+
export { default as ObjectAttribute } from "./ObjectAttribute.js";
|
|
11
|
+
export type { ObjectAttributeOptions } from "./ObjectAttribute.js";
|
|
12
|
+
export * from "./serializers.js";
|
|
13
|
+
export type { ObjectSchema, NonUnionObjectSchema, InferObjectSchema, InferDiscriminatedUnion, FieldDef, NonUnionFieldDef, PrimitiveFieldDef, ObjectFieldDef, ArrayFieldDef, EnumFieldDef, DateFieldDef, DiscriminatedUnionFieldDef } from "./types.js";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,cAAc,kBAAkB,CAAC;AACjC,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC3B,MAAM,YAAY,CAAC"}
|
|
@@ -1,41 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.ObjectAttribute = exports.IdAttribute = exports.EnumAttribute = exports.NumberAttribute = exports.BooleanAttribute = exports.StringAttribute = exports.DateAttribute = exports.ForeignKeyAttribute = exports.SortKeyAttribute = exports.PartitionKeyAttribute = void 0;
|
|
21
|
-
var PartitionKeyAttribute_1 = require("./PartitionKeyAttribute");
|
|
22
|
-
Object.defineProperty(exports, "PartitionKeyAttribute", { enumerable: true, get: function () { return __importDefault(PartitionKeyAttribute_1).default; } });
|
|
23
|
-
var SortKeyAttribute_1 = require("./SortKeyAttribute");
|
|
24
|
-
Object.defineProperty(exports, "SortKeyAttribute", { enumerable: true, get: function () { return __importDefault(SortKeyAttribute_1).default; } });
|
|
25
|
-
var ForeignKeyAttribute_1 = require("./ForeignKeyAttribute");
|
|
26
|
-
Object.defineProperty(exports, "ForeignKeyAttribute", { enumerable: true, get: function () { return __importDefault(ForeignKeyAttribute_1).default; } });
|
|
27
|
-
var DateAttribute_1 = require("./DateAttribute");
|
|
28
|
-
Object.defineProperty(exports, "DateAttribute", { enumerable: true, get: function () { return __importDefault(DateAttribute_1).default; } });
|
|
29
|
-
var StringAttribute_1 = require("./StringAttribute");
|
|
30
|
-
Object.defineProperty(exports, "StringAttribute", { enumerable: true, get: function () { return __importDefault(StringAttribute_1).default; } });
|
|
31
|
-
var BooleanAttribute_1 = require("./BooleanAttribute");
|
|
32
|
-
Object.defineProperty(exports, "BooleanAttribute", { enumerable: true, get: function () { return __importDefault(BooleanAttribute_1).default; } });
|
|
33
|
-
var NumberAttribute_1 = require("./NumberAttribute");
|
|
34
|
-
Object.defineProperty(exports, "NumberAttribute", { enumerable: true, get: function () { return __importDefault(NumberAttribute_1).default; } });
|
|
35
|
-
var EnumAttribute_1 = require("./EnumAttribute");
|
|
36
|
-
Object.defineProperty(exports, "EnumAttribute", { enumerable: true, get: function () { return __importDefault(EnumAttribute_1).default; } });
|
|
37
|
-
var IdAttribute_1 = require("./IdAttribute");
|
|
38
|
-
Object.defineProperty(exports, "IdAttribute", { enumerable: true, get: function () { return __importDefault(IdAttribute_1).default; } });
|
|
39
|
-
var ObjectAttribute_1 = require("./ObjectAttribute");
|
|
40
|
-
Object.defineProperty(exports, "ObjectAttribute", { enumerable: true, get: function () { return __importDefault(ObjectAttribute_1).default; } });
|
|
41
|
-
__exportStar(require("./serializers"), exports);
|
|
1
|
+
export { default as PartitionKeyAttribute } from "./PartitionKeyAttribute.js";
|
|
2
|
+
export { default as SortKeyAttribute } from "./SortKeyAttribute.js";
|
|
3
|
+
export { default as ForeignKeyAttribute } from "./ForeignKeyAttribute.js";
|
|
4
|
+
export { default as DateAttribute } from "./DateAttribute.js";
|
|
5
|
+
export { default as StringAttribute } from "./StringAttribute.js";
|
|
6
|
+
export { default as BooleanAttribute } from "./BooleanAttribute.js";
|
|
7
|
+
export { default as NumberAttribute } from "./NumberAttribute.js";
|
|
8
|
+
export { default as EnumAttribute } from "./EnumAttribute.js";
|
|
9
|
+
export { default as IdAttribute } from "./IdAttribute.js";
|
|
10
|
+
export { default as ObjectAttribute } from "./ObjectAttribute.js";
|
|
11
|
+
export * from "./serializers.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NativeAttributeValue } from "@aws-sdk/util-dynamodb";
|
|
2
|
-
import type { ObjectSchema, FieldDef } from "./types";
|
|
3
|
-
import type { Serializers } from "../../metadata/types";
|
|
2
|
+
import type { ObjectSchema, FieldDef } from "./types.js";
|
|
3
|
+
import type { Serializers } from "../../metadata/types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Provides serialization and deserialization functions for date attributes when interfacing with a DynamoDB table, enabling the conversion between the table's string-based date representation and JavaScript's `Date` object. DynamoDb dos not support Date types naturally, this utility allows for Date attributes to be serialized to an entity and stored as ISO strings in Dynamo.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/serializers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/serializers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;6BACA,oBAAoB,KAAG,OAAO;4BAM/B,OAAO;CAEhC,CAAC;AAuBF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AAwBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,OAAO,GACX,OAAO,CAmBT;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AA8BD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAOxE"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dateSerializer = void 0;
|
|
4
|
-
exports.objectToTableItem = objectToTableItem;
|
|
5
|
-
exports.convertFieldToTableItem = convertFieldToTableItem;
|
|
6
|
-
exports.tableItemToObject = tableItemToObject;
|
|
7
|
-
exports.createObjectSerializer = createObjectSerializer;
|
|
8
1
|
/**
|
|
9
2
|
* Provides serialization and deserialization functions for date attributes when interfacing with a DynamoDB table, enabling the conversion between the table's string-based date representation and JavaScript's `Date` object. DynamoDb dos not support Date types naturally, this utility allows for Date attributes to be serialized to an entity and stored as ISO strings in Dynamo.
|
|
10
3
|
*
|
|
@@ -12,7 +5,7 @@ exports.createObjectSerializer = createObjectSerializer;
|
|
|
12
5
|
* - `toTableAttribute`: Converts a JavaScript `Date` object to a string representation suitable for DynamoDB storage, specifically using the ISO 8601 format. This ensures that date information is stored in a consistent and queryable format within DynamoDB.
|
|
13
6
|
*
|
|
14
7
|
*/
|
|
15
|
-
|
|
8
|
+
export const dateSerializer = {
|
|
16
9
|
toEntityAttribute: (val) => {
|
|
17
10
|
if (typeof val === "string") {
|
|
18
11
|
return new Date(val);
|
|
@@ -53,7 +46,7 @@ function resolveVariantSchema(fieldDef, value) {
|
|
|
53
46
|
* @param value The entity-level object value to convert
|
|
54
47
|
* @returns A new object suitable for DynamoDB storage
|
|
55
48
|
*/
|
|
56
|
-
function objectToTableItem(schema, value) {
|
|
49
|
+
export function objectToTableItem(schema, value) {
|
|
57
50
|
const result = {};
|
|
58
51
|
for (const [key, fieldDef] of Object.entries(schema)) {
|
|
59
52
|
const val = value[key];
|
|
@@ -91,7 +84,7 @@ function convertDiscriminatedUnion(fieldDef, value, schemaConverter) {
|
|
|
91
84
|
* @param val The entity-level value to convert
|
|
92
85
|
* @returns The DynamoDB-compatible value
|
|
93
86
|
*/
|
|
94
|
-
function convertFieldToTableItem(fieldDef, val) {
|
|
87
|
+
export function convertFieldToTableItem(fieldDef, val) {
|
|
95
88
|
switch (fieldDef.type) {
|
|
96
89
|
case "date":
|
|
97
90
|
return val.toISOString();
|
|
@@ -123,7 +116,7 @@ function convertFieldToTableItem(fieldDef, val) {
|
|
|
123
116
|
* @param value The DynamoDB table item to convert
|
|
124
117
|
* @returns A new object with entity-level types (e.g. `Date` instead of string)
|
|
125
118
|
*/
|
|
126
|
-
function tableItemToObject(schema, value) {
|
|
119
|
+
export function tableItemToObject(schema, value) {
|
|
127
120
|
const result = {};
|
|
128
121
|
for (const [key, fieldDef] of Object.entries(schema)) {
|
|
129
122
|
const val = value[key];
|
|
@@ -166,7 +159,7 @@ function convertFieldToEntityValue(fieldDef, val) {
|
|
|
166
159
|
* @param schema The {@link ObjectSchema} describing the object shape
|
|
167
160
|
* @returns A `Serializers` object with `toTableAttribute` and `toEntityAttribute` functions
|
|
168
161
|
*/
|
|
169
|
-
function createObjectSerializer(schema) {
|
|
162
|
+
export function createObjectSerializer(schema) {
|
|
170
163
|
return {
|
|
171
164
|
toTableAttribute: (val) => objectToTableItem(schema, val),
|
|
172
165
|
toEntityAttribute: (val) => tableItemToObject(schema, val)
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { default as Entity } from "./Entity";
|
|
2
|
-
export { default as Table } from "./Table";
|
|
3
|
-
export * from "./relationships";
|
|
4
|
-
export * from "./attributes";
|
|
5
|
-
export * from "./types";
|
|
1
|
+
export { default as Entity } from "./Entity.js";
|
|
2
|
+
export { default as Table } from "./Table.js";
|
|
3
|
+
export * from "./relationships/index.js";
|
|
4
|
+
export * from "./attributes/index.js";
|
|
5
|
+
export * from "./types.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
|
@@ -1,27 +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
|
-
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.Table = exports.Entity = void 0;
|
|
21
|
-
var Entity_1 = require("./Entity");
|
|
22
|
-
Object.defineProperty(exports, "Entity", { enumerable: true, get: function () { return __importDefault(Entity_1).default; } });
|
|
23
|
-
var Table_1 = require("./Table");
|
|
24
|
-
Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return __importDefault(Table_1).default; } });
|
|
25
|
-
__exportStar(require("./relationships"), exports);
|
|
26
|
-
__exportStar(require("./attributes"), exports);
|
|
27
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export { default as Entity } from "./Entity.js";
|
|
2
|
+
export { default as Table } from "./Table.js";
|
|
3
|
+
export * from "./relationships/index.js";
|
|
4
|
+
export * from "./attributes/index.js";
|
|
5
|
+
export * from "./types.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type DynaRecord from "../../DynaRecord";
|
|
2
|
-
import type { EntityClass } from "../../types";
|
|
3
|
-
import type { BelongsToField, BelongsToProps, BelongsToTarget } from "./types";
|
|
4
|
-
import type { ForeignEntityAttribute } from "../types";
|
|
1
|
+
import type DynaRecord from "../../DynaRecord.js";
|
|
2
|
+
import type { EntityClass } from "../../types.js";
|
|
3
|
+
import type { BelongsToField, BelongsToProps, BelongsToTarget } from "./types.js";
|
|
4
|
+
import type { ForeignEntityAttribute } from "../types.js";
|
|
5
5
|
/**
|
|
6
6
|
* A decorator for defining a "BelongsTo" relationship between entities in a single-table design using DynaRecord. This relationship indicates that the decorated field is a reference to another entity, effectively establishing a parent-child linkage. The decorator dynamically enforces the presence or optionality of this reference based on the nature of the foreign key, enhancing type safety and relationship integrity within the ORM model.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BelongsTo.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/BelongsTo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"BelongsTo.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/BelongsTo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,iBAAS,SAAS,CAChB,MAAM,SAAS,UAAU,EACzB,EAAE,SAAS,sBAAsB,CAAC,MAAM,CAAC,EAEzC,SAAS,EAAE,MAAM,WAAW,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EACzD,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,IAG/B,QAAQ,SAAS,EACjB,SAAS,0BAA0B,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,UAW1E;AAED,eAAe,SAAS,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 metadata_1 = __importDefault(require("../../metadata"));
|
|
1
|
+
import Metadata from "../../metadata/index.js";
|
|
7
2
|
/**
|
|
8
3
|
* A decorator for defining a "BelongsTo" relationship between entities in a single-table design using DynaRecord. This relationship indicates that the decorated field is a reference to another entity, effectively establishing a parent-child linkage. The decorator dynamically enforces the presence or optionality of this reference based on the nature of the foreign key, enhancing type safety and relationship integrity within the ORM model.
|
|
9
4
|
*
|
|
@@ -35,7 +30,7 @@ const metadata_1 = __importDefault(require("../../metadata"));
|
|
|
35
30
|
function BelongsTo(getTarget, props) {
|
|
36
31
|
return function (_value, context) {
|
|
37
32
|
context.addInitializer(function () {
|
|
38
|
-
|
|
33
|
+
Metadata.addEntityRelationship(this.constructor.name, {
|
|
39
34
|
type: "BelongsTo",
|
|
40
35
|
propertyName: context.name,
|
|
41
36
|
target: getTarget(),
|
|
@@ -44,4 +39,4 @@ function BelongsTo(getTarget, props) {
|
|
|
44
39
|
});
|
|
45
40
|
};
|
|
46
41
|
}
|
|
47
|
-
|
|
42
|
+
export default BelongsTo;
|