@arcaelas/dynamite 1.0.1 → 1.0.2

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 (65) hide show
  1. package/build/index.d.ts +130 -0
  2. package/build/index.js +1 -1
  3. package/build/index.js.map +4 -4
  4. package/package.json +2 -2
  5. package/tsconfig.json +5 -5
  6. package/build/__tests__/crud.spec.d.ts +0 -1
  7. package/build/__tests__/crud.spec.js +0 -123
  8. package/build/__tests__/crud.spec.js.map +0 -1
  9. package/build/__tests__/decorators.spec.d.ts +0 -1
  10. package/build/__tests__/decorators.spec.js +0 -183
  11. package/build/__tests__/decorators.spec.js.map +0 -1
  12. package/build/__tests__/instance-crud.spec.d.ts +0 -1
  13. package/build/__tests__/instance-crud.spec.js +0 -82
  14. package/build/__tests__/instance-crud.spec.js.map +0 -1
  15. package/build/src/core/table.d.ts +0 -17
  16. package/build/src/core/table.js +0 -223
  17. package/build/src/core/table.js.map +0 -1
  18. package/build/src/core/wrapper.d.ts +0 -47
  19. package/build/src/core/wrapper.js +0 -57
  20. package/build/src/core/wrapper.js.map +0 -1
  21. package/build/src/decorators/created_at.d.ts +0 -4
  22. package/build/src/decorators/created_at.js +0 -22
  23. package/build/src/decorators/created_at.js.map +0 -1
  24. package/build/src/decorators/default.d.ts +0 -1
  25. package/build/src/decorators/default.js +0 -55
  26. package/build/src/decorators/default.js.map +0 -1
  27. package/build/src/decorators/index.d.ts +0 -1
  28. package/build/src/decorators/index.js +0 -24
  29. package/build/src/decorators/index.js.map +0 -1
  30. package/build/src/decorators/index_sort.d.ts +0 -1
  31. package/build/src/decorators/index_sort.js +0 -27
  32. package/build/src/decorators/index_sort.js.map +0 -1
  33. package/build/src/decorators/mutate.d.ts +0 -2
  34. package/build/src/decorators/mutate.js +0 -53
  35. package/build/src/decorators/mutate.js.map +0 -1
  36. package/build/src/decorators/name.d.ts +0 -1
  37. package/build/src/decorators/name.js +0 -41
  38. package/build/src/decorators/name.js.map +0 -1
  39. package/build/src/decorators/not_null.d.ts +0 -4
  40. package/build/src/decorators/not_null.js +0 -28
  41. package/build/src/decorators/not_null.js.map +0 -1
  42. package/build/src/decorators/primary_key.d.ts +0 -7
  43. package/build/src/decorators/primary_key.js +0 -30
  44. package/build/src/decorators/primary_key.js.map +0 -1
  45. package/build/src/decorators/updated_at.d.ts +0 -4
  46. package/build/src/decorators/updated_at.js +0 -23
  47. package/build/src/decorators/updated_at.js.map +0 -1
  48. package/build/src/decorators/validate.d.ts +0 -1
  49. package/build/src/decorators/validate.js +0 -54
  50. package/build/src/decorators/validate.js.map +0 -1
  51. package/build/src/index.d.ts +0 -11
  52. package/build/src/index.js +0 -31
  53. package/build/src/index.js.map +0 -1
  54. package/build/src/utils/naming.d.ts +0 -1
  55. package/build/src/utils/naming.js +0 -18
  56. package/build/src/utils/naming.js.map +0 -1
  57. package/build/tests/crud.spec.d.ts +0 -1
  58. package/build/tests/crud.spec.js +0 -123
  59. package/build/tests/crud.spec.js.map +0 -1
  60. package/build/tests/decorators.spec.d.ts +0 -1
  61. package/build/tests/decorators.spec.js +0 -183
  62. package/build/tests/decorators.spec.js.map +0 -1
  63. package/build/tests/instance-crud.spec.d.ts +0 -1
  64. package/build/tests/instance-crud.spec.js +0 -82
  65. package/build/tests/instance-crud.spec.js.map +0 -1
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- /* __tests__/instance-crud.spec.ts
13
- * ------------------------------------------------------------------
14
- * CRUD usando métodos de **instancia** de Dinamite ORM con DynamoDB Local.
15
- * Se asume que DynamoDB Local está corriendo en http://localhost:7007.
16
- * ------------------------------------------------------------------ */
17
- const src_1 = require("../src");
18
- // ---------- conexión DynamoDB Local ----------
19
- beforeAll(() => (0, src_1.connect)({
20
- region: "local",
21
- endpoint: "http://localhost:7007",
22
- credentials: { accessKeyId: "x", secretAccessKey: "x" },
23
- }));
24
- // ---------- Modelo de prueba ----------
25
- let User = class User extends src_1.Table {
26
- };
27
- __decorate([
28
- (0, src_1.PrimaryKey)(),
29
- __metadata("design:type", String)
30
- ], User.prototype, "id", void 0);
31
- __decorate([
32
- (0, src_1.NotNull)() // ← registra la columna en el wrapper
33
- ,
34
- __metadata("design:type", String)
35
- ], User.prototype, "email", void 0);
36
- __decorate([
37
- (0, src_1.CreatedAt)(),
38
- __metadata("design:type", String)
39
- ], User.prototype, "created", void 0);
40
- __decorate([
41
- (0, src_1.UpdatedAt)(),
42
- __metadata("design:type", String)
43
- ], User.prototype, "updated", void 0);
44
- User = __decorate([
45
- (0, src_1.Name)("users")
46
- ], User);
47
- describe("CRUD Dinamite ORM – instancia", () => {
48
- it("where() antes de existir la tabla → []", async () => {
49
- const rows = await User.where();
50
- expect(rows).toEqual([]);
51
- });
52
- it("save() → crea, update() → modifica, destroy() → elimina", async () => {
53
- /* ---------- save (create) ---------- */
54
- const u = new User({ id: "u1", email: "a@b.com" });
55
- await u.save();
56
- let rows = await User.where();
57
- expect(rows).toHaveLength(1);
58
- expect(rows[0].email).toBe("a@b.com");
59
- const firstCreated = rows[0].created;
60
- const firstUpdated = rows[0].updated;
61
- /* ---------- update ---------- */
62
- await u.update({ email: "c@d.com" });
63
- rows = await User.where();
64
- expect(rows[0].email).toBe("c@d.com");
65
- expect(rows[0].updated).not.toBe(firstUpdated);
66
- expect(rows[0].created).toBe(firstCreated);
67
- /* ---------- destroy ---------- */
68
- await u.destroy();
69
- rows = await User.where();
70
- expect(rows).toEqual([]);
71
- });
72
- it("la tabla realmente contiene el ítem mientras existe", async () => {
73
- const u = new User({ id: "u2", email: "real@test.com" });
74
- await u.save();
75
- let rows = await User.where();
76
- expect(rows.map((x) => x.id)).toContain("u2");
77
- await u.destroy();
78
- rows = await User.where();
79
- expect(rows.map((x) => x.id)).not.toContain("u2");
80
- });
81
- });
82
- //# sourceMappingURL=instance-crud.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"instance-crud.spec.js","sourceRoot":"","sources":["../../__tests__/instance-crud.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;wEAIwE;AACxE,gCAQgB;AAEhB,gDAAgD;AAChD,SAAS,CAAC,GAAG,EAAE,CACb,IAAA,aAAO,EAAC;IACN,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,uBAAuB;IACjC,WAAW,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE;CACxD,CAAC,CACH,CAAC;AAEF,yCAAyC;AAEzC,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,WAAK;CAYvB,CAAA;AAVS;IADP,IAAA,gBAAU,GAAE;;gCACM;AAGX;IADP,IAAA,aAAO,GAAE,CAAC,sCAAsC;;;mCAC3B;AAGd;IADP,IAAA,eAAS,GAAE;;qCACY;AAGhB;IADP,IAAA,eAAS,GAAE;;qCACY;AAXpB,IAAI;IADT,IAAA,UAAI,EAAC,OAAO,CAAC;GACR,IAAI,CAYT;AAED,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IA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,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;QACnE,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;QACzD,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAEf,IAAI,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE9C,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { DynamoDBClientConfig } from "@aws-sdk/client-dynamodb";
2
- import { STORE, WrapperEntry } from "./wrapper";
3
- export declare function connect(cfg: DynamoDBClientConfig): void;
4
- export default class Table<T extends object = object> {
5
- private [STORE];
6
- constructor(data?: Partial<T>);
7
- toJSON(): Record<string, unknown>;
8
- save(): Promise<this>;
9
- update(patch: Partial<T>): Promise<this>;
10
- destroy(): Promise<void>;
11
- static create<M extends Table>(this: new (d?: Partial<M>) => M, data: Partial<M>): Promise<M>;
12
- static update<M extends Table>(this: new (d?: Partial<M>) => M, id: string, record: Partial<M>): Promise<void>;
13
- static destroy<M extends Table>(this: new () => M, id: string): Promise<null>;
14
- static where<M extends Table>(this: new (d?: any) => M): Promise<M[]>;
15
- }
16
- export { STORE };
17
- export type { WrapperEntry };
@@ -1,223 +0,0 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.STORE = void 0;
37
- exports.connect = connect;
38
- /* src/core/table.ts
39
- * Dinamite ORM — runtime
40
- * --------------------------------------------------
41
- * CRUD + autocreación de tablas (DynamoDB v3)
42
- * Serialización estricta mediante toJSON()
43
- * © 2025 Miguel Alejandro
44
- */
45
- const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
46
- const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
47
- const wrapper_1 = __importStar(require("./wrapper"));
48
- Object.defineProperty(exports, "STORE", { enumerable: true, get: function () { return wrapper_1.STORE; } });
49
- /* ────────────────────────── Conexión global ────────────────────────── */
50
- let client;
51
- function connect(cfg) {
52
- client = new client_dynamodb_1.DynamoDBClient(cfg);
53
- }
54
- /* ─────────── Creación automática de tablas a partir del wrapper ────── */
55
- async function createTable(ctor) {
56
- if (!client)
57
- throw new Error("connect() no llamado");
58
- const meta = wrapper_1.default.get(ctor);
59
- if (!meta)
60
- throw new Error(`Clase ${ctor.name} no registrada en wrapper`);
61
- const cols = [...meta.columns.values()];
62
- const pk = cols.find((c) => c.index);
63
- if (!pk)
64
- throw new Error(`PartitionKey faltante en ${ctor.name}`);
65
- const sk = cols.find((c) => c.indexSort);
66
- const attr = new Map();
67
- attr.set(pk.name, "S");
68
- if (sk)
69
- attr.set(sk.name, "S");
70
- const schema = [{ AttributeName: pk.name, KeyType: "HASH" }];
71
- if (sk && sk.name !== pk.name)
72
- schema.push({ AttributeName: sk.name, KeyType: "RANGE" });
73
- await client.send(new client_dynamodb_1.CreateTableCommand({
74
- TableName: meta.name,
75
- BillingMode: "PAY_PER_REQUEST",
76
- AttributeDefinitions: [...attr].map(([AttributeName, AttributeType]) => ({
77
- AttributeName,
78
- AttributeType,
79
- })),
80
- KeySchema: schema,
81
- }));
82
- }
83
- /* ────────────────────────────── Table ──────────────────────────────── */
84
- class Table {
85
- constructor(data = {}) {
86
- requireClient();
87
- const meta = mustMeta(Object.getPrototypeOf(this).constructor);
88
- /* defaults via setters */
89
- meta.columns.forEach((c) => {
90
- if (!(c.name in data))
91
- this[c.name] = undefined;
92
- });
93
- Object.assign(this, data);
94
- }
95
- /* -------- serializa SOLO columnas válidas -------- */
96
- toJSON() {
97
- const meta = mustMeta(Object.getPrototypeOf(this).constructor);
98
- const buf = this[wrapper_1.STORE] ?? {};
99
- const out = {};
100
- for (const [prop, col] of meta.columns) {
101
- if (prop in buf)
102
- out[col.name] = buf[prop];
103
- else if (prop in this)
104
- out[col.name] = this[prop];
105
- }
106
- return out;
107
- }
108
- /* ────────────── Métodos de instancia ────────────── */
109
- async save() {
110
- // @ts-ignore
111
- const id = this.id;
112
- const Ctor = this.constructor;
113
- const record = this.toJSON();
114
- if (id === undefined || id === null) {
115
- delete record.id;
116
- const fresh = await Ctor.create(record);
117
- Object.assign(this, fresh);
118
- }
119
- else {
120
- await Ctor.update(String(id), record);
121
- }
122
- return this;
123
- }
124
- async update(patch) {
125
- // @ts-ignore
126
- const id = this.id;
127
- if (id === undefined || id === null)
128
- throw new Error("update() requiere id");
129
- Object.assign(this, patch);
130
- const Ctor = this.constructor;
131
- await Ctor.update(String(id), this.toJSON());
132
- return this;
133
- }
134
- async destroy() {
135
- // @ts-ignore
136
- const id = this.id;
137
- if (id === undefined || id === null)
138
- throw new Error("destroy() requiere id");
139
- const Ctor = this.constructor;
140
- await Ctor.destroy(String(id));
141
- }
142
- /* ─────────────── CRUD estáticos ──────────────── */
143
- static async create(data) {
144
- const meta = mustMeta(this);
145
- const payload = new this(data).toJSON(); // filtrado
146
- const put = () => client.send(new client_dynamodb_1.PutItemCommand({
147
- TableName: meta.name,
148
- Item: (0, util_dynamodb_1.marshall)(payload, { removeUndefinedValues: true }),
149
- }));
150
- try {
151
- await put();
152
- }
153
- catch (err) {
154
- if (err?.name === "ResourceNotFoundException") {
155
- await createTable(this);
156
- await put();
157
- }
158
- else
159
- throw err;
160
- }
161
- return new this(data);
162
- }
163
- static async update(id, record // ← ya es JSON completo desde instancia
164
- ) {
165
- const meta = mustMeta(this);
166
- const payload = { ...record, id };
167
- const put = () => client.send(new client_dynamodb_1.PutItemCommand({
168
- TableName: meta.name,
169
- Item: (0, util_dynamodb_1.marshall)(payload, { removeUndefinedValues: true }),
170
- }));
171
- try {
172
- await put();
173
- }
174
- catch (err) {
175
- if (err?.name === "ResourceNotFoundException") {
176
- await createTable(this);
177
- await put();
178
- }
179
- else
180
- throw err;
181
- }
182
- }
183
- static async destroy(id) {
184
- requireClient();
185
- try {
186
- await client.send(new client_dynamodb_1.DeleteItemCommand({
187
- TableName: mustMeta(this).name,
188
- Key: (0, util_dynamodb_1.marshall)({ id }),
189
- }));
190
- }
191
- catch (err) {
192
- if (err.name === "ResourceNotFoundException")
193
- return null;
194
- throw err;
195
- }
196
- return null;
197
- }
198
- static async where() {
199
- requireClient();
200
- try {
201
- const res = await client.send(new client_dynamodb_1.ScanCommand({ TableName: mustMeta(this).name }));
202
- return (res.Items ?? []).map((i) => new this((0, util_dynamodb_1.unmarshall)(i)));
203
- }
204
- catch (err) {
205
- if (err.name === "ResourceNotFoundException")
206
- return [];
207
- throw err;
208
- }
209
- }
210
- }
211
- exports.default = Table;
212
- /* ─────────────────── Utilidades internas ─────────────────── */
213
- function requireClient() {
214
- if (!client)
215
- throw new Error("connect() debe llamarse antes de usar Table");
216
- }
217
- function mustMeta(ctor) {
218
- const meta = wrapper_1.default.get(ctor);
219
- if (!meta)
220
- throw new Error(`Metadata no encontrada para ${ctor.name}`);
221
- return meta;
222
- }
223
- //# sourceMappingURL=table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/core/table.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,0BAEC;AAtBD;;;;;;GAMG;AACH,8DAOkC;AAClC,0DAA8D;AAC9D,qDAAyD;AAgNhD,sFAhNS,eAAK,OAgNT;AA9Md,2EAA2E;AAC3E,IAAI,MAAkC,CAAC;AACvC,SAAgB,OAAO,CAAC,GAAyB;IAC/C,MAAM,GAAG,IAAI,gCAAc,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAED,2EAA2E;AAC3E,KAAK,UAAU,WAAW,CAAC,IAAc;IACvC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,iBAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,2BAA2B,CAAC,CAAC;IAE1E,MAAM,IAAI,GAAG,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AAC;CACF;AAxJD,wBAwJC;AAED,iEAAiE;AACjE,SAAS,aAAa;IACpB,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAC9E,CAAC;AACD,SAAS,QAAQ,CAAC,IAAc;IAC9B,MAAM,IAAI,GAAG,iBAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,47 +0,0 @@
1
- export type Inmutable = string | number | boolean | null | object;
2
- export type Mutate = (value: any) => Inmutable;
3
- export type Default = Inmutable | (() => Inmutable);
4
- export type Validate = (value: any) => true | string;
5
- export interface Column {
6
- /** nombre físico en la tabla (DynamoDB) */
7
- name: string;
8
- default?: Default;
9
- mutate?: Mutate[];
10
- validate?: Validate[];
11
- index?: true;
12
- indexSort?: true;
13
- unique?: true;
14
- }
15
- /**
16
- * Configuración completa por tabla
17
- */
18
- export interface WrapperEntry {
19
- /** Nombre físico de la tabla (snake_plural o @Name) */
20
- name: string;
21
- /** Columnas asociadas a la clase. key = propiedad (string|symbol) */
22
- columns: Map<string | symbol, Column>;
23
- }
24
- export type Wrapper = Map<Function, WrapperEntry>;
25
- /**
26
- * Mapa singleton (clase → configuración)
27
- * Exportado como default para uso interno de la librería.
28
- */
29
- declare const wrapper: Wrapper;
30
- export default wrapper;
31
- /**
32
- * Buffer privado en cada instancia de Table donde se guardan
33
- * los valores procesados por los setters virtuales.
34
- *
35
- * Se exporta para que los decoradores puedan leer/escribir,
36
- * pero **NO** se vuelve a exportar desde la raíz del paquete.
37
- */
38
- export declare const STORE: unique symbol;
39
- /**
40
- * Asegura que exista la entrada en el wrapper para la clase dada.
41
- * Devuelve la entrada (recién creada o existente).
42
- */
43
- export declare function ensureConfig(ctor: Function, tableName: string): WrapperEntry;
44
- /**
45
- * Obtiene (o crea) el objeto Column para una propiedad concreta.
46
- */
47
- export declare function ensureColumn(entry: WrapperEntry, prop: string | symbol, columnName: string): Column;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- /* src/core/wrapper.ts
3
- * -------------------------------------------------
4
- * Registro central (in-memory) de la configuración
5
- * declarativa de cada modelo. Agnóstico: no depende
6
- * de DynamoDB ni de otros módulos de la librería.
7
- *
8
- * © 2025 Miguel Alejandro
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.STORE = void 0;
12
- exports.ensureConfig = ensureConfig;
13
- exports.ensureColumn = ensureColumn;
14
- /**
15
- * Mapa singleton (clase → configuración)
16
- * Exportado como default para uso interno de la librería.
17
- */
18
- const wrapper = new Map();
19
- exports.default = wrapper;
20
- /* ------------------------------------------------------------------ */
21
- /* 4. Símbolo de almacenamiento de valores reales */
22
- /* ------------------------------------------------------------------ */
23
- /**
24
- * Buffer privado en cada instancia de Table donde se guardan
25
- * los valores procesados por los setters virtuales.
26
- *
27
- * Se exporta para que los decoradores puedan leer/escribir,
28
- * pero **NO** se vuelve a exportar desde la raíz del paquete.
29
- */
30
- exports.STORE = Symbol("dynamite:values");
31
- /* ------------------------------------------------------------------ */
32
- /* 5. Pequeños helpers opcionales */
33
- /* ------------------------------------------------------------------ */
34
- /**
35
- * Asegura que exista la entrada en el wrapper para la clase dada.
36
- * Devuelve la entrada (recién creada o existente).
37
- */
38
- function ensureConfig(ctor, tableName) {
39
- let entry = wrapper.get(ctor);
40
- if (!entry) {
41
- entry = { name: tableName, columns: new Map() };
42
- wrapper.set(ctor, entry);
43
- }
44
- return entry;
45
- }
46
- /**
47
- * Obtiene (o crea) el objeto Column para una propiedad concreta.
48
- */
49
- function ensureColumn(entry, prop, columnName) {
50
- let col = entry.columns.get(prop);
51
- if (!col) {
52
- col = { name: columnName, mutate: [], validate: [] };
53
- entry.columns.set(prop, col);
54
- }
55
- return col;
56
- }
57
- //# sourceMappingURL=wrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../src/core/wrapper.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAwEH,oCAOC;AAKD,oCAWC;AAlDD;;;GAGG;AACH,MAAM,OAAO,GAAY,IAAI,GAAG,EAAE,CAAC;AACnC,kBAAe,OAAO,CAAC;AAEvB,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE;;;;;;GAMG;AACU,QAAA,KAAK,GAAkB,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAE9D,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAc,EAAE,SAAiB;IAC5D,IAAI,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAC1B,KAAmB,EACnB,IAAqB,EACrB,UAAkB;IAElB,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QACrD,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,4 +0,0 @@
1
- /**
2
- * Asigna automáticamente la fecha de creación en nuevas instancias.
3
- */
4
- export default function CreatedAt(): PropertyDecorator;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- /*
3
- * Dinamite ORM — @CreatedAt Decorator (wrapper)
4
- * -------------------------------------------
5
- * Establece un valor por defecto con la fecha/hora actual (ISO‑string)
6
- * usando @Default.
7
- *
8
- * © 2025 Miguel Alejandro
9
- */
10
- var __importDefault = (this && this.__importDefault) || function (mod) {
11
- return (mod && mod.__esModule) ? mod : { "default": mod };
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.default = CreatedAt;
15
- const default_1 = __importDefault(require("./default"));
16
- /**
17
- * Asigna automáticamente la fecha de creación en nuevas instancias.
18
- */
19
- function CreatedAt() {
20
- return (0, default_1.default)(() => new Date().toISOString());
21
- }
22
- //# sourceMappingURL=created_at.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"created_at.js","sourceRoot":"","sources":["../../../src/decorators/created_at.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAOH,4BAEC;AAPD,wDAAgC;AAEhC;;GAEG;AACH,SAAwB,SAAS;IAC/B,OAAO,IAAA,iBAAO,EAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACjD,CAAC"}
@@ -1 +0,0 @@
1
- export default function Default(factory: () => unknown): PropertyDecorator;
@@ -1,55 +0,0 @@
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.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.default = Default;
10
- const wrapper_1 = require("../core/wrapper");
11
- const naming_1 = require("../utils/naming");
12
- function Default(factory) {
13
- if (typeof factory !== "function") {
14
- throw new TypeError("@Default requiere una función factory");
15
- }
16
- return (target, prop) => {
17
- const ctor = target.constructor;
18
- const entry = (0, wrapper_1.ensureConfig)(ctor, (0, naming_1.toSnakePlural)(ctor.name));
19
- const column = (0, wrapper_1.ensureColumn)(entry, prop, String(prop));
20
- if (column.default)
21
- throw new Error(`@Default duplicado en '${String(prop)}'`);
22
- column.default = factory;
23
- if (!Object.getOwnPropertyDescriptor(ctor.prototype, prop)?.set) {
24
- defineVirtual(ctor.prototype, column, prop);
25
- }
26
- };
27
- }
28
- /* ------------------------------------------------------------------ */
29
- function defineVirtual(proto, col, prop) {
30
- Object.defineProperty(proto, prop, {
31
- get() {
32
- return (this[wrapper_1.STORE] ?? {})[prop];
33
- },
34
- set(val) {
35
- const buf = (this[wrapper_1.STORE] ??= {});
36
- if (val === undefined && col.default !== undefined) {
37
- val = typeof col.default === "function" ? col.default() : col.default;
38
- }
39
- if (col.mutate)
40
- for (const m of col.mutate)
41
- val = m(val);
42
- if (col.validate) {
43
- for (const v of col.validate) {
44
- const r = v(val);
45
- if (r !== true)
46
- throw new Error(typeof r === "string" ? r : "Validación fallida");
47
- }
48
- }
49
- buf[prop] = val;
50
- },
51
- enumerable: true,
52
- configurable: true,
53
- });
54
- }
55
- //# sourceMappingURL=default.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/decorators/default.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAKH,0BAkBC;AArBD,6CAA4E;AAC5E,4CAAgD;AAEhD,SAAwB,OAAO,CAAC,OAAsB;IACpD,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;IAC/D,CAAC;IAED,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,MAAM,CAAC,IAAI,C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AAC,CAAC;oBACjB,IAAI,CAAC,KAAK,IAAI;wBACZ,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC;gBACtE,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 +0,0 @@
1
- export default function Index(): PropertyDecorator;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /*
3
- * Dinamite ORM — @Index (Partition Key)
4
- * -------------------------------------
5
- * Marca la propiedad como clave de partición.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.default = Index;
9
- const wrapper_1 = require("../core/wrapper");
10
- const naming_1 = require("../utils/naming");
11
- function Index() {
12
- return (target, prop) => {
13
- const ctor = target.constructor;
14
- const entry = (0, wrapper_1.ensureConfig)(ctor, (0, naming_1.toSnakePlural)(ctor.name));
15
- /* Evitar duplicados */
16
- const already = [...entry.columns.values()].find((c) => c.index);
17
- if (already && already !== entry.columns.get(prop)) {
18
- throw new Error(`La tabla ${ctor.name} ya tiene PartitionKey (${already.name})`);
19
- }
20
- const col = (0, wrapper_1.ensureColumn)(entry, prop, String(prop));
21
- col.index = true;
22
- };
23
- }
24
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAKH,wBAgBC;AAnBD,6CAA6D;AAC7D,4CAAgD;AAEhD,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;QAE3D,uBAAuB;QACvB,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,IAAI,OAAO,IAAI,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,CAAC,IAAI,2BAA2B,OAAO,CAAC,IAAI,GAAG,CAChE,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACpD,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- export default function IndexSort(): PropertyDecorator;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /*
3
- * Dinamite ORM — @IndexSort (Sort Key)
4
- * ------------------------------------
5
- * Marca la propiedad como clave de ordenamiento.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.default = IndexSort;
9
- const wrapper_1 = require("../core/wrapper");
10
- const naming_1 = require("../utils/naming");
11
- function IndexSort() {
12
- return (target, prop) => {
13
- const ctor = target.constructor;
14
- const entry = (0, wrapper_1.ensureConfig)(ctor, (0, naming_1.toSnakePlural)(ctor.name));
15
- const pkExists = [...entry.columns.values()].some((c) => c.index);
16
- if (!pkExists) {
17
- throw new Error(`PartitionKey no definido en ${ctor.name}; declara @Index primero`);
18
- }
19
- const already = [...entry.columns.values()].find((c) => c.indexSort);
20
- if (already && already !== entry.columns.get(prop)) {
21
- throw new Error(`La tabla ${ctor.name} ya tiene SortKey (${already.name})`);
22
- }
23
- const col = (0, wrapper_1.ensureColumn)(entry, prop, String(prop));
24
- col.indexSort = true;
25
- };
26
- }
27
- //# sourceMappingURL=index_sort.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index_sort.js","sourceRoot":"","sources":["../../../src/decorators/index_sort.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAKH,4BAsBC;AAzBD,6CAA6D;AAC7D,4CAAgD;AAEhD,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;QAE3D,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,CAAC,IAAI,0BAA0B,CACnE,CAAC;QACJ,CAAC;QAED,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,IAAI,OAAO,IAAI,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,CAAC,IAAI,sBAAsB,OAAO,CAAC,IAAI,GAAG,CAC3D,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACpD,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { Mutate } from "../core/wrapper";
2
- export default function Mutate(fn: Mutate): PropertyDecorator;