@ikxvxn/databi-sharedtypes 0.0.42
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/dist/auth.d.ts +43 -0
- package/dist/auth.js +14 -0
- package/dist/company.d.ts +29 -0
- package/dist/company.js +2 -0
- package/dist/defaultTablesByExternalDb.d.ts +8 -0
- package/dist/defaultTablesByExternalDb.js +964 -0
- package/dist/externalDb.d.ts +57 -0
- package/dist/externalDb.js +29 -0
- package/dist/geographic.d.ts +14 -0
- package/dist/geographic.js +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +23 -0
- package/dist/metabase.d.ts +53 -0
- package/dist/metabase.js +14 -0
- package/dist/pagination.d.ts +35 -0
- package/dist/pagination.js +10 -0
- package/dist/queryResult.d.ts +7 -0
- package/dist/queryResult.js +2 -0
- package/package.json +19 -0
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contratos compartidos de autenticación.
|
|
3
|
+
* Usados tanto por el servidor (Express) como por el cliente (Next.js).
|
|
4
|
+
* NO duplicar estos tipos en ninguno de los dos proyectos.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum AuthProviderEnum {
|
|
7
|
+
google = "google",
|
|
8
|
+
local = "local"
|
|
9
|
+
}
|
|
10
|
+
export type AuthProvider = keyof typeof AuthProviderEnum;
|
|
11
|
+
export interface AuthenticatedUser {
|
|
12
|
+
id: string;
|
|
13
|
+
email: string;
|
|
14
|
+
name: string;
|
|
15
|
+
avatarUrl?: string;
|
|
16
|
+
companyId: string;
|
|
17
|
+
roles: string[];
|
|
18
|
+
provider: AuthProvider;
|
|
19
|
+
}
|
|
20
|
+
export type SessionStatus = 'authenticated' | 'unauthenticated';
|
|
21
|
+
export interface AuthSession {
|
|
22
|
+
user: AuthenticatedUser;
|
|
23
|
+
expiresAt: string;
|
|
24
|
+
provider: AuthProvider;
|
|
25
|
+
}
|
|
26
|
+
export interface GetSessionResponse {
|
|
27
|
+
authenticated: boolean;
|
|
28
|
+
session: AuthSession | null;
|
|
29
|
+
}
|
|
30
|
+
export interface LogoutResponse {
|
|
31
|
+
ok: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface GoogleAuthStartResponse {
|
|
34
|
+
redirectUrl: string;
|
|
35
|
+
}
|
|
36
|
+
export interface LocalLoginPayload {
|
|
37
|
+
email: string;
|
|
38
|
+
password: string;
|
|
39
|
+
}
|
|
40
|
+
export interface LoginResponse {
|
|
41
|
+
ok: boolean;
|
|
42
|
+
session: AuthSession;
|
|
43
|
+
}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Contratos compartidos de autenticación.
|
|
4
|
+
* Usados tanto por el servidor (Express) como por el cliente (Next.js).
|
|
5
|
+
* NO duplicar estos tipos en ninguno de los dos proyectos.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AuthProviderEnum = void 0;
|
|
9
|
+
// ─── Proveedor de autenticación ─────────────────────────────────────────────
|
|
10
|
+
var AuthProviderEnum;
|
|
11
|
+
(function (AuthProviderEnum) {
|
|
12
|
+
AuthProviderEnum["google"] = "google";
|
|
13
|
+
AuthProviderEnum["local"] = "local";
|
|
14
|
+
})(AuthProviderEnum || (exports.AuthProviderEnum = AuthProviderEnum = {}));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Types, Document } from 'mongoose';
|
|
2
|
+
export interface IPermission {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface IRole {
|
|
6
|
+
_id: Types.ObjectId;
|
|
7
|
+
name: string;
|
|
8
|
+
permissions: IPermission[];
|
|
9
|
+
}
|
|
10
|
+
export interface IRecipe {
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
queryTemplate: Record<string, any> | any;
|
|
14
|
+
}
|
|
15
|
+
export interface IBusiness {
|
|
16
|
+
_id: Types.ObjectId;
|
|
17
|
+
name: string;
|
|
18
|
+
roles: IRole[];
|
|
19
|
+
accessibleTables: Types.ObjectId[];
|
|
20
|
+
recipes: IRecipe[];
|
|
21
|
+
createdAt: Date;
|
|
22
|
+
}
|
|
23
|
+
export interface ICompany extends Document {
|
|
24
|
+
_id: Types.ObjectId;
|
|
25
|
+
name: string;
|
|
26
|
+
businesses: IBusiness[];
|
|
27
|
+
externalDbs: Types.ObjectId[];
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
}
|
package/dist/company.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TypeOfOriginEnum, IParam } from './externalDb';
|
|
2
|
+
export interface ITablexParamsSuggestions {
|
|
3
|
+
table: string;
|
|
4
|
+
alias: string;
|
|
5
|
+
fields: IParam[];
|
|
6
|
+
progressiveSyncField: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const defaultTablesByExternalDb: Record<TypeOfOriginEnum, ITablexParamsSuggestions[]>;
|