@arcaelas/dynamite 1.0.9 → 1.0.10

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 (101) hide show
  1. package/build/__tests__/crud.spec.d.ts +7 -0
  2. package/build/__tests__/crud.spec.js +287 -0
  3. package/build/__tests__/crud.spec.js.map +1 -0
  4. package/build/__tests__/debug-decorators.spec.d.ts +7 -0
  5. package/build/__tests__/debug-decorators.spec.js +143 -0
  6. package/build/__tests__/debug-decorators.spec.js.map +1 -0
  7. package/build/__tests__/decorators.spec.d.ts +7 -0
  8. package/build/__tests__/decorators.spec.js +203 -0
  9. package/build/__tests__/decorators.spec.js.map +1 -0
  10. package/build/__tests__/instance-crud.spec.d.ts +7 -0
  11. package/build/__tests__/instance-crud.spec.js +184 -0
  12. package/build/__tests__/instance-crud.spec.js.map +1 -0
  13. package/build/src/core/client.d.ts +65 -0
  14. package/build/src/core/client.js +152 -0
  15. package/build/src/core/client.js.map +1 -0
  16. package/build/{core → src/core}/table.d.ts +29 -3
  17. package/build/src/core/table.js +406 -0
  18. package/build/src/core/table.js.map +1 -0
  19. package/build/{core → src/core}/wrapper.d.ts +12 -2
  20. package/build/src/core/wrapper.js +27 -0
  21. package/build/src/core/wrapper.js.map +1 -0
  22. package/build/src/decorators/created_at.d.ts +8 -0
  23. package/build/{decorators → src/decorators}/created_at.js +6 -10
  24. package/build/src/decorators/created_at.js.map +1 -0
  25. package/build/src/decorators/default.d.ts +8 -0
  26. package/build/{decorators → src/decorators}/default.js +18 -13
  27. package/build/src/decorators/default.js.map +1 -0
  28. package/build/src/decorators/index.d.ts +8 -0
  29. package/build/src/decorators/index.js +26 -0
  30. package/build/src/decorators/index.js.map +1 -0
  31. package/build/src/decorators/index_sort.d.ts +8 -0
  32. package/build/src/decorators/index_sort.js +30 -0
  33. package/build/src/decorators/index_sort.js.map +1 -0
  34. package/build/src/decorators/mutate.d.ts +9 -0
  35. package/build/{decorators → src/decorators}/mutate.js +22 -15
  36. package/build/src/decorators/mutate.js.map +1 -0
  37. package/build/src/decorators/name.d.ts +8 -0
  38. package/build/src/decorators/name.js +42 -0
  39. package/build/src/decorators/name.js.map +1 -0
  40. package/build/src/decorators/not_null.d.ts +8 -0
  41. package/build/src/decorators/not_null.js +20 -0
  42. package/build/src/decorators/not_null.js.map +1 -0
  43. package/build/src/decorators/primary_key.d.ts +8 -0
  44. package/build/src/decorators/primary_key.js +26 -0
  45. package/build/src/decorators/primary_key.js.map +1 -0
  46. package/build/src/decorators/updated_at.d.ts +8 -0
  47. package/build/src/decorators/updated_at.js +18 -0
  48. package/build/src/decorators/updated_at.js.map +1 -0
  49. package/build/src/decorators/validate.d.ts +8 -0
  50. package/build/{decorators → src/decorators}/validate.js +18 -12
  51. package/build/src/decorators/validate.js.map +1 -0
  52. package/build/{index.d.ts → src/index.d.ts} +5 -3
  53. package/build/{index.js → src/index.js} +14 -7
  54. package/build/src/index.js.map +1 -0
  55. package/build/src/utils/batch-relations.d.ts +14 -0
  56. package/build/src/utils/batch-relations.js +130 -0
  57. package/build/src/utils/batch-relations.js.map +1 -0
  58. package/build/src/utils/naming.d.ts +8 -0
  59. package/build/src/utils/naming.js +18 -0
  60. package/build/src/utils/naming.js.map +1 -0
  61. package/build/src/utils/projection.d.ts +12 -0
  62. package/build/src/utils/projection.js +50 -0
  63. package/build/src/utils/projection.js.map +1 -0
  64. package/build/src/utils/relations.d.ts +23 -0
  65. package/build/src/utils/relations.js +205 -0
  66. package/build/src/utils/relations.js.map +1 -0
  67. package/package.json +1 -1
  68. package/build/core/table.js +0 -400
  69. package/build/core/table.js.map +0 -1
  70. package/build/core/wrapper.js +0 -26
  71. package/build/core/wrapper.js.map +0 -1
  72. package/build/decorators/created_at.d.ts +0 -4
  73. package/build/decorators/created_at.js.map +0 -1
  74. package/build/decorators/default.d.ts +0 -2
  75. package/build/decorators/default.js.map +0 -1
  76. package/build/decorators/index.d.ts +0 -1
  77. package/build/decorators/index.js +0 -24
  78. package/build/decorators/index.js.map +0 -1
  79. package/build/decorators/index_sort.d.ts +0 -1
  80. package/build/decorators/index_sort.js +0 -27
  81. package/build/decorators/index_sort.js.map +0 -1
  82. package/build/decorators/mutate.d.ts +0 -2
  83. package/build/decorators/mutate.js.map +0 -1
  84. package/build/decorators/name.d.ts +0 -1
  85. package/build/decorators/name.js +0 -41
  86. package/build/decorators/name.js.map +0 -1
  87. package/build/decorators/not_null.d.ts +0 -4
  88. package/build/decorators/not_null.js +0 -28
  89. package/build/decorators/not_null.js.map +0 -1
  90. package/build/decorators/primary_key.d.ts +0 -7
  91. package/build/decorators/primary_key.js +0 -30
  92. package/build/decorators/primary_key.js.map +0 -1
  93. package/build/decorators/updated_at.d.ts +0 -4
  94. package/build/decorators/updated_at.js +0 -23
  95. package/build/decorators/updated_at.js.map +0 -1
  96. package/build/decorators/validate.d.ts +0 -1
  97. package/build/decorators/validate.js.map +0 -1
  98. package/build/index.js.map +0 -1
  99. package/build/utils/naming.d.ts +0 -1
  100. package/build/utils/naming.js +0 -18
  101. package/build/utils/naming.js.map +0 -1
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
- /*
3
- * Dinamite ORM — @Default
4
- * -----------------------
5
- * Registra un valor por defecto y crea (si falta) el
6
- * getter/setter virtual de la propiedad.
2
+ /**
3
+ * @file default.ts
4
+ * @descripcion Decorador @Default para valores por defecto
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.default = Default;
10
10
  const wrapper_1 = require("../core/wrapper");
11
11
  const naming_1 = require("../utils/naming");
12
+ /** Decorador para establecer valores por defecto en propiedades */
12
13
  function Default(factory) {
13
14
  return (target, prop) => {
14
15
  const ctor = target.constructor;
@@ -17,12 +18,11 @@ function Default(factory) {
17
18
  if (column.default)
18
19
  throw new Error(`@Default duplicado en '${String(prop)}'`);
19
20
  column.default = typeof factory === "function" ? factory : () => factory;
20
- if (!Object.getOwnPropertyDescriptor(ctor.prototype, prop)?.set) {
21
+ !Object.getOwnPropertyDescriptor(ctor.prototype, prop)?.set &&
21
22
  defineVirtual(ctor.prototype, column, prop);
22
- }
23
23
  };
24
24
  }
25
- /* ------------------------------------------------------------------ */
25
+ /** Define propiedad virtual con getter/setter para manejo de defaults */
26
26
  function defineVirtual(proto, col, prop) {
27
27
  Object.defineProperty(proto, prop, {
28
28
  get() {
@@ -30,17 +30,22 @@ function defineVirtual(proto, col, prop) {
30
30
  },
31
31
  set(val) {
32
32
  const buf = (this[wrapper_1.STORE] ??= {});
33
- if (val === undefined && col.default !== undefined) {
34
- val = typeof col.default === "function" ? col.default() : col.default;
35
- }
33
+ val =
34
+ val === undefined && col.default !== undefined
35
+ ? typeof col.default === "function"
36
+ ? col.default()
37
+ : col.default
38
+ : val;
36
39
  if (col.mutate)
37
40
  for (const m of col.mutate)
38
41
  val = m(val);
39
42
  if (col.validate) {
40
43
  for (const v of col.validate) {
41
44
  const r = v(val);
42
- if (r !== true)
43
- throw new Error(typeof r === "string" ? r : "Validación fallida");
45
+ r !== true &&
46
+ (() => {
47
+ throw new Error(typeof r === "string" ? r : "Validación fallida");
48
+ })();
44
49
  }
45
50
  }
46
51
  buf[prop] = val;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/decorators/default.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAMH,0BAWC;AAfD,6CAA4E;AAC5E,4CAAgD;AAEhD,mEAAmE;AACnE,SAAwB,OAAO,CAAC,OAAY;IAC1C,OAAO,CAAC,MAAc,EAAE,IAAqB,EAAQ,EAAE;QACrD,MAAM,IAAI,GAAI,MAAc,CAAC,WAAW,CAAC;QACzC,MAAM,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,IAAA,sBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,KAAK,EAAE,IAAI,EAAE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I,GAAG,CAAC,QAAQ,EAAE,CAAC;oBAC7B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;oBACjB,CAAC,KAAK,IAAI;wBACR,CAAC,GAAG,EAAE;4BACJ,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC;wBACpE,CAAC,CAAC,EAAE,CAAC;gBACT,CAAC;YACH,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QAClB,CAAC;QACD,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file index.ts
3
+ * @descripcion Decorador @Index para Partition Key
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Decorador para marcar propiedad como Partition Key */
8
+ export default function Index(): PropertyDecorator;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * @file index.ts
4
+ * @descripcion Decorador @Index para Partition Key
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = Index;
10
+ const wrapper_1 = require("../core/wrapper");
11
+ const naming_1 = require("../utils/naming");
12
+ /** Decorador para marcar propiedad como Partition Key */
13
+ function Index() {
14
+ return (target, prop) => {
15
+ const ctor = target.constructor;
16
+ const entry = (0, wrapper_1.ensureConfig)(ctor, (0, naming_1.toSnakePlural)(ctor.name));
17
+ const already = [...entry.columns.values()].find((c) => c.index);
18
+ already &&
19
+ already !== entry.columns.get(prop) &&
20
+ (() => {
21
+ throw new Error(`La tabla ${ctor.name} ya tiene PartitionKey (${already.name})`);
22
+ })();
23
+ (0, wrapper_1.ensureColumn)(entry, prop, String(prop)).index = true;
24
+ };
25
+ }
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAMH,wBAcC;AAlBD,6CAA6D;AAC7D,4CAAgD;AAEhD,yDAAyD;AACzD,SAAwB,KAAK;IAC3B,OAAO,CAAC,MAAc,EAAE,IAAqB,EAAQ,EAAE;QACrD,MAAM,IAAI,GAAI,MAAc,CAAC,WAAW,CAAC;QACzC,MAAM,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,IAAA,sBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjE,OAAO;YACL,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YACnC,CAAC,GAAG,EAAE;gBACJ,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,CAAC,IAAI,2BAA2B,OAAO,CAAC,IAAI,GAAG,CAChE,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;QACP,IAAA,sBAAY,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file index_sort.ts
3
+ * @descripcion Decorador @IndexSort para Sort Key
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Decorador para marcar propiedad como Sort Key */
8
+ export default function IndexSort(): PropertyDecorator;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * @file index_sort.ts
4
+ * @descripcion Decorador @IndexSort para Sort Key
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = IndexSort;
10
+ const wrapper_1 = require("../core/wrapper");
11
+ const naming_1 = require("../utils/naming");
12
+ /** Decorador para marcar propiedad como Sort Key */
13
+ function IndexSort() {
14
+ return (target, prop) => {
15
+ const ctor = target.constructor;
16
+ const entry = (0, wrapper_1.ensureConfig)(ctor, (0, naming_1.toSnakePlural)(ctor.name));
17
+ ![...entry.columns.values()].some((c) => c.index) &&
18
+ (() => {
19
+ throw new Error(`PartitionKey no definido en ${ctor.name}; declara @Index primero`);
20
+ })();
21
+ const already = [...entry.columns.values()].find((c) => c.indexSort);
22
+ already &&
23
+ already !== entry.columns.get(prop) &&
24
+ (() => {
25
+ throw new Error(`La tabla ${ctor.name} ya tiene SortKey (${already.name})`);
26
+ })();
27
+ (0, wrapper_1.ensureColumn)(entry, prop, String(prop)).indexSort = true;
28
+ };
29
+ }
30
+ //# sourceMappingURL=index_sort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index_sort.js","sourceRoot":"","sources":["../../../src/decorators/index_sort.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAMH,4BAoBC;AAxBD,6CAA6D;AAC7D,4CAAgD;AAEhD,oDAAoD;AACpD,SAAwB,SAAS;IAC/B,OAAO,CAAC,MAAc,EAAE,IAAqB,EAAQ,EAAE;QACrD,MAAM,IAAI,GAAI,MAAc,CAAC,WAAW,CAAC;QACzC,MAAM,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,IAAA,sBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YAC/C,CAAC,GAAG,EAAE;gBACJ,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,CAAC,IAAI,0BAA0B,CACnE,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACrE,OAAO;YACL,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YACnC,CAAC,GAAG,EAAE;gBACJ,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,CAAC,IAAI,sBAAsB,OAAO,CAAC,IAAI,GAAG,CAC3D,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;QACP,IAAA,sBAAY,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file mutate.ts
3
+ * @descripcion Decorador @Mutate para transformaciones
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ import type { Mutate } from "../core/wrapper";
8
+ /** Decorador para aplicar transformaciones automáticas a propiedades */
9
+ export default function Mutate(fn: Mutate): PropertyDecorator;
@@ -1,29 +1,31 @@
1
1
  "use strict";
2
- /*
3
- * Dinamite ORM — @Mutate
4
- * ----------------------
5
- * Registra funciones transformadoras para un campo y virtualiza
6
- * la propiedad si aún no existe.
2
+ /**
3
+ * @file mutate.ts
4
+ * @descripcion Decorador @Mutate para transformaciones
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.default = Mutate;
10
10
  const wrapper_1 = require("../core/wrapper");
11
11
  const naming_1 = require("../utils/naming");
12
+ /** Decorador para aplicar transformaciones automáticas a propiedades */
12
13
  function Mutate(fn) {
13
- if (typeof fn !== "function")
14
- throw new TypeError("@Mutate requiere función");
14
+ typeof fn !== "function" &&
15
+ (() => {
16
+ throw new TypeError("@Mutate requiere función");
17
+ })();
15
18
  return (target, prop) => {
16
19
  const ctor = target.constructor;
17
20
  const entry = (0, wrapper_1.ensureConfig)(ctor, (0, naming_1.toSnakePlural)(ctor.name));
18
21
  const col = (0, wrapper_1.ensureColumn)(entry, prop, String(prop));
19
22
  col.mutate ??= [];
20
23
  col.mutate.push(fn);
21
- if (!Object.getOwnPropertyDescriptor(ctor.prototype, prop)?.set) {
24
+ !Object.getOwnPropertyDescriptor(ctor.prototype, prop)?.set &&
22
25
  defineVirtual(ctor.prototype, col, prop);
23
- }
24
26
  };
25
27
  }
26
- /* ------------------------------------------------------------------ */
28
+ /** Define propiedad virtual con getter/setter para manejo de mutaciones */
27
29
  function defineVirtual(proto, col, prop) {
28
30
  Object.defineProperty(proto, prop, {
29
31
  get() {
@@ -31,17 +33,22 @@ function defineVirtual(proto, col, prop) {
31
33
  },
32
34
  set(val) {
33
35
  const buf = (this[wrapper_1.STORE] ??= {});
34
- if (val === undefined && col.default !== undefined) {
35
- val = typeof col.default === "function" ? col.default() : col.default;
36
- }
36
+ val =
37
+ val === undefined && col.default !== undefined
38
+ ? typeof col.default === "function"
39
+ ? col.default()
40
+ : col.default
41
+ : val;
37
42
  if (col.mutate)
38
43
  for (const m of col.mutate)
39
44
  val = m(val);
40
45
  if (col.validate) {
41
46
  for (const v of col.validate) {
42
47
  const r = v(val);
43
- if (r !== true)
44
- throw new Error(typeof r === "string" ? r : "Validación fallida");
48
+ r !== true &&
49
+ (() => {
50
+ throw new Error(typeof r === "string" ? r : "Validación fallida");
51
+ })();
45
52
  }
46
53
  }
47
54
  buf[prop] = val;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutate.js","sourceRoot":"","sources":["../../../src/decorators/mutate.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAOH,yBAcC;AAlBD,6CAAoE;AACpE,4CAAgD;AAEhD,wEAAwE;AACx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C,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE;wBACf,CAAC,CAAC,GAAG,CAAC,OAAO;oBACf,CAAC,CAAC,GAAG,CAAC;YACV,IAAI,GAAG,CAAC,MAAM;gBAAE,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM;oBAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACzD,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBACjB,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;oBAC7B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;oBACjB,CAAC,KAAK,IAAI;wBACR,CAAC,GAAG,EAAE;4BACJ,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC;wBACpE,CAAC,CAAC,EAAE,CAAC;gBACT,CAAC;YACH,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QAClB,CAAC;QACD,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file name.ts
3
+ * @descripcion Decorador @Name para tablas y columnas
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Decorador para establecer nombres personalizados de tablas y columnas */
8
+ export default function Name(label: string): ClassDecorator & PropertyDecorator;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * @file name.ts
4
+ * @descripcion Decorador @Name para tablas y columnas
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = Name;
10
+ const wrapper_1 = require("../core/wrapper");
11
+ const naming_1 = require("../utils/naming");
12
+ /** Decorador para establecer nombres personalizados de tablas y columnas */
13
+ function Name(label) {
14
+ (!label || typeof label !== "string") &&
15
+ (() => {
16
+ throw new TypeError("@Name requiere una cadena no vacía");
17
+ })();
18
+ return (target, prop) => {
19
+ const ctor = prop === undefined ? target : target.constructor;
20
+ const entry = (0, wrapper_1.ensureConfig)(ctor, (0, naming_1.toSnakePlural)(ctor.name));
21
+ if (prop === undefined) {
22
+ const auto = (0, naming_1.toSnakePlural)(ctor.name);
23
+ entry.name !== auto &&
24
+ entry.name !== label &&
25
+ entry.name &&
26
+ (() => {
27
+ throw new Error(`La clase ${ctor.name} ya tiene un @Name distinto (${entry.name})`);
28
+ })();
29
+ entry.name = label;
30
+ }
31
+ else {
32
+ const col = (0, wrapper_1.ensureColumn)(entry, prop, label);
33
+ col.name &&
34
+ col.name !== label &&
35
+ (() => {
36
+ throw new Error(`La columna '${String(prop)}' ya tiene @Name distinto (${col.name})`);
37
+ })();
38
+ col.name = label;
39
+ }
40
+ };
41
+ }
42
+ //# sourceMappingURL=name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name.js","sourceRoot":"","sources":["../../../src/decorators/name.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAMH,uBAiCC;AArCD,6CAA6D;AAC7D,4CAAgD;AAEhD,4EAA4E;AAC5E,SAAwB,IAAI,CAC1B,KAAa;IAEb,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;QACnC,CAAC,GAAG,EAAE;YACJ,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;QAC5D,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,CAAC,MAAW,EAAE,IAAsB,EAAQ,EAAE;QACnD,MAAM,IAAI,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;QAC9D,MAAM,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,IAAA,sBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,IAAA,sBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtC,KAAK,CAAC,IAAI,KAAK,IAAI;gBACjB,KAAK,CAAC,IAAI,KAAK,KAAK;gBACpB,KAAK,CAAC,IAAI;gBACV,CAAC,GAAG,EAAE;oBACJ,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,CAAC,IAAI,gCAAgC,KAAK,CAAC,IAAI,GAAG,CACnE,CAAC;gBACJ,CAAC,CAAC,EAAE,CAAC;YACP,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC7C,GAAG,CAAC,IAAI;gBACN,GAAG,CAAC,IAAI,KAAK,KAAK;gBAClB,CAAC,GAAG,EAAE;oBACJ,MAAM,IAAI,KAAK,CACb,eAAe,MAAM,CAAC,IAAI,CAAC,8BAA8B,GAAG,CAAC,IAAI,GAAG,CACrE,CAAC;gBACJ,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file not_null.ts
3
+ * @descripcion Decorador @NotNull para validación no-null
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Decorador para validar que el valor no sea nulo, indefinido o string vacío */
8
+ export default function NotNull(): PropertyDecorator;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * @file not_null.ts
4
+ * @descripcion Decorador @NotNull para validación no-null
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.default = NotNull;
13
+ const validate_1 = __importDefault(require("./validate"));
14
+ /** Decorador para validar que el valor no sea nulo, indefinido o string vacío */
15
+ function NotNull() {
16
+ return validate_1.default((value) => value !== null &&
17
+ value !== undefined &&
18
+ (typeof value !== "string" || value.trim() !== ""));
19
+ }
20
+ //# sourceMappingURL=not_null.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not_null.js","sourceRoot":"","sources":["../../../src/decorators/not_null.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAKH,0BAOC;AAVD,0DAAkC;AAElC,iFAAiF;AACjF,SAAwB,OAAO;IAC7B,OAAQ,kBAAgB,CACtB,CAAC,KAAU,EAAE,EAAE,CACb,KAAK,KAAK,IAAI;QACd,KAAK,KAAK,SAAS;QACnB,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CACrD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file primary_key.ts
3
+ * @descripcion Decorador @PrimaryKey para clave primaria compuesta
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Decorador para marcar propiedad como clave primaria compuesta (Index + IndexSort) */
8
+ export default function PrimaryKey(name?: string): PropertyDecorator;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * @file primary_key.ts
4
+ * @descripcion Decorador @PrimaryKey para clave primaria compuesta
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.default = PrimaryKey;
13
+ const index_1 = __importDefault(require("./index"));
14
+ const index_sort_1 = __importDefault(require("./index_sort"));
15
+ /** Decorador para marcar propiedad como clave primaria compuesta (Index + IndexSort) */
16
+ function PrimaryKey(name = "primary") {
17
+ (typeof name !== "string" || !name.trim()) &&
18
+ (() => {
19
+ throw new TypeError("@PrimaryKey requiere un nombre de índice válido");
20
+ })();
21
+ return (target, prop) => {
22
+ (0, index_1.default)()(target, prop);
23
+ (0, index_sort_1.default)()(target, prop);
24
+ };
25
+ }
26
+ //# sourceMappingURL=primary_key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primary_key.js","sourceRoot":"","sources":["../../../src/decorators/primary_key.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAMH,6BASC;AAbD,oDAA4B;AAC5B,8DAAqC;AAErC,wFAAwF;AACxF,SAAwB,UAAU,CAAC,IAAI,GAAG,SAAS;IACjD,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACxC,CAAC,GAAG,EAAE;YACJ,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;QACzE,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,CAAC,MAAc,EAAE,IAAqB,EAAQ,EAAE;QACrD,IAAA,eAAK,GAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtB,IAAA,oBAAS,GAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file updated_at.ts
3
+ * @descripcion Decorador @UpdatedAt para timestamp de actualización
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Decorador para establecer timestamp automático de actualización */
8
+ export default function UpdatedAt(): PropertyDecorator;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @file updated_at.ts
4
+ * @descripcion Decorador @UpdatedAt para timestamp de actualización
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.default = UpdatedAt;
13
+ const mutate_1 = __importDefault(require("./mutate"));
14
+ /** Decorador para establecer timestamp automático de actualización */
15
+ function UpdatedAt() {
16
+ return (0, mutate_1.default)(() => new Date().toISOString());
17
+ }
18
+ //# sourceMappingURL=updated_at.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updated_at.js","sourceRoot":"","sources":["../../../src/decorators/updated_at.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAKH,4BAEC;AALD,sDAA8B;AAE9B,sEAAsE;AACtE,SAAwB,SAAS;IAC/B,OAAO,IAAA,gBAAM,EAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file validate.ts
3
+ * @descripcion Decorador @Validate para validaciones
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Decorador para aplicar validaciones a propiedades */
8
+ export default function Validate(validators: ((v: unknown) => true | string) | ((v: unknown) => true | string)[]): PropertyDecorator;
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
- /*
3
- * Dinamite ORM — @Validate
4
- * ------------------------
5
- * Registra validadores y crea virtual si falta.
2
+ /**
3
+ * @file validate.ts
4
+ * @descripcion Decorador @Validate para validaciones
5
+ * @autor Miguel Alejandro
6
+ * @fecha 2025-01-27
6
7
  */
7
8
  Object.defineProperty(exports, "__esModule", { value: true });
8
9
  exports.default = Validate;
9
10
  const wrapper_1 = require("../core/wrapper");
10
11
  const naming_1 = require("../utils/naming");
12
+ /** Decorador para aplicar validaciones a propiedades */
11
13
  function Validate(validators) {
12
14
  const list = Array.isArray(validators) ? validators : [validators];
13
15
  if (!list.length || list.some((v) => typeof v !== "function")) {
@@ -19,12 +21,11 @@ function Validate(validators) {
19
21
  const col = (0, wrapper_1.ensureColumn)(entry, prop, String(prop));
20
22
  col.validate ??= [];
21
23
  col.validate.push(...list);
22
- if (!Object.getOwnPropertyDescriptor(ctor.prototype, prop)?.set) {
24
+ !Object.getOwnPropertyDescriptor(ctor.prototype, prop)?.set &&
23
25
  defineVirtual(ctor.prototype, col, prop);
24
- }
25
26
  };
26
27
  }
27
- /* ------------------------------------------------------------------ */
28
+ /** Define propiedad virtual con getter/setter para manejo de validaciones */
28
29
  function defineVirtual(proto, col, prop) {
29
30
  Object.defineProperty(proto, prop, {
30
31
  get() {
@@ -32,17 +33,22 @@ function defineVirtual(proto, col, prop) {
32
33
  },
33
34
  set(val) {
34
35
  const buf = (this[wrapper_1.STORE] ??= {});
35
- if (val === undefined && col.default !== undefined) {
36
- val = typeof col.default === "function" ? col.default() : col.default;
37
- }
36
+ val =
37
+ val === undefined && col.default !== undefined
38
+ ? typeof col.default === "function"
39
+ ? col.default()
40
+ : col.default
41
+ : val;
38
42
  if (col.mutate)
39
43
  for (const m of col.mutate)
40
44
  val = m(val);
41
45
  if (col.validate) {
42
46
  for (const v of col.validate) {
43
47
  const r = v(val);
44
- if (r !== true)
45
- throw new Error(typeof r === "string" ? r : "Validación fallida");
48
+ r !== true &&
49
+ (() => {
50
+ throw new Error(typeof r === "string" ? r : "Validación fallida");
51
+ })();
46
52
  }
47
53
  }
48
54
  buf[prop] = val;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/decorators/validate.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAMH,2BAkBC;AAtBD,6CAA4E;AAC5E,4CAAgD;AAEhD,wDAAwD;AACxD,SAAwB,QAAQ,CAC9B,UAEqC;IAErC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACnE,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAA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BACjC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE;wBACf,CAAC,CAAC,GAAG,CAAC,OAAO;oBACf,CAAC,CAAC,GAAG,CAAC;YACV,IAAI,GAAG,CAAC,MAAM;gBAAE,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM;oBAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACzD,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBACjB,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;oBAC7B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;oBACjB,CAAC,KAAK,IAAI;wBACR,CAAC,GAAG,EAAE;4BACJ,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC;wBACpE,CAAC,CAAC,EAAE,CAAC;gBACT,CAAC;YACH,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QAClB,CAAC;QACD,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC"}
@@ -1,11 +1,13 @@
1
- export { connect, default as Table } from "./core/table";
1
+ export { Dynamite } from "./core/client";
2
+ export { default as Table } from "./core/table";
3
+ export { default as CreatedAt } from "./decorators/created_at";
2
4
  export { default as Default } from "./decorators/default";
3
5
  export { default as Index } from "./decorators/index";
4
6
  export { default as IndexSort } from "./decorators/index_sort";
5
7
  export { default as Mutate } from "./decorators/mutate";
6
8
  export { default as Name } from "./decorators/name";
7
- export { default as Validate } from "./decorators/validate";
8
- export { default as CreatedAt } from "./decorators/created_at";
9
9
  export { default as NotNull } from "./decorators/not_null";
10
10
  export { default as PrimaryKey } from "./decorators/primary_key";
11
11
  export { default as UpdatedAt } from "./decorators/updated_at";
12
+ export { default as Validate } from "./decorators/validate";
13
+ export { belongsTo, hasMany } from "./utils/relations";
@@ -3,11 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UpdatedAt = exports.PrimaryKey = exports.NotNull = exports.CreatedAt = exports.Validate = exports.Name = exports.Mutate = exports.IndexSort = exports.Index = exports.Default = exports.Table = exports.connect = void 0;
6
+ exports.hasMany = exports.belongsTo = exports.Validate = exports.UpdatedAt = exports.PrimaryKey = exports.NotNull = exports.Name = exports.Mutate = exports.IndexSort = exports.Index = exports.Default = exports.CreatedAt = exports.Table = exports.Dynamite = void 0;
7
+ // Core classes
8
+ var client_1 = require("./core/client");
9
+ Object.defineProperty(exports, "Dynamite", { enumerable: true, get: function () { return client_1.Dynamite; } });
7
10
  var table_1 = require("./core/table");
8
- Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return table_1.connect; } });
9
11
  Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return __importDefault(table_1).default; } });
10
- // Decoradores
12
+ // Legacy connection removed - use Dynamite class instead
13
+ // Decorators
14
+ var created_at_1 = require("./decorators/created_at");
15
+ Object.defineProperty(exports, "CreatedAt", { enumerable: true, get: function () { return __importDefault(created_at_1).default; } });
11
16
  var default_1 = require("./decorators/default");
12
17
  Object.defineProperty(exports, "Default", { enumerable: true, get: function () { return __importDefault(default_1).default; } });
13
18
  var index_1 = require("./decorators/index");
@@ -18,14 +23,16 @@ var mutate_1 = require("./decorators/mutate");
18
23
  Object.defineProperty(exports, "Mutate", { enumerable: true, get: function () { return __importDefault(mutate_1).default; } });
19
24
  var name_1 = require("./decorators/name");
20
25
  Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return __importDefault(name_1).default; } });
21
- var validate_1 = require("./decorators/validate");
22
- Object.defineProperty(exports, "Validate", { enumerable: true, get: function () { return __importDefault(validate_1).default; } });
23
- var created_at_1 = require("./decorators/created_at");
24
- Object.defineProperty(exports, "CreatedAt", { enumerable: true, get: function () { return __importDefault(created_at_1).default; } });
25
26
  var not_null_1 = require("./decorators/not_null");
26
27
  Object.defineProperty(exports, "NotNull", { enumerable: true, get: function () { return __importDefault(not_null_1).default; } });
27
28
  var primary_key_1 = require("./decorators/primary_key");
28
29
  Object.defineProperty(exports, "PrimaryKey", { enumerable: true, get: function () { return __importDefault(primary_key_1).default; } });
29
30
  var updated_at_1 = require("./decorators/updated_at");
30
31
  Object.defineProperty(exports, "UpdatedAt", { enumerable: true, get: function () { return __importDefault(updated_at_1).default; } });
32
+ var validate_1 = require("./decorators/validate");
33
+ Object.defineProperty(exports, "Validate", { enumerable: true, get: function () { return __importDefault(validate_1).default; } });
34
+ // Relations
35
+ var relations_1 = require("./utils/relations");
36
+ Object.defineProperty(exports, "belongsTo", { enumerable: true, get: function () { return relations_1.belongsTo; } });
37
+ Object.defineProperty(exports, "hasMany", { enumerable: true, get: function () { return relations_1.hasMany; } });
31
38
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,eAAe;AACf,wCAAyC;AAAhC,kGAAA,QAAQ,OAAA;AACjB,sCAAgD;AAAvC,+GAAA,OAAO,OAAS;AAEzB,yDAAyD;AAEzD,aAAa;AACb,sDAA+D;AAAtD,wHAAA,OAAO,OAAa;AAC7B,gDAA0D;AAAjD,mHAAA,OAAO,OAAW;AAC3B,4CAAsD;AAA7C,+GAAA,OAAO,OAAS;AACzB,sDAA+D;AAAtD,wHAAA,OAAO,OAAa;AAC7B,8CAAwD;AAA/C,iHAAA,OAAO,OAAU;AAC1B,0CAAoD;AAA3C,6GAAA,OAAO,OAAQ;AACxB,kDAA2D;AAAlD,oHAAA,OAAO,OAAW;AAC3B,wDAAiE;AAAxD,0HAAA,OAAO,OAAc;AAC9B,sDAA+D;AAAtD,wHAAA,OAAO,OAAa;AAC7B,kDAA4D;AAAnD,qHAAA,OAAO,OAAY;AAE5B,YAAY;AACZ,+CAAuD;AAA9C,sGAAA,SAAS,OAAA;AAAE,oGAAA,OAAO,OAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @file batch-relations.ts
3
+ * @description Optimized batch loading for relations
4
+ * @autor Miguel Alejandro
5
+ * @fecha 2025-01-27
6
+ */
7
+ /** Batch loader para hasMany relations */
8
+ export declare const batchLoadHasMany: (Model: any, parentItems: any[], relation: any) => Promise<Map<any, any>>;
9
+ /** Batch loader para belongsTo relations con cache */
10
+ export declare const batchLoadBelongsTo: (Model: any, parentItems: any[], relation: any) => Promise<Map<any, any>>;
11
+ /** Optimized processIncludes con batch loading */
12
+ export declare const processIncludesBatch: (Model: any, items: any[], include: any, depth?: number) => Promise<any[]>;
13
+ /** Clear expired cache entries */
14
+ export declare const cleanupRelationCache: () => void;