@lastbrain/module-ai 0.1.20 → 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.
- package/dist/api/admin/user-token.d.ts +2 -13
- package/dist/api/admin/user-token.d.ts.map +1 -1
- package/dist/api/admin/user-token.js +4 -4
- package/dist/index.d.ts +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/web/admin/AdminTokenPacksPage.d.ts.map +1 -1
- package/dist/web/components/TextareaGenerative.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/web/admin/UserTokenIdPage.d.ts +0 -6
- package/dist/web/admin/UserTokenIdPage.d.ts.map +0 -1
- package/dist/web/admin/UserTokenIdPage.js +0 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
-
export declare function GET(
|
|
2
|
+
export declare function GET(_request: NextRequest): Promise<NextResponse<{
|
|
3
3
|
users: {
|
|
4
4
|
userId: string;
|
|
5
5
|
email: string;
|
|
@@ -10,18 +10,7 @@ export declare function GET(request: NextRequest): Promise<NextResponse<{
|
|
|
10
10
|
totalUsed: number;
|
|
11
11
|
lastActivity: string | undefined;
|
|
12
12
|
}[];
|
|
13
|
-
transactions:
|
|
14
|
-
id: any;
|
|
15
|
-
userId: any;
|
|
16
|
-
email: string;
|
|
17
|
-
fullName: string | undefined;
|
|
18
|
-
avatarUrl: any;
|
|
19
|
-
amount: any;
|
|
20
|
-
type: any;
|
|
21
|
-
description: any;
|
|
22
|
-
model: any;
|
|
23
|
-
created_at: any;
|
|
24
|
-
}[];
|
|
13
|
+
transactions: any;
|
|
25
14
|
total: number;
|
|
26
15
|
}> | NextResponse<{
|
|
27
16
|
error: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-token.d.ts","sourceRoot":"","sources":["../../../src/api/admin/user-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKxD,wBAAsB,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"user-token.d.ts","sourceRoot":"","sources":["../../../src/api/admin/user-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKxD,wBAAsB,GAAG,CAAC,QAAQ,EAAE,WAAW;;;;;;;;;;;;;;;IA6H9C;AAGD,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW;;;;;;IA+C9C"}
|
|
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
|
|
2
2
|
import { getSupabaseServiceClient } from "@lastbrain/core/server";
|
|
3
3
|
import { addTokens } from "../../server";
|
|
4
4
|
// GET /api/ai/admin/user-token - Liste tous les utilisateurs avec leur balance et transactions
|
|
5
|
-
export async function GET(
|
|
5
|
+
export async function GET(_request) {
|
|
6
6
|
try {
|
|
7
7
|
const supabase = getSupabaseServiceClient();
|
|
8
8
|
// L'authentification et les droits superadmin sont déjà vérifiés par le middleware
|
|
@@ -18,9 +18,10 @@ export async function GET(request) {
|
|
|
18
18
|
.limit(1000);
|
|
19
19
|
if (txError)
|
|
20
20
|
throw txError;
|
|
21
|
+
const txList = transactions || [];
|
|
21
22
|
// Calculer les stats par utilisateur
|
|
22
23
|
const userStatsMap = new Map();
|
|
23
|
-
|
|
24
|
+
txList.forEach((tx) => {
|
|
24
25
|
const stats = userStatsMap.get(tx.owner_id) || {
|
|
25
26
|
balance: 0,
|
|
26
27
|
totalAdded: 0,
|
|
@@ -71,7 +72,7 @@ export async function GET(request) {
|
|
|
71
72
|
};
|
|
72
73
|
});
|
|
73
74
|
// Préparer les transactions avec infos utilisateurs
|
|
74
|
-
const transactionsWithUsers =
|
|
75
|
+
const transactionsWithUsers = txList.map((tx) => {
|
|
75
76
|
const user = authUsers.users.find((u) => u.id === tx.owner_id);
|
|
76
77
|
const profile = profilesMap.get(tx.owner_id);
|
|
77
78
|
return {
|
|
@@ -101,7 +102,6 @@ export async function GET(request) {
|
|
|
101
102
|
// POST /api/ai/admin/user-token - Ajouter/retirer des tokens à un utilisateur
|
|
102
103
|
export async function POST(request) {
|
|
103
104
|
try {
|
|
104
|
-
const supabase = getSupabaseServiceClient();
|
|
105
105
|
// L'authentification et les droits superadmin sont déjà vérifiés par le middleware
|
|
106
106
|
const body = await request.json();
|
|
107
107
|
const { userId, amount, type, reason } = body;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { TextareaGenerative } from "./web/components/TextareaGenerative
|
|
2
|
-
export { ImageGenerative } from "./web/components/ImageGenerative
|
|
3
|
-
export { TokenPage } from "./web/auth/TokenPage
|
|
4
|
-
export { UserTokenPage } from "./web/admin/UserTokenPage
|
|
5
|
-
export { AdminTokenPacksPage } from "./web/admin/AdminTokenPacksPage
|
|
6
|
-
export { UserTokenTab } from "./components/admin/UserTokenTab
|
|
7
|
-
export { Doc } from "./components/Doc
|
|
8
|
-
export { Doc as AiModuleDoc } from "./components/Doc
|
|
9
|
-
export type { GenerativeResponse, TextareaGenerativeProps, } from "./web/components/TextareaGenerative
|
|
10
|
-
export type { GenerativeImageResponse, ImageGenerativeProps, } from "./web/components/ImageGenerative
|
|
11
|
-
export { default as buildConfig } from "./ai.build.config
|
|
1
|
+
export { TextareaGenerative } from "./web/components/TextareaGenerative";
|
|
2
|
+
export { ImageGenerative } from "./web/components/ImageGenerative";
|
|
3
|
+
export { TokenPage } from "./web/auth/TokenPage";
|
|
4
|
+
export { UserTokenPage } from "./web/admin/UserTokenPage";
|
|
5
|
+
export { AdminTokenPacksPage } from "./web/admin/AdminTokenPacksPage";
|
|
6
|
+
export { UserTokenTab } from "./components/admin/UserTokenTab";
|
|
7
|
+
export { Doc } from "./components/Doc";
|
|
8
|
+
export { Doc as AiModuleDoc } from "./components/Doc";
|
|
9
|
+
export type { GenerativeResponse, TextareaGenerativeProps, } from "./web/components/TextareaGenerative";
|
|
10
|
+
export type { GenerativeImageResponse, ImageGenerativeProps, } from "./web/components/ImageGenerative";
|
|
11
|
+
export { default as buildConfig } from "./ai.build.config";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGtD,YAAY,EACV,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,qCAAqC,CAAC;AAE7C,YAAY,EACV,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Client Components - Composants réutilisables
|
|
2
|
-
export { TextareaGenerative } from "./web/components/TextareaGenerative
|
|
3
|
-
export { ImageGenerative } from "./web/components/ImageGenerative
|
|
2
|
+
export { TextareaGenerative } from "./web/components/TextareaGenerative";
|
|
3
|
+
export { ImageGenerative } from "./web/components/ImageGenerative";
|
|
4
4
|
// Pages Auth
|
|
5
|
-
export { TokenPage } from "./web/auth/TokenPage
|
|
5
|
+
export { TokenPage } from "./web/auth/TokenPage";
|
|
6
6
|
// Pages Admin
|
|
7
|
-
export { UserTokenPage } from "./web/admin/UserTokenPage
|
|
8
|
-
export { AdminTokenPacksPage } from "./web/admin/AdminTokenPacksPage
|
|
7
|
+
export { UserTokenPage } from "./web/admin/UserTokenPage";
|
|
8
|
+
export { AdminTokenPacksPage } from "./web/admin/AdminTokenPacksPage";
|
|
9
9
|
// Admin Components - User Tabs
|
|
10
|
-
export { UserTokenTab } from "./components/admin/UserTokenTab
|
|
10
|
+
export { UserTokenTab } from "./components/admin/UserTokenTab";
|
|
11
11
|
// Documentation
|
|
12
|
-
export { Doc } from "./components/Doc
|
|
13
|
-
export { Doc as AiModuleDoc } from "./components/Doc
|
|
12
|
+
export { Doc } from "./components/Doc";
|
|
13
|
+
export { Doc as AiModuleDoc } from "./components/Doc";
|
|
14
14
|
// Configuration de build
|
|
15
|
-
export { default as buildConfig } from "./ai.build.config
|
|
15
|
+
export { default as buildConfig } from "./ai.build.config";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminTokenPacksPage.d.ts","sourceRoot":"","sources":["../../../src/web/admin/AdminTokenPacksPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AdminTokenPacksPage.d.ts","sourceRoot":"","sources":["../../../src/web/admin/AdminTokenPacksPage.tsx"],"names":[],"mappings":"AAyCA,wBAAgB,mBAAmB,4CAyTlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextareaGenerative.d.ts","sourceRoot":"","sources":["../../../src/web/components/TextareaGenerative.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextareaGenerative.d.ts","sourceRoot":"","sources":["../../../src/web/components/TextareaGenerative.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM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tsx"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,CAAC,EAC9B,MAAM,GACP,EAAE;IACD,MAAM,EAAE,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjC,2CAiBA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Card, CardBody, CardHeader } from "@lastbrain/ui";
|
|
4
|
-
import { use } from "react";
|
|
5
|
-
export function UserTokenIdPage({ params, }) {
|
|
6
|
-
const { id } = use(params);
|
|
7
|
-
return (_jsx("div", { className: "container mx-auto p-6", children: _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx("h1", { className: "text-2xl font-bold", children: "D\u00E9tails Token Utilisateur" }) }), _jsx(CardBody, { children: _jsxs("p", { className: "text-default-600", children: ["D\u00E9tails pour l'utilisateur: ", _jsx("strong", { children: id })] }) })] }) }));
|
|
8
|
-
}
|