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.
Files changed (244) hide show
  1. package/README.md +23 -7
  2. package/dist/index.d.ts +12 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +13 -22
  5. package/dist/src/DynaRecord.d.ts +3 -3
  6. package/dist/src/DynaRecord.d.ts.map +1 -1
  7. package/dist/src/DynaRecord.js +24 -59
  8. package/dist/src/Logger.js +1 -3
  9. package/dist/src/decorators/Entity.d.ts +1 -1
  10. package/dist/src/decorators/Entity.d.ts.map +1 -1
  11. package/dist/src/decorators/Entity.js +3 -8
  12. package/dist/src/decorators/Table.d.ts +2 -2
  13. package/dist/src/decorators/Table.d.ts.map +1 -1
  14. package/dist/src/decorators/Table.js +3 -8
  15. package/dist/src/decorators/attributes/BooleanAttribute.d.ts +2 -2
  16. package/dist/src/decorators/attributes/BooleanAttribute.d.ts.map +1 -1
  17. package/dist/src/decorators/attributes/BooleanAttribute.js +5 -10
  18. package/dist/src/decorators/attributes/DateAttribute.d.ts +2 -2
  19. package/dist/src/decorators/attributes/DateAttribute.d.ts.map +1 -1
  20. package/dist/src/decorators/attributes/DateAttribute.js +7 -12
  21. package/dist/src/decorators/attributes/EnumAttribute.d.ts +2 -2
  22. package/dist/src/decorators/attributes/EnumAttribute.d.ts.map +1 -1
  23. package/dist/src/decorators/attributes/EnumAttribute.js +5 -10
  24. package/dist/src/decorators/attributes/ForeignKeyAttribute.d.ts +3 -3
  25. package/dist/src/decorators/attributes/ForeignKeyAttribute.d.ts.map +1 -1
  26. package/dist/src/decorators/attributes/ForeignKeyAttribute.js +5 -10
  27. package/dist/src/decorators/attributes/IdAttribute.d.ts +1 -1
  28. package/dist/src/decorators/attributes/IdAttribute.d.ts.map +1 -1
  29. package/dist/src/decorators/attributes/IdAttribute.js +3 -8
  30. package/dist/src/decorators/attributes/NumberAttribute.d.ts +2 -2
  31. package/dist/src/decorators/attributes/NumberAttribute.d.ts.map +1 -1
  32. package/dist/src/decorators/attributes/NumberAttribute.js +5 -10
  33. package/dist/src/decorators/attributes/ObjectAttribute.d.ts +3 -3
  34. package/dist/src/decorators/attributes/ObjectAttribute.d.ts.map +1 -1
  35. package/dist/src/decorators/attributes/ObjectAttribute.js +16 -21
  36. package/dist/src/decorators/attributes/PartitionKeyAttribute.d.ts +3 -3
  37. package/dist/src/decorators/attributes/PartitionKeyAttribute.d.ts.map +1 -1
  38. package/dist/src/decorators/attributes/PartitionKeyAttribute.js +5 -10
  39. package/dist/src/decorators/attributes/SortKeyAttribute.d.ts +3 -3
  40. package/dist/src/decorators/attributes/SortKeyAttribute.d.ts.map +1 -1
  41. package/dist/src/decorators/attributes/SortKeyAttribute.js +5 -10
  42. package/dist/src/decorators/attributes/StringAttribute.d.ts +2 -2
  43. package/dist/src/decorators/attributes/StringAttribute.d.ts.map +1 -1
  44. package/dist/src/decorators/attributes/StringAttribute.js +5 -10
  45. package/dist/src/decorators/attributes/index.d.ts +13 -13
  46. package/dist/src/decorators/attributes/index.d.ts.map +1 -1
  47. package/dist/src/decorators/attributes/index.js +11 -41
  48. package/dist/src/decorators/attributes/serializers.d.ts +2 -2
  49. package/dist/src/decorators/attributes/serializers.d.ts.map +1 -1
  50. package/dist/src/decorators/attributes/serializers.js +5 -12
  51. package/dist/src/decorators/attributes/types.js +1 -2
  52. package/dist/src/decorators/index.d.ts +5 -5
  53. package/dist/src/decorators/index.d.ts.map +1 -1
  54. package/dist/src/decorators/index.js +5 -27
  55. package/dist/src/decorators/relationships/BelongsTo.d.ts +4 -4
  56. package/dist/src/decorators/relationships/BelongsTo.d.ts.map +1 -1
  57. package/dist/src/decorators/relationships/BelongsTo.js +3 -8
  58. package/dist/src/decorators/relationships/HasAndBelongsToMany.d.ts +3 -3
  59. package/dist/src/decorators/relationships/HasAndBelongsToMany.d.ts.map +1 -1
  60. package/dist/src/decorators/relationships/HasAndBelongsToMany.js +4 -9
  61. package/dist/src/decorators/relationships/HasMany.d.ts +3 -3
  62. package/dist/src/decorators/relationships/HasMany.d.ts.map +1 -1
  63. package/dist/src/decorators/relationships/HasMany.js +4 -9
  64. package/dist/src/decorators/relationships/HasOne.d.ts +3 -3
  65. package/dist/src/decorators/relationships/HasOne.d.ts.map +1 -1
  66. package/dist/src/decorators/relationships/HasOne.js +3 -8
  67. package/dist/src/decorators/relationships/index.d.ts +5 -5
  68. package/dist/src/decorators/relationships/index.d.ts.map +1 -1
  69. package/dist/src/decorators/relationships/index.js +5 -29
  70. package/dist/src/decorators/relationships/types.d.ts +3 -3
  71. package/dist/src/decorators/relationships/types.d.ts.map +1 -1
  72. package/dist/src/decorators/relationships/types.js +1 -2
  73. package/dist/src/decorators/types.d.ts +3 -3
  74. package/dist/src/decorators/types.d.ts.map +1 -1
  75. package/dist/src/decorators/types.js +1 -2
  76. package/dist/src/dynamo-utils/DynamoClient.d.ts +1 -1
  77. package/dist/src/dynamo-utils/DynamoClient.d.ts.map +1 -1
  78. package/dist/src/dynamo-utils/DynamoClient.js +13 -18
  79. package/dist/src/dynamo-utils/TransactGetBuilder.d.ts +1 -1
  80. package/dist/src/dynamo-utils/TransactGetBuilder.d.ts.map +1 -1
  81. package/dist/src/dynamo-utils/TransactGetBuilder.js +5 -10
  82. package/dist/src/dynamo-utils/TransactWriteBuilder.d.ts +1 -1
  83. package/dist/src/dynamo-utils/TransactWriteBuilder.d.ts.map +1 -1
  84. package/dist/src/dynamo-utils/TransactWriteBuilder.js +11 -16
  85. package/dist/src/dynamo-utils/errors.js +2 -7
  86. package/dist/src/dynamo-utils/index.d.ts +7 -7
  87. package/dist/src/dynamo-utils/index.d.ts.map +1 -1
  88. package/dist/src/dynamo-utils/index.js +7 -30
  89. package/dist/src/dynamo-utils/types.js +1 -2
  90. package/dist/src/errors.js +3 -9
  91. package/dist/src/id.d.ts +12 -0
  92. package/dist/src/id.d.ts.map +1 -0
  93. package/dist/src/id.js +11 -0
  94. package/dist/src/index.d.ts +8 -8
  95. package/dist/src/index.d.ts.map +1 -1
  96. package/dist/src/index.js +4 -20
  97. package/dist/src/metadata/AttributeMetadata.d.ts +4 -4
  98. package/dist/src/metadata/AttributeMetadata.d.ts.map +1 -1
  99. package/dist/src/metadata/AttributeMetadata.js +1 -3
  100. package/dist/src/metadata/EntityMetadata.d.ts +3 -3
  101. package/dist/src/metadata/EntityMetadata.d.ts.map +1 -1
  102. package/dist/src/metadata/EntityMetadata.js +18 -23
  103. package/dist/src/metadata/JoinTableMetadata.d.ts +3 -3
  104. package/dist/src/metadata/JoinTableMetadata.d.ts.map +1 -1
  105. package/dist/src/metadata/JoinTableMetadata.js +1 -3
  106. package/dist/src/metadata/MetadataStorage.d.ts +7 -7
  107. package/dist/src/metadata/MetadataStorage.d.ts.map +1 -1
  108. package/dist/src/metadata/MetadataStorage.js +12 -17
  109. package/dist/src/metadata/TableMetadata.d.ts +3 -3
  110. package/dist/src/metadata/TableMetadata.d.ts.map +1 -1
  111. package/dist/src/metadata/TableMetadata.js +17 -20
  112. package/dist/src/metadata/index.d.ts +9 -9
  113. package/dist/src/metadata/index.d.ts.map +1 -1
  114. package/dist/src/metadata/index.js +11 -34
  115. package/dist/src/metadata/relationship-metadata/BelongsToRelationship.d.ts +2 -2
  116. package/dist/src/metadata/relationship-metadata/BelongsToRelationship.d.ts.map +1 -1
  117. package/dist/src/metadata/relationship-metadata/BelongsToRelationship.js +3 -8
  118. package/dist/src/metadata/relationship-metadata/HasAndBelongsToManyRelationship.d.ts +1 -1
  119. package/dist/src/metadata/relationship-metadata/HasAndBelongsToManyRelationship.d.ts.map +1 -1
  120. package/dist/src/metadata/relationship-metadata/HasAndBelongsToManyRelationship.js +3 -8
  121. package/dist/src/metadata/relationship-metadata/HasManyRelationship.d.ts +2 -2
  122. package/dist/src/metadata/relationship-metadata/HasManyRelationship.d.ts.map +1 -1
  123. package/dist/src/metadata/relationship-metadata/HasManyRelationship.js +3 -8
  124. package/dist/src/metadata/relationship-metadata/HasOneRelationship.d.ts +2 -2
  125. package/dist/src/metadata/relationship-metadata/HasOneRelationship.d.ts.map +1 -1
  126. package/dist/src/metadata/relationship-metadata/HasOneRelationship.js +3 -8
  127. package/dist/src/metadata/relationship-metadata/OwnedByRelationship.d.ts +2 -2
  128. package/dist/src/metadata/relationship-metadata/OwnedByRelationship.d.ts.map +1 -1
  129. package/dist/src/metadata/relationship-metadata/OwnedByRelationship.js +3 -8
  130. package/dist/src/metadata/relationship-metadata/RelationshipMetadata.d.ts +2 -2
  131. package/dist/src/metadata/relationship-metadata/RelationshipMetadata.d.ts.map +1 -1
  132. package/dist/src/metadata/relationship-metadata/RelationshipMetadata.js +1 -3
  133. package/dist/src/metadata/relationship-metadata/index.d.ts +6 -6
  134. package/dist/src/metadata/relationship-metadata/index.d.ts.map +1 -1
  135. package/dist/src/metadata/relationship-metadata/index.js +7 -31
  136. package/dist/src/metadata/relationship-metadata/types.d.ts +5 -5
  137. package/dist/src/metadata/relationship-metadata/types.d.ts.map +1 -1
  138. package/dist/src/metadata/relationship-metadata/types.js +1 -2
  139. package/dist/src/metadata/relationship-metadata/utils.d.ts +1 -1
  140. package/dist/src/metadata/relationship-metadata/utils.d.ts.map +1 -1
  141. package/dist/src/metadata/relationship-metadata/utils.js +11 -18
  142. package/dist/src/metadata/schemas.d.ts +3 -3
  143. package/dist/src/metadata/schemas.d.ts.map +1 -1
  144. package/dist/src/metadata/schemas.js +34 -37
  145. package/dist/src/metadata/types.d.ts +4 -4
  146. package/dist/src/metadata/types.d.ts.map +1 -1
  147. package/dist/src/metadata/types.js +1 -2
  148. package/dist/src/metadata/utils.d.ts +5 -5
  149. package/dist/src/metadata/utils.d.ts.map +1 -1
  150. package/dist/src/metadata/utils.js +14 -29
  151. package/dist/src/operations/Create/Create.d.ts +5 -5
  152. package/dist/src/operations/Create/Create.d.ts.map +1 -1
  153. package/dist/src/operations/Create/Create.js +18 -23
  154. package/dist/src/operations/Create/index.d.ts +2 -2
  155. package/dist/src/operations/Create/index.d.ts.map +1 -1
  156. package/dist/src/operations/Create/index.js +2 -23
  157. package/dist/src/operations/Create/types.d.ts +2 -2
  158. package/dist/src/operations/Create/types.d.ts.map +1 -1
  159. package/dist/src/operations/Create/types.js +1 -2
  160. package/dist/src/operations/Delete/Delete.d.ts +3 -3
  161. package/dist/src/operations/Delete/Delete.d.ts.map +1 -1
  162. package/dist/src/operations/Delete/Delete.js +28 -33
  163. package/dist/src/operations/Delete/index.d.ts +1 -1
  164. package/dist/src/operations/Delete/index.d.ts.map +1 -1
  165. package/dist/src/operations/Delete/index.js +1 -8
  166. package/dist/src/operations/Delete/types.js +1 -2
  167. package/dist/src/operations/FindById/FindById.d.ts +4 -4
  168. package/dist/src/operations/FindById/FindById.d.ts.map +1 -1
  169. package/dist/src/operations/FindById/FindById.js +17 -22
  170. package/dist/src/operations/FindById/index.d.ts +2 -2
  171. package/dist/src/operations/FindById/index.d.ts.map +1 -1
  172. package/dist/src/operations/FindById/index.js +2 -23
  173. package/dist/src/operations/FindById/types.d.ts +3 -3
  174. package/dist/src/operations/FindById/types.d.ts.map +1 -1
  175. package/dist/src/operations/FindById/types.js +1 -2
  176. package/dist/src/operations/OperationBase.d.ts +3 -3
  177. package/dist/src/operations/OperationBase.d.ts.map +1 -1
  178. package/dist/src/operations/OperationBase.js +4 -9
  179. package/dist/src/operations/Query/Query.d.ts +4 -4
  180. package/dist/src/operations/Query/Query.d.ts.map +1 -1
  181. package/dist/src/operations/Query/Query.js +15 -20
  182. package/dist/src/operations/Query/index.d.ts +2 -2
  183. package/dist/src/operations/Query/index.d.ts.map +1 -1
  184. package/dist/src/operations/Query/index.js +2 -23
  185. package/dist/src/operations/Query/types.d.ts +4 -4
  186. package/dist/src/operations/Query/types.d.ts.map +1 -1
  187. package/dist/src/operations/Query/types.js +1 -2
  188. package/dist/src/operations/Update/Update.d.ts +5 -5
  189. package/dist/src/operations/Update/Update.d.ts.map +1 -1
  190. package/dist/src/operations/Update/Update.js +37 -42
  191. package/dist/src/operations/Update/UpdateDryRun.d.ts +2 -2
  192. package/dist/src/operations/Update/UpdateDryRun.d.ts.map +1 -1
  193. package/dist/src/operations/Update/UpdateDryRun.js +3 -8
  194. package/dist/src/operations/Update/index.d.ts +3 -3
  195. package/dist/src/operations/Update/index.d.ts.map +1 -1
  196. package/dist/src/operations/Update/index.js +3 -25
  197. package/dist/src/operations/Update/types.d.ts +2 -2
  198. package/dist/src/operations/Update/types.d.ts.map +1 -1
  199. package/dist/src/operations/Update/types.js +1 -2
  200. package/dist/src/operations/index.d.ts +6 -6
  201. package/dist/src/operations/index.d.ts.map +1 -1
  202. package/dist/src/operations/index.js +6 -22
  203. package/dist/src/operations/types.d.ts +3 -3
  204. package/dist/src/operations/types.d.ts.map +1 -1
  205. package/dist/src/operations/types.js +1 -2
  206. package/dist/src/operations/utils/expressionBuilder.d.ts +2 -2
  207. package/dist/src/operations/utils/expressionBuilder.d.ts.map +1 -1
  208. package/dist/src/operations/utils/expressionBuilder.js +1 -5
  209. package/dist/src/operations/utils/flattenObjectForUpdate.d.ts +2 -2
  210. package/dist/src/operations/utils/flattenObjectForUpdate.d.ts.map +1 -1
  211. package/dist/src/operations/utils/flattenObjectForUpdate.js +3 -6
  212. package/dist/src/operations/utils/index.d.ts +5 -5
  213. package/dist/src/operations/utils/index.d.ts.map +1 -1
  214. package/dist/src/operations/utils/index.js +5 -21
  215. package/dist/src/operations/utils/mergePartialObjectAttributes.d.ts +1 -1
  216. package/dist/src/operations/utils/mergePartialObjectAttributes.d.ts.map +1 -1
  217. package/dist/src/operations/utils/mergePartialObjectAttributes.js +1 -4
  218. package/dist/src/operations/utils/types.js +1 -2
  219. package/dist/src/operations/utils/utils.d.ts +4 -4
  220. package/dist/src/operations/utils/utils.d.ts.map +1 -1
  221. package/dist/src/operations/utils/utils.js +13 -23
  222. package/dist/src/query-utils/Filters.d.ts +2 -2
  223. package/dist/src/query-utils/Filters.d.ts.map +1 -1
  224. package/dist/src/query-utils/Filters.js +1 -4
  225. package/dist/src/query-utils/QueryBuilder.d.ts +1 -1
  226. package/dist/src/query-utils/QueryBuilder.d.ts.map +1 -1
  227. package/dist/src/query-utils/QueryBuilder.js +8 -13
  228. package/dist/src/query-utils/index.d.ts +2 -2
  229. package/dist/src/query-utils/index.d.ts.map +1 -1
  230. package/dist/src/query-utils/index.js +2 -23
  231. package/dist/src/query-utils/types.js +1 -2
  232. package/dist/src/relationships/JoinTable.d.ts +2 -2
  233. package/dist/src/relationships/JoinTable.d.ts.map +1 -1
  234. package/dist/src/relationships/JoinTable.js +14 -19
  235. package/dist/src/relationships/index.d.ts +1 -1
  236. package/dist/src/relationships/index.d.ts.map +1 -1
  237. package/dist/src/relationships/index.js +1 -8
  238. package/dist/src/types.d.ts +2 -2
  239. package/dist/src/types.d.ts.map +1 -1
  240. package/dist/src/types.js +1 -2
  241. package/dist/src/utils.d.ts +3 -3
  242. package/dist/src/utils.d.ts.map +1 -1
  243. package/dist/src/utils.js +16 -31
  244. package/package.json +28 -24
@@ -1,4 +1,4 @@
1
- import type DynaRecord from "../../DynaRecord";
1
+ import type DynaRecord from "../../DynaRecord.js";
2
2
  /**
3
3
  * An optional decorator for marking class fields as the primary identifier (ID) within the context of a single-table design entity.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"IdAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/IdAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;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,UAElB,CAAC,SAAS,CAAC,OAInC;AAED,eAAe,WAAW,CAAC"}
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
- "use strict";
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
- metadata_1.default.addEntityIdField(this.constructor.name, context.name.toString());
32
+ Metadata.addEntityIdField(this.constructor.name, context.name.toString());
38
33
  return value;
39
34
  };
40
35
  }
41
- exports.default = IdAttribute;
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,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,UAY9C;AAED,eAAe,eAAe,CAAC"}
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
- "use strict";
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 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
- metadata_1.default.addEntityAttribute(this.constructor.name, {
29
+ Metadata.addEntityAttribute(this.constructor.name, {
35
30
  attributeName: context.name.toString(),
36
31
  kind: "number",
37
32
  nullable: props?.nullable,
38
- type: zod_1.z.number(),
33
+ type: z.number(),
39
34
  ...props
40
35
  });
41
36
  });
42
37
  };
43
38
  }
44
- exports.default = NumberAttribute;
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,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAGjB;;;;;;;;;;;;;;;;;;;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,YAGtB,SAAS,WACR,yBAAyB,CAChC,CAAC,EACD,iBAAiB,CAAC,CAAC,CAAC,EACpB,sBAAsB,CAAC,CAAC,CAAC,CAC1B,UAqBJ;AAED,eAAe,eAAe,CAAC"}
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
- "use strict";
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 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 zod_1.z.object(buildZodShape(schema, fieldDefToZodPartial)).partial();
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 zod_1.z.object(buildZodShape(schema, fieldDefToZod));
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]: zod_1.z.literal(variantKey)
74
+ [fieldDef.discriminator]: z.literal(variantKey)
80
75
  });
81
76
  });
82
- let zodType = zod_1.z.discriminatedUnion(fieldDef.discriminator, variantSchemas);
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 = zod_1.z.array(fieldDefToZod(fieldDef.items));
112
+ zodType = z.array(fieldDefToZod(fieldDef.items));
118
113
  break;
119
114
  case "string":
120
- zodType = zod_1.z.string();
115
+ zodType = z.string();
121
116
  break;
122
117
  case "number":
123
- zodType = zod_1.z.number();
118
+ zodType = z.number();
124
119
  break;
125
120
  case "boolean":
126
- zodType = zod_1.z.boolean();
121
+ zodType = z.boolean();
127
122
  break;
128
123
  case "date":
129
- zodType = zod_1.z.date();
124
+ zodType = z.date();
130
125
  break;
131
126
  case "enum":
132
- zodType = zod_1.z.enum(fieldDef.values);
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 = (0, serializers_1.createObjectSerializer)(schema);
236
+ const serializers = createObjectSerializer(schema);
242
237
  context.addInitializer(function () {
243
- metadata_1.default.addEntityAttribute(this.constructor.name, {
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
- exports.default = ObjectAttribute;
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,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,qBAAqB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,YAAY,EACzE,KAAK,CAAC,EAAE,uBAAuB,YAGrB,SAAS,WACR,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,UAW5C;AAED,eAAe,qBAAqB,CAAC"}
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
- "use strict";
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 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
- metadata_1.default.addPartitionKeyAttribute(this, {
24
+ Metadata.addPartitionKeyAttribute(this, {
30
25
  attributeName: context.name.toString(),
31
26
  kind: "string",
32
- type: zod_1.z.string(),
27
+ type: z.string(),
33
28
  ...props
34
29
  });
35
30
  });
36
31
  };
37
32
  }
38
- exports.default = PartitionKeyAttribute;
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,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO,EAC/D,KAAK,CAAC,EAAE,uBAAuB,YAGrB,SAAS,WACR,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,UAW5C;AAED,eAAe,gBAAgB,CAAC"}
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
- "use strict";
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 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
- metadata_1.default.addSortKeyAttribute(this, {
24
+ Metadata.addSortKeyAttribute(this, {
30
25
  attributeName: context.name.toString(),
31
26
  kind: "string",
32
- type: zod_1.z.string(),
27
+ type: z.string(),
33
28
  ...props
34
29
  });
35
30
  });
36
31
  };
37
32
  }
38
- exports.default = SortKeyAttribute;
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,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EACV,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,yBAAyB,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAY7D;AAED,eAAe,eAAe,CAAC"}
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
- "use strict";
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 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
- metadata_1.default.addEntityAttribute(this.constructor.name, {
29
+ Metadata.addEntityAttribute(this.constructor.name, {
35
30
  attributeName: context.name.toString(),
36
31
  kind: "string",
37
32
  nullable: props?.nullable,
38
- type: zod_1.z.string(),
33
+ type: z.string(),
39
34
  ...props
40
35
  });
41
36
  });
42
37
  };
43
38
  }
44
- exports.default = StringAttribute;
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,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,cAAc,eAAe,CAAC;AAC9B,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,SAAS,CAAC"}
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.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,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;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
+ {"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
- exports.dateSerializer = {
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
- "use strict";
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,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.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,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;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,YAGvB,SAAS,WACR,0BAA0B,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,UAW1E;AAED,eAAe,SAAS,CAAC"}
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
- "use strict";
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
- metadata_1.default.addEntityRelationship(this.constructor.name, {
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
- exports.default = BelongsTo;
42
+ export default BelongsTo;