zeti-framework-backend 0.2.4 → 0.2.5
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/README.md +0 -0
- package/dist/chunk-VW7PIVLA.js +64 -0
- package/dist/chunk-VW7PIVLA.js.map +1 -0
- package/dist/index.d.ts +2 -54
- package/dist/index.js +4 -59
- package/dist/index.js.map +1 -1
- package/dist/prisma/index.d.ts +59 -0
- package/dist/prisma/index.js +10 -0
- package/dist/prisma/index.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { a as ZetiConfigInternal } from '../config-VWgz0Iq_.js';
|
|
2
|
+
import 'hono';
|
|
3
|
+
import 'ioredis';
|
|
4
|
+
import 'hono/http-exception';
|
|
5
|
+
|
|
6
|
+
interface PrismaConfigOptions {
|
|
7
|
+
/** Caminho do schema. Default: "prisma/schema.prisma" */
|
|
8
|
+
schema?: string;
|
|
9
|
+
/** Caminho das migrations. Default: "prisma/migrations" */
|
|
10
|
+
migrationsPath?: string;
|
|
11
|
+
}
|
|
12
|
+
interface PrismaDefineConfig {
|
|
13
|
+
schema: string;
|
|
14
|
+
migrations: {
|
|
15
|
+
path: string;
|
|
16
|
+
};
|
|
17
|
+
datasource: {
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gera a configuração do Prisma.
|
|
23
|
+
*
|
|
24
|
+
* Aceita opcionalmente um ZetiConfig, mas NÃO É NECESSÁRIO passá-lo.
|
|
25
|
+
* A função busca automaticamente a URL do banco no .env.
|
|
26
|
+
*
|
|
27
|
+
* @example Uso simples (recomendado para evitar importar zeti.config.ts)
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // prisma.config.ts
|
|
30
|
+
* import { definePrismaConfig } from "zeti-framework";
|
|
31
|
+
*
|
|
32
|
+
* export default definePrismaConfig();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Uso com config (opcional)
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // prisma.config.ts
|
|
38
|
+
* import { zetiConfig } from "./zeti.config";
|
|
39
|
+
* import { definePrismaConfig } from "zeti-framework";
|
|
40
|
+
*
|
|
41
|
+
* export default definePrismaConfig(zetiConfig);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare function definePrismaConfig(zetiConfigOrOptions?: ZetiConfigInternal | PrismaConfigOptions, options?: PrismaConfigOptions): PrismaDefineConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Retorna todas as URLs de banco de dados configuradas (para multi-tenant migrations).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const urls = getAllDatabaseUrls(zetiConfig);
|
|
51
|
+
* for (const [name, url] of Object.entries(urls)) {
|
|
52
|
+
* console.log(`Migrating ${name}...`);
|
|
53
|
+
* // executar migration para cada tenant
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function getAllDatabaseUrls(zetiConfig: ZetiConfigInternal): Record<string, string>;
|
|
58
|
+
|
|
59
|
+
export { type PrismaConfigOptions, definePrismaConfig, getAllDatabaseUrls };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zeti-framework-backend",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Framework Hono com suporte a multi-tenancy, Prisma e Swagger automático",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
"import": "./dist/scripts/index.js",
|
|
26
26
|
"types": "./dist/scripts/index.d.ts"
|
|
27
27
|
},
|
|
28
|
+
"./prisma": {
|
|
29
|
+
"import": "./dist/prisma/index.js",
|
|
30
|
+
"types": "./dist/prisma/index.d.ts"
|
|
31
|
+
},
|
|
28
32
|
"./cli": {
|
|
29
33
|
"import": "./dist/cli/index.js",
|
|
30
34
|
"types": "./dist/cli/index.d.ts"
|