types-nora-api 0.0.1 → 0.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 (2) hide show
  1. package/entidades.ts +22 -0
  2. package/package.json +2 -2
package/entidades.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { readdirSync } from "fs";
2
+ import { join, extname, basename } from "path";
3
+
4
+ // Caminho absoluto para o diretório de entidades
5
+ const modulesPath = join(__dirname, "../src/modules");
6
+
7
+ // Lê todas as entidades automaticamente
8
+ const entityFiles = readdirSync(modulesPath, { withFileTypes: true })
9
+ .flatMap((dir) =>
10
+ dir.isDirectory()
11
+ ? readdirSync(join(modulesPath, dir.name))
12
+ .filter((file) => file.endsWith(".entity.ts"))
13
+ .map((file) => join(modulesPath, dir.name, file))
14
+ : []
15
+ );
16
+
17
+ // Importa dinamicamente todas as entidades
18
+ const entities = entityFiles.map((file) => require(file)[basename(file, extname(file))]);
19
+
20
+ // Exporta todas as entidades encontradas
21
+ export default entities;
22
+ export { entities };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "types-nora-api",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Tipagem da Nora-Api compartilhada com o universodomedo.com",
5
5
  "types": "./index.d.ts",
6
6
  "files": [
7
7
  "index.d.ts",
8
- "entities"
8
+ "entidades.ts"
9
9
  ],
10
10
  "devDependencies": {
11
11
  "typescript": "^5.7.3"