@arcaelas/dynamite 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -45,16 +45,7 @@
45
45
  "docs": "mkdocs gh-deploy --force",
46
46
  "deploy": "npm version patch && npm publish --access=public",
47
47
  "prepublishOnly": "yarn build",
48
- "postpublish": "find src -type f \\( -name '*.js' -o -name '*.d.ts' -o -name '*.map' \\) -delete",
49
- "seed:generate": "tsx scripts/generate_seed.ts",
50
- "seed:load": "tsx scripts/load_seed.ts",
51
- "seed:full": "yarn seed:generate && yarn seed:load",
52
- "test": "yarn test:db:start && yarn test:run; yarn test:db:stop",
53
- "test:run": "NODE_OPTIONS='--expose-gc' tsx --tsconfig tsx.config.json src/index.test.ts",
54
- "test:watch": "yarn test:db:start && NODE_OPTIONS='--expose-gc' tsx watch src/index.test.ts",
55
- "test:db:start": "docker run -d -p 8000:8000 --name dynamite-test-db amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb || echo 'DynamoDB ya está corriendo'",
56
- "test:db:stop": "docker stop dynamite-test-db && docker rm dynamite-test-db || true",
57
- "test:db:clean": "docker stop dynamite-test-db && docker rm dynamite-test-db; docker run -d -p 8000:8000 --name dynamite-test-db amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb"
48
+ "postpublish": "find src -type f \\( -name '*.js' -o -name '*.d.ts' -o -name '*.map' \\) -delete"
58
49
  },
59
- "version": "1.0.23"
50
+ "version": "1.0.25"
60
51
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * @file load_seed.ts
3
- * @description Carga archivos JSON de seed en DynamoDB con inserción por lotes
4
- */
5
- export declare function load_all(): Promise<void>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- /**
3
- * @file load_seed.ts
4
- * @description Carga archivos JSON de seed en DynamoDB con inserción por lotes
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.load_all = load_all;
8
- const promises_1 = require("fs/promises");
9
- const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
10
- const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
11
- const client_1 = require("../src/core/client");
12
- async function load_file(filepath, table_name) {
13
- const file_content = await (0, promises_1.readFile)(filepath, "utf-8");
14
- const json = JSON.parse(file_content);
15
- const client = (0, client_1.requireClient)();
16
- console.log(` Total records: ${json.count}`);
17
- for (let i = 0; i < json.data.length; i += 25) {
18
- const chunk = json.data.slice(i, i + 25);
19
- await Promise.all(chunk.map((item) => client.send(new client_dynamodb_1.PutItemCommand({
20
- TableName: table_name,
21
- Item: (0, util_dynamodb_1.marshall)(item, { removeUndefinedValues: true }),
22
- }))));
23
- if ((i + 25) % 1000 === 0 || i + 25 >= json.data.length) {
24
- const loaded = Math.min(i + 25, json.data.length);
25
- console.log(` Loaded ${loaded}/${json.count} records...`);
26
- }
27
- }
28
- return json.count;
29
- }
30
- async function load_all() {
31
- console.log("📦 Loading seed data into DynamoDB...\n");
32
- const start_time = Date.now();
33
- const loads = [
34
- { file: "/tmp/dynamite_seed_users.json", table: "test_users" },
35
- { file: "/tmp/dynamite_seed_categories.json", table: "test_categories" },
36
- { file: "/tmp/dynamite_seed_roles.json", table: "test_roles" },
37
- { file: "/tmp/dynamite_seed_products.json", table: "test_products" },
38
- { file: "/tmp/dynamite_seed_orders.json", table: "test_orders" },
39
- ];
40
- for (const { file, table } of loads) {
41
- console.log(`\n📄 Loading ${file}...`);
42
- const count = await load_file(file, table);
43
- console.log(`✅ Loaded ${count} records into ${table}`);
44
- }
45
- const elapsed = ((Date.now() - start_time) / 1000).toFixed(2);
46
- console.log(`\n✅ Seed loading complete in ${elapsed}s`);
47
- }
48
- if (require.main === module) {
49
- load_all().catch((error) => {
50
- console.error("❌ Error loading seed data:", error);
51
- process.exit(1);
52
- });
53
- }
54
- //# sourceMappingURL=load_seed.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * @file index.test.ts
3
- * @description Test suite para Dynamite ORM
4
- * @run tsx --tsconfig tsx.config.json src/index.test.ts
5
- */
6
- export {};