@decido/shell-vscode-core 1.0.0 → 4.0.1
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/CHANGELOG.md +31 -0
- package/README.md +31 -0
- package/package.json +2 -2
- package/dist/appState.d.ts +0 -23
- package/dist/appState.d.ts.map +0 -1
- package/dist/appState.js +0 -138
- package/dist/core/AIService.d.ts +0 -33
- package/dist/core/AIService.d.ts.map +0 -1
- package/dist/core/AIService.js +0 -73
- package/dist/core/ApiService.d.ts +0 -34
- package/dist/core/ApiService.d.ts.map +0 -1
- package/dist/core/ApiService.js +0 -32
- package/dist/core/AuthService.d.ts +0 -31
- package/dist/core/AuthService.d.ts.map +0 -1
- package/dist/core/AuthService.js +0 -56
- package/dist/core/BaseService.d.ts +0 -29
- package/dist/core/BaseService.d.ts.map +0 -1
- package/dist/core/BaseService.js +0 -33
- package/dist/core/CalendarService.d.ts +0 -15
- package/dist/core/CalendarService.d.ts.map +0 -1
- package/dist/core/CalendarService.js +0 -32
- package/dist/core/CommandService.d.ts +0 -25
- package/dist/core/CommandService.d.ts.map +0 -1
- package/dist/core/CommandService.js +0 -52
- package/dist/core/DebugPanelService.d.ts +0 -12
- package/dist/core/DebugPanelService.d.ts.map +0 -1
- package/dist/core/DebugPanelService.js +0 -29
- package/dist/core/DebugService.d.ts +0 -57
- package/dist/core/DebugService.d.ts.map +0 -1
- package/dist/core/DebugService.js +0 -134
- package/dist/core/EventBus.d.ts +0 -32
- package/dist/core/EventBus.d.ts.map +0 -1
- package/dist/core/EventBus.js +0 -51
- package/dist/core/EventHandler.d.ts +0 -3
- package/dist/core/EventHandler.d.ts.map +0 -1
- package/dist/core/EventHandler.js +0 -82
- package/dist/core/GamificationService.d.ts +0 -19
- package/dist/core/GamificationService.d.ts.map +0 -1
- package/dist/core/GamificationService.js +0 -102
- package/dist/core/HookService.d.ts +0 -34
- package/dist/core/HookService.d.ts.map +0 -1
- package/dist/core/HookService.js +0 -64
- package/dist/core/LayoutService.d.ts +0 -61
- package/dist/core/LayoutService.d.ts.map +0 -1
- package/dist/core/LayoutService.js +0 -223
- package/dist/core/ModalService.d.ts +0 -21
- package/dist/core/ModalService.d.ts.map +0 -1
- package/dist/core/ModalService.js +0 -71
- package/dist/core/NotificationService.d.ts +0 -7
- package/dist/core/NotificationService.d.ts.map +0 -1
- package/dist/core/NotificationService.js +0 -42
- package/dist/core/RouterService.d.ts +0 -13
- package/dist/core/RouterService.d.ts.map +0 -1
- package/dist/core/RouterService.js +0 -54
- package/dist/core/ServiceContainer.d.ts +0 -18
- package/dist/core/ServiceContainer.d.ts.map +0 -1
- package/dist/core/ServiceContainer.js +0 -27
- package/dist/core/ShortcutService.d.ts +0 -17
- package/dist/core/ShortcutService.d.ts.map +0 -1
- package/dist/core/ShortcutService.js +0 -37
- package/dist/core/StorageService.d.ts +0 -36
- package/dist/core/StorageService.d.ts.map +0 -1
- package/dist/core/StorageService.js +0 -101
- package/dist/core/ThemeService.d.ts +0 -12
- package/dist/core/ThemeService.d.ts.map +0 -1
- package/dist/core/ThemeService.js +0 -60
- package/dist/core/WebSocketService.d.ts +0 -16
- package/dist/core/WebSocketService.d.ts.map +0 -1
- package/dist/core/WebSocketService.js +0 -22
- package/dist/core/api.d.ts +0 -70
- package/dist/core/api.d.ts.map +0 -1
- package/dist/core/api.js +0 -1
- package/dist/core/app/ModuleManager copy.d.ts +0 -23
- package/dist/core/app/ModuleManager copy.js +0 -52
- package/dist/core/app/ModuleManager.d.ts +0 -60
- package/dist/core/app/ModuleManager.d.ts.map +0 -1
- package/dist/core/app/ModuleManager.js +0 -217
- package/dist/core/app/apiFactory.d.ts +0 -4
- package/dist/core/app/apiFactory.d.ts.map +0 -1
- package/dist/core/app/apiFactory.js +0 -120
- package/dist/core/app/commandManager.d.ts +0 -3
- package/dist/core/app/commandManager.d.ts.map +0 -1
- package/dist/core/app/commandManager.js +0 -195
- package/dist/core/app/moduleLoader.d.ts +0 -11
- package/dist/core/app/moduleLoader.d.ts.map +0 -1
- package/dist/core/app/moduleLoader.js +0 -30
- package/dist/core/app/routeManager.d.ts +0 -2
- package/dist/core/app/routeManager.d.ts.map +0 -1
- package/dist/core/app/routeManager.js +0 -7
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -15
- package/dist/core/layout/dragDropManager.d.ts +0 -8
- package/dist/core/layout/dragDropManager.d.ts.map +0 -1
- package/dist/core/layout/dragDropManager.js +0 -8
- package/dist/core/layout/paneManager.d.ts +0 -7
- package/dist/core/layout/paneManager.d.ts.map +0 -1
- package/dist/core/layout/paneManager.js +0 -7
- package/dist/core/layout/renderer.d.ts +0 -8
- package/dist/core/layout/renderer.d.ts.map +0 -1
- package/dist/core/layout/renderer.js +0 -8
- package/dist/core/layout/resizeManager.d.ts +0 -5
- package/dist/core/layout/resizeManager.d.ts.map +0 -1
- package/dist/core/layout/resizeManager.js +0 -5
- package/dist/core/signals.d.ts +0 -20
- package/dist/core/signals.d.ts.map +0 -1
- package/dist/core/signals.js +0 -66
- package/dist/core/uiState.d.ts +0 -9
- package/dist/core/uiState.d.ts.map +0 -1
- package/dist/core/uiState.js +0 -11
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -15
- package/dist/lib/local-db.d.ts +0 -43
- package/dist/lib/local-db.d.ts.map +0 -1
- package/dist/lib/local-db.js +0 -23
- package/dist/lib/sync-service.d.ts +0 -7
- package/dist/lib/sync-service.d.ts.map +0 -1
- package/dist/lib/sync-service.js +0 -41
- package/dist/platform/ILayoutService.d.ts +0 -63
- package/dist/platform/ILayoutService.d.ts.map +0 -1
- package/dist/platform/ILayoutService.js +0 -1
- package/dist/platform/IRenderer.d.ts +0 -16
- package/dist/platform/IRenderer.d.ts.map +0 -1
- package/dist/platform/IRenderer.js +0 -1
- package/dist/platform/ServiceRegistry.d.ts +0 -43
- package/dist/platform/ServiceRegistry.d.ts.map +0 -1
- package/dist/platform/ServiceRegistry.js +0 -2
- package/dist/platform/extensionPoints.d.ts +0 -70
- package/dist/platform/extensionPoints.d.ts.map +0 -1
- package/dist/platform/extensionPoints.js +0 -22
- package/dist/platform/index.d.ts +0 -5
- package/dist/platform/index.d.ts.map +0 -1
- package/dist/platform/index.js +0 -4
- package/dist/stores/editorStore.d.ts +0 -5
- package/dist/stores/editorStore.d.ts.map +0 -1
- package/dist/stores/editorStore.js +0 -4
- package/dist/stores/gamificationStore.d.ts +0 -3
- package/dist/stores/gamificationStore.d.ts.map +0 -1
- package/dist/stores/gamificationStore.js +0 -2
- package/dist/stores/historyStore.d.ts +0 -12
- package/dist/stores/historyStore.d.ts.map +0 -1
- package/dist/stores/historyStore.js +0 -6
- package/dist/stores/workspaceStore.d.ts +0 -13
- package/dist/stores/workspaceStore.d.ts.map +0 -1
- package/dist/stores/workspaceStore.js +0 -6
- package/dist/types/app.d.ts +0 -31
- package/dist/types/app.d.ts.map +0 -1
- package/dist/types/app.js +0 -1
- package/dist/types/debug.d.ts +0 -68
- package/dist/types/debug.d.ts.map +0 -1
- package/dist/types/debug.js +0 -1
- package/dist/types/entities.d.ts +0 -42
- package/dist/types/entities.js +0 -2
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/modules.d.ts +0 -66
- package/dist/types/modules.js +0 -2
- package/dist/types/platform.d.ts +0 -95
- package/dist/types/platform.d.ts.map +0 -1
- package/dist/types/platform.js +0 -2
- package/dist/ui/Palette.d.ts +0 -38
- package/dist/ui/Palette.d.ts.map +0 -1
- package/dist/ui/Palette.js +0 -144
- package/dist/ui/debug-panel/dragAndResize.d.ts +0 -6
- package/dist/ui/debug-panel/dragAndResize.d.ts.map +0 -1
- package/dist/ui/debug-panel/dragAndResize.js +0 -140
- package/dist/ui/debug-panel/eventBinder.d.ts +0 -5
- package/dist/ui/debug-panel/eventBinder.d.ts.map +0 -1
- package/dist/ui/debug-panel/eventBinder.js +0 -120
- package/dist/ui/debug-panel/layoutManager.d.ts +0 -16
- package/dist/ui/debug-panel/layoutManager.d.ts.map +0 -1
- package/dist/ui/debug-panel/layoutManager.js +0 -73
- package/dist/ui/debug-panel/main.d.ts +0 -12
- package/dist/ui/debug-panel/main.d.ts.map +0 -1
- package/dist/ui/debug-panel/main.js +0 -42
- package/dist/ui/debug-panel/panelManager.d.ts +0 -17
- package/dist/ui/debug-panel/panelManager.d.ts.map +0 -1
- package/dist/ui/debug-panel/panelManager.js +0 -123
- package/dist/ui/debug-panel/renderer.d.ts +0 -4
- package/dist/ui/debug-panel/renderer.d.ts.map +0 -1
- package/dist/ui/debug-panel/renderer.js +0 -181
- package/dist/ui/debug-panel/services.d.ts +0 -4
- package/dist/ui/debug-panel/services.d.ts.map +0 -1
- package/dist/ui/debug-panel/services.js +0 -134
- package/dist/ui/debug-panel/settings.d.ts +0 -5
- package/dist/ui/debug-panel/settings.d.ts.map +0 -1
- package/dist/ui/debug-panel/settings.js +0 -35
- package/dist/ui/debug-panel/state.d.ts +0 -128
- package/dist/ui/debug-panel/state.d.ts.map +0 -1
- package/dist/ui/debug-panel/state.js +0 -42
- package/dist/ui/debug-panel/stateEditor.d.ts +0 -9
- package/dist/ui/debug-panel/stateEditor.d.ts.map +0 -1
- package/dist/ui/debug-panel/stateEditor.js +0 -158
- package/dist/ui/debug-panel/types.d.ts +0 -68
- package/dist/ui/debug-panel/types.d.ts.map +0 -1
- package/dist/ui/debug-panel/types.js +0 -1
- package/dist/ui/debug-panel/ui.d.ts +0 -10
- package/dist/ui/debug-panel/ui.d.ts.map +0 -1
- package/dist/ui/debug-panel/ui.js +0 -199
- package/dist/ui/debug-panel/utils.d.ts +0 -16
- package/dist/ui/debug-panel/utils.d.ts.map +0 -1
- package/dist/ui/debug-panel/utils.js +0 -104
- package/dist/utils.d.ts +0 -22
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -58
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @decido/shell-vscode-core
|
|
2
|
+
|
|
3
|
+
## 4.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- readme
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @decido/kernel-bridge@4.0.1
|
|
10
|
+
|
|
11
|
+
## 4.0.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- build
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @decido/kernel-bridge@4.0.0
|
|
21
|
+
|
|
22
|
+
## 3.0.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- eef837b: quitar codigo fuente
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [eef837b]
|
|
31
|
+
- @decido/kernel-bridge@3.0.0
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# 🚀 @decido/shell-vscode-core
|
|
2
|
+
|
|
3
|
+
> Módulo interno optimizado de alto desempeño perteneciente al ecosistema arquitectónico de Decido OS.
|
|
4
|
+
|
|
5
|
+
Bienvenido a la documentación oficial de **@decido/shell-vscode-core**, un componente integral del ecosistema **Decido OS**.
|
|
6
|
+
|
|
7
|
+
## 📦 Instalación
|
|
8
|
+
|
|
9
|
+
Para aprovisionar este módulo dentro de otra área del monorepo o consumirlo remotamente:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @decido/shell-vscode-core
|
|
13
|
+
# o mediante el gestor oficial del monorepo
|
|
14
|
+
pnpm add @decido/shell-vscode-core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 🔧 Estructura y Dependencias
|
|
18
|
+
|
|
19
|
+
Este paquete está diseñado para interoperar de forma nativa con la infraestructura central.
|
|
20
|
+
Para su correcto funcionamiento en un entorno aislado (Sandboxed), se apoya en los siguientes cimientos tecnológicos:
|
|
21
|
+
|
|
22
|
+
- `@decido/kernel-bridge`
|
|
23
|
+
- `@types/react`
|
|
24
|
+
- `dexie`
|
|
25
|
+
- `lit-html`
|
|
26
|
+
- `react`
|
|
27
|
+
|
|
28
|
+
## 🔐 Licencia y Privacidad
|
|
29
|
+
El código de este componente se encuentra auditado y restringido (Sin Sourcemaps).
|
|
30
|
+
Propiedad Intelectual Protegida - Framework Decido OS.
|
|
31
|
+
Distribuido bajo licencia **UNLICENSED**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decido/shell-vscode-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lit-html": "^3.3.1",
|
|
21
21
|
"react": "^18.3.1",
|
|
22
22
|
"socket.io-client": "^4.8.1",
|
|
23
|
-
"@decido/kernel-bridge": "
|
|
23
|
+
"@decido/kernel-bridge": "4.0.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"typescript": "^5.5.2"
|
package/dist/appState.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StorageService } from "./core/StorageService";
|
|
2
|
-
export * from "./stores/editorStore";
|
|
3
|
-
export * from "./stores/gamificationStore";
|
|
4
|
-
export * from "./stores/workspaceStore";
|
|
5
|
-
export * from "./stores/historyStore";
|
|
6
|
-
/**
|
|
7
|
-
* Carga el estado inicial de la aplicación desde IndexedDB usando el StorageService.
|
|
8
|
-
* @param storage El servicio de almacenamiento para interactuar con la BD.
|
|
9
|
-
*/
|
|
10
|
-
export declare function initializeStateFromStorage(storage: StorageService): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Función central y ÚNICA para modificar el estado de la aplicación.
|
|
13
|
-
* Es llamada por los Servicios de Lógica de Negocio.
|
|
14
|
-
* @param action Un nombre descriptivo para el cambio (ej: 'TASK:CREATE').
|
|
15
|
-
* @param updater Una función que realiza el cambio de estado en memoria (llama a un setter).
|
|
16
|
-
* @param persistenceFn Una función asíncrona que guarda los cambios en la base de datos.
|
|
17
|
-
*/
|
|
18
|
-
export declare function updateState(action: string, updater: () => void, persistenceFn?: () => Promise<void>): void;
|
|
19
|
-
export declare function getFullStateSnapshot(): any;
|
|
20
|
-
export declare function restoreStateFromSnapshot(snapshot: any): void;
|
|
21
|
-
export declare function timeTravelLocal(historyIndex: number): void;
|
|
22
|
-
export declare function timeTravel(historyIndex: number): void;
|
|
23
|
-
//# sourceMappingURL=appState.d.ts.map
|
package/dist/appState.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appState.d.ts","sourceRoot":"","sources":["../src/appState.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AAatC;;;GAGG;AAEH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,cAAc,iBAyCvE;AAKD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,QAqBnG;AAQD,wBAAgB,oBAAoB,IAAI,GAAG,CAO1C;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,GAAG,QAMrD;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,QAQnD;AAED,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,QAuB9C"}
|
package/dist/appState.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
// src/appState.ts
|
|
2
|
-
import { StorageService } from "./core/StorageService";
|
|
3
|
-
export * from "./stores/editorStore";
|
|
4
|
-
export * from "./stores/gamificationStore";
|
|
5
|
-
export * from "./stores/workspaceStore";
|
|
6
|
-
export * from "./stores/historyStore";
|
|
7
|
-
import { editorPanes, setEditorPanes, setActivePaneId, activePaneId } from "./stores/editorStore";
|
|
8
|
-
import { gamification, setGamification } from "./stores/gamificationStore";
|
|
9
|
-
import { history, setHistory, isTimeTraveling } from "./stores/historyStore";
|
|
10
|
-
let isDebuggingTimeTravel = false; // Flag interna para el modo de depuración
|
|
11
|
-
// --- LÓGICA DE MANEJO DE ESTADO ---
|
|
12
|
-
const storage = new StorageService(); // Instancia del servicio
|
|
13
|
-
/**
|
|
14
|
-
* Carga el estado inicial de la aplicación desde IndexedDB usando el StorageService.
|
|
15
|
-
* @param storage El servicio de almacenamiento para interactuar con la BD.
|
|
16
|
-
*/
|
|
17
|
-
// Esta función es más genérica y fácil de mantener
|
|
18
|
-
export async function initializeStateFromStorage(storage) {
|
|
19
|
-
console.log("💾 Cargando estado desde IndexedDB...");
|
|
20
|
-
const stateMap = [
|
|
21
|
-
// Para objetos únicos
|
|
22
|
-
{ key: 'gamification', setter: setGamification, isSingle: true },
|
|
23
|
-
{ key: 'editorPanes', setter: setEditorPanes, isSingle: true },
|
|
24
|
-
{ key: 'activePaneId', setter: setActivePaneId, isSingle: true }
|
|
25
|
-
];
|
|
26
|
-
for (const item of stateMap) {
|
|
27
|
-
const value = item.isSingle
|
|
28
|
-
? await storage.getValue(item.key)
|
|
29
|
-
: await storage.getCollection(item.key);
|
|
30
|
-
if (value !== undefined && value !== null && Array.isArray(value) && value.length > 0) {
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
item.setter(value);
|
|
33
|
-
}
|
|
34
|
-
else if (value !== undefined && value !== null && !Array.isArray(value)) {
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
item.setter(value);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// Si después de cargar, no hay paneles, crea uno por defecto.
|
|
40
|
-
if (editorPanes().length === 0) {
|
|
41
|
-
console.log("No se encontró layout de editor, creando uno por defecto.");
|
|
42
|
-
const defaultPane = {
|
|
43
|
-
id: 'pane-main',
|
|
44
|
-
tabs: [{
|
|
45
|
-
id: 'welcome',
|
|
46
|
-
title: 'Bienvenido',
|
|
47
|
-
componentTag: 'welcome-view',
|
|
48
|
-
icon: 'fas fa-hand-sparkles'
|
|
49
|
-
}],
|
|
50
|
-
activeTabId: 'welcome'
|
|
51
|
-
};
|
|
52
|
-
setEditorPanes([defaultPane]);
|
|
53
|
-
setActivePaneId(defaultPane.id);
|
|
54
|
-
}
|
|
55
|
-
console.log("✅ Estado cargado desde IndexedDB.");
|
|
56
|
-
}
|
|
57
|
-
// Una bandera para evitar que el viaje en el tiempo se grabe a sí mismo en el historial
|
|
58
|
-
let isTimeTravelingLocal = false;
|
|
59
|
-
/**
|
|
60
|
-
* Función central y ÚNICA para modificar el estado de la aplicación.
|
|
61
|
-
* Es llamada por los Servicios de Lógica de Negocio.
|
|
62
|
-
* @param action Un nombre descriptivo para el cambio (ej: 'TASK:CREATE').
|
|
63
|
-
* @param updater Una función que realiza el cambio de estado en memoria (llama a un setter).
|
|
64
|
-
* @param persistenceFn Una función asíncrona que guarda los cambios en la base de datos.
|
|
65
|
-
*/
|
|
66
|
-
export function updateState(action, updater, persistenceFn) {
|
|
67
|
-
if (isTimeTraveling()) {
|
|
68
|
-
console.warn(`[STATE] Escritura bloqueada (${action}). La aplicación está en modo de revisión de solo lectura.`);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (!isDebuggingTimeTravel) {
|
|
72
|
-
const snapshot = getFullStateSnapshot();
|
|
73
|
-
setHistory(prev => [...prev, { id: prev.length, timestamp: new Date(), action, snapshot }]);
|
|
74
|
-
}
|
|
75
|
-
// 1. Actualización optimista en la UI (en memoria)
|
|
76
|
-
updater();
|
|
77
|
-
// 2. Persistencia asíncrona en segundo plano
|
|
78
|
-
if (persistenceFn) {
|
|
79
|
-
persistenceFn().catch(err => {
|
|
80
|
-
console.error(`[STATE] Fallo de persistencia en la acción '${action}':`, err);
|
|
81
|
-
// Aquí se podría implementar una lógica de "rollback" o reintento.
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// --- FUNCIONES DE AYUDA Y DE INICIALIZACIÓN ---
|
|
86
|
-
// (Estas funciones como `getFullStateSnapshot`, `restoreStateFromSnapshot`,
|
|
87
|
-
// `initializeStateFromStorage`, `timeTravelLocal`, etc., se quedan aquí,
|
|
88
|
-
// ya que operan directamente sobre el conjunto del estado).
|
|
89
|
-
export function getFullStateSnapshot() {
|
|
90
|
-
return {
|
|
91
|
-
gamification: gamification(),
|
|
92
|
-
editorPanes: editorPanes(),
|
|
93
|
-
activePaneId: activePaneId(),
|
|
94
|
-
// ... el resto de tu estado ...
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
export function restoreStateFromSnapshot(snapshot) {
|
|
98
|
-
if (!snapshot)
|
|
99
|
-
return;
|
|
100
|
-
setGamification(snapshot.gamification || { xp: 0, level: 1, streak: 0, lastJournalDate: null, unlockedAchievements: [], achievements: [] });
|
|
101
|
-
setEditorPanes(snapshot.editorPanes || []);
|
|
102
|
-
setActivePaneId(snapshot.activePaneId || null);
|
|
103
|
-
// ... el resto de tus setters ...
|
|
104
|
-
}
|
|
105
|
-
export function timeTravelLocal(historyIndex) {
|
|
106
|
-
const log = history();
|
|
107
|
-
if (!log[historyIndex])
|
|
108
|
-
return;
|
|
109
|
-
isDebuggingTimeTravel = true;
|
|
110
|
-
restoreStateFromSnapshot(log[historyIndex].snapshot);
|
|
111
|
-
setHistory(log.slice(0, historyIndex + 1));
|
|
112
|
-
isDebuggingTimeTravel = false;
|
|
113
|
-
}
|
|
114
|
-
export function timeTravel(historyIndex) {
|
|
115
|
-
const log = history();
|
|
116
|
-
if (!log[historyIndex])
|
|
117
|
-
return;
|
|
118
|
-
// Obtenemos la "foto" del estado que queremos restaurar
|
|
119
|
-
const snapshot = log[historyIndex].snapshot;
|
|
120
|
-
// Activamos la bandera para que `updateState` no grabe este cambio
|
|
121
|
-
isTimeTravelingLocal = true;
|
|
122
|
-
// Restauramos el estado llamando a los setters originales
|
|
123
|
-
// Esto es un ejemplo, debes hacerlo para todas tus señales
|
|
124
|
-
// setUser(snapshot.user);
|
|
125
|
-
// setAppSettings(snapshot.settings);
|
|
126
|
-
// setActiveView(snapshot.activeView);
|
|
127
|
-
console.log(`✈️ Viajando en el tiempo al estado ${historyIndex}`, snapshot);
|
|
128
|
-
// Cortamos el historial para que el estado actual sea el final de la línea de tiempo
|
|
129
|
-
setHistory(log.slice(0, historyIndex + 1));
|
|
130
|
-
// Desactivamos la bandera
|
|
131
|
-
isTimeTravelingLocal = false;
|
|
132
|
-
}
|
|
133
|
-
// Ejemplo de cómo usarlo en tu app:
|
|
134
|
-
/*
|
|
135
|
-
updateState('SET_USER_NAME', () => {
|
|
136
|
-
setUserName('Nuevo Nombre');
|
|
137
|
-
});
|
|
138
|
-
*/
|
package/dist/core/AIService.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IPlatformAPI } from './api.js';
|
|
2
|
-
import { Signal } from './signals.js';
|
|
3
|
-
export interface AIServiceOptions {
|
|
4
|
-
stream?: boolean;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Servicio central para interactuar con las capacidades de IA de la plataforma.
|
|
8
|
-
* Abstrae las llamadas al backend de Genkit y gestiona el streaming de respuestas.
|
|
9
|
-
*/
|
|
10
|
-
export declare class AIService {
|
|
11
|
-
private api;
|
|
12
|
-
init(api: IPlatformAPI): void;
|
|
13
|
-
/**
|
|
14
|
-
* Ejecuta un flujo de Genkit definido en el backend.
|
|
15
|
-
* @param flowId El ID del flujo a ejecutar (ej. 'decidoFlow').
|
|
16
|
-
* @param payload El objeto de entrada para el flujo, con `promptKey` y `context`.
|
|
17
|
-
* @param options Opciones de ejecución, como habilitar el streaming.
|
|
18
|
-
* @returns Si stream=true, devuelve el getter de una señal. Si no, una Promesa con el resultado final.
|
|
19
|
-
*/
|
|
20
|
-
runFlow<T = string>(flowId: string, payload: {
|
|
21
|
-
promptKey: string;
|
|
22
|
-
context: Record<string, unknown> | unknown;
|
|
23
|
-
}, options: {
|
|
24
|
-
stream: true;
|
|
25
|
-
}): Signal<T>[0];
|
|
26
|
-
runFlow<T = string>(flowId: string, payload: {
|
|
27
|
-
promptKey: string;
|
|
28
|
-
context: Record<string, unknown> | unknown;
|
|
29
|
-
}, options?: {
|
|
30
|
-
stream?: false;
|
|
31
|
-
}): Promise<T>;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=AIService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AIService.d.ts","sourceRoot":"","sources":["../../src/core/AIService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAgB,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAG7B,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,SAAS;IAClB,OAAO,CAAC,GAAG,CAAgB;IAEpB,IAAI,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI;IAIpC;;;;;;OAMG;IACI,OAAO,CAAC,CAAC,GAAG,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;KAAE,EAC1E,OAAO,EAAE;QAAE,MAAM,EAAE,IAAI,CAAA;KAAE,GAC1B,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACR,OAAO,CAAC,CAAC,GAAG,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;KAAE,EAC1E,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,KAAK,CAAA;KAAE,GAC7B,OAAO,CAAC,CAAC,CAAC;CAsEhB"}
|
package/dist/core/AIService.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// File: packages/core/src/core/AIService.ts
|
|
2
|
-
import { createSignal } from './signals.js';
|
|
3
|
-
/**
|
|
4
|
-
* Servicio central para interactuar con las capacidades de IA de la plataforma.
|
|
5
|
-
* Abstrae las llamadas al backend de Genkit y gestiona el streaming de respuestas.
|
|
6
|
-
*/
|
|
7
|
-
export class AIService {
|
|
8
|
-
api;
|
|
9
|
-
init(api) {
|
|
10
|
-
this.api = api;
|
|
11
|
-
}
|
|
12
|
-
runFlow(flowId, payload, options = {}) {
|
|
13
|
-
const { stream = false } = options;
|
|
14
|
-
if (!stream) {
|
|
15
|
-
// Caso simple: No streaming. Ejecución directa HTTP
|
|
16
|
-
return new Promise(async (resolve, reject) => {
|
|
17
|
-
try {
|
|
18
|
-
const token = localStorage.getItem('decido-token');
|
|
19
|
-
const response = await fetch(`http://localhost:8888/flow/${flowId}`, {
|
|
20
|
-
method: 'POST',
|
|
21
|
-
headers: {
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
'Authorization': `Bearer ${token}`
|
|
24
|
-
},
|
|
25
|
-
body: JSON.stringify(payload)
|
|
26
|
-
});
|
|
27
|
-
if (!response.ok)
|
|
28
|
-
throw new Error(`HTTP Error: ${response.statusText}`);
|
|
29
|
-
const json = await response.json();
|
|
30
|
-
resolve(json);
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
reject(e);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
// --- Caso Avanzado: Streaming ---
|
|
38
|
-
const [getStreamedResponse, setStreamedResponse] = createSignal("");
|
|
39
|
-
// Envolvemos la lógica de streaming en una función asíncrona
|
|
40
|
-
const startStreaming = async () => {
|
|
41
|
-
try {
|
|
42
|
-
const token = localStorage.getItem('decido-token');
|
|
43
|
-
const response = await fetch(`http://localhost:8888/flow/${flowId}/stream`, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers: {
|
|
46
|
-
'Content-Type': 'application/json',
|
|
47
|
-
'Authorization': `Bearer ${token}`
|
|
48
|
-
},
|
|
49
|
-
body: JSON.stringify(payload),
|
|
50
|
-
});
|
|
51
|
-
if (!response.ok || !response.body) {
|
|
52
|
-
throw new Error(`Error en la respuesta del servidor: ${response.statusText}`);
|
|
53
|
-
}
|
|
54
|
-
const reader = response.body.getReader();
|
|
55
|
-
const decoder = new TextDecoder();
|
|
56
|
-
let fullText = "";
|
|
57
|
-
while (true) {
|
|
58
|
-
const { done, value } = await reader.read();
|
|
59
|
-
if (done)
|
|
60
|
-
break;
|
|
61
|
-
fullText += decoder.decode(value, { stream: true });
|
|
62
|
-
setStreamedResponse(fullText);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
console.error("[AIService] Error durante el streaming:", error);
|
|
67
|
-
setStreamedResponse("Error al generar la respuesta.");
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
startStreaming();
|
|
71
|
-
return getStreamedResponse; // Devolvemos el getter inmediatamente
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { AuthService } from "./AuthService";
|
|
2
|
-
/**
|
|
3
|
-
* Clase para gestionar las interacciones con la API del backend.
|
|
4
|
-
* Encapsula la lógica de fetch, la gestión de errores y la autenticación.
|
|
5
|
-
*/
|
|
6
|
-
export declare class ApiService {
|
|
7
|
-
id: string;
|
|
8
|
-
private authService;
|
|
9
|
-
init(authService: AuthService): void;
|
|
10
|
-
fetch<T = unknown>(endpoint: string, options?: RequestInit, isText?: boolean): Promise<T>;
|
|
11
|
-
login(email: string, password: string): Promise<unknown>;
|
|
12
|
-
refresh(refreshToken: string): Promise<{
|
|
13
|
-
token: string;
|
|
14
|
-
}>;
|
|
15
|
-
register(username: string, email: string, password: string): Promise<unknown>;
|
|
16
|
-
logout(): void;
|
|
17
|
-
getProfile(): Promise<{
|
|
18
|
-
id: number;
|
|
19
|
-
name: string;
|
|
20
|
-
}>;
|
|
21
|
-
updateProfile(profileData: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
22
|
-
getAIProjectPlan(goal: {
|
|
23
|
-
title: string;
|
|
24
|
-
coreValueId: string;
|
|
25
|
-
}): Promise<unknown>;
|
|
26
|
-
generateBlueprint(goalData: Record<string, unknown>): Promise<string>;
|
|
27
|
-
getAIGoalSuggestion(idea: string): Promise<unknown>;
|
|
28
|
-
getRefinedText(text: string, context: string): Promise<string>;
|
|
29
|
-
getModules(): Promise<unknown[]>;
|
|
30
|
-
uploadModule(formData: FormData): Promise<unknown>;
|
|
31
|
-
generateTheme(prompt: string): Promise<unknown>;
|
|
32
|
-
}
|
|
33
|
-
export declare const apiService: ApiService;
|
|
34
|
-
//# sourceMappingURL=ApiService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiService.d.ts","sourceRoot":"","sources":["../../src/core/ApiService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD;;;GAGG;AACH,qBAAa,UAAU;IACZ,EAAE,SAA2C;IACpD,OAAO,CAAC,WAAW,CAAe;IAE3B,IAAI,CAAC,WAAW,EAAE,WAAW;IAK9B,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;IAK3F,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACxD,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACnF,MAAM,IAAI,IAAI;IACR,UAAU,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGrF,gBAAgB,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAChF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IACrE,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACnD,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9D,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAChC,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAClD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CACxD;AAED,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
package/dist/core/ApiService.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const API_BASE_URL = 'http://localhost:8888/api';
|
|
2
|
-
/**
|
|
3
|
-
* Clase para gestionar las interacciones con la API del backend.
|
|
4
|
-
* Encapsula la lógica de fetch, la gestión de errores y la autenticación.
|
|
5
|
-
*/
|
|
6
|
-
export class ApiService {
|
|
7
|
-
id = Math.random().toString(36).substr(2, 9);
|
|
8
|
-
authService;
|
|
9
|
-
init(authService) {
|
|
10
|
-
console.log(`[ApiService:${this.id}] init called`);
|
|
11
|
-
this.authService = authService;
|
|
12
|
-
}
|
|
13
|
-
async fetch(endpoint, options = {}, isText = false) {
|
|
14
|
-
console.log(`[ApiService Mock] Ignorando invocación de red a: ${endpoint}`);
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
|
-
async login(email, password) { return {}; }
|
|
18
|
-
async refresh(refreshToken) { return { token: "dev" }; }
|
|
19
|
-
async register(username, email, password) { return {}; }
|
|
20
|
-
logout() { }
|
|
21
|
-
async getProfile() { return { id: 1, name: "Local Dev" }; }
|
|
22
|
-
async updateProfile(profileData) { return profileData; }
|
|
23
|
-
// IA & Marketplace Mocks
|
|
24
|
-
async getAIProjectPlan(goal) { return {}; }
|
|
25
|
-
async generateBlueprint(goalData) { return ""; }
|
|
26
|
-
async getAIGoalSuggestion(idea) { return {}; }
|
|
27
|
-
async getRefinedText(text, context) { return text; }
|
|
28
|
-
async getModules() { return []; }
|
|
29
|
-
async uploadModule(formData) { return {}; }
|
|
30
|
-
async generateTheme(prompt) { return {}; }
|
|
31
|
-
}
|
|
32
|
-
export const apiService = new ApiService();
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Signal } from './signals.js';
|
|
2
|
-
import type { ApiService } from './ApiService.js';
|
|
3
|
-
type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated' | 'error';
|
|
4
|
-
interface User {
|
|
5
|
-
id: string | number;
|
|
6
|
-
name: string;
|
|
7
|
-
email: string;
|
|
8
|
-
}
|
|
9
|
-
interface Session {
|
|
10
|
-
user: User | null;
|
|
11
|
-
token: string | null;
|
|
12
|
-
status: AuthStatus;
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare class AuthService {
|
|
16
|
-
private apiService;
|
|
17
|
-
session: Signal<Session>;
|
|
18
|
-
constructor();
|
|
19
|
-
init(apiService: ApiService): void;
|
|
20
|
-
checkSession(): Promise<void>;
|
|
21
|
-
login: (email: any, password: any) => Promise<User>;
|
|
22
|
-
register(username: string, email: string, password: string): Promise<any>;
|
|
23
|
-
logout: () => void;
|
|
24
|
-
refreshToken: () => Promise<string | null>;
|
|
25
|
-
private listeners;
|
|
26
|
-
subscribe(cb: (session: Session) => void): () => void;
|
|
27
|
-
private setSession;
|
|
28
|
-
}
|
|
29
|
-
export declare const authService: AuthService;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=AuthService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthService.d.ts","sourceRoot":"","sources":["../../src/core/AuthService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,UAAU,GAAG,SAAS,GAAG,eAAe,GAAG,iBAAiB,GAAG,OAAO,CAAC;AAG5E,UAAU,IAAI;IACV,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CAEjB;AAED,UAAU,OAAO;IACb,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,WAAW;IACpB,OAAO,CAAC,UAAU,CAAc;IACzB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;;IAUzB,IAAI,CAAC,UAAU,EAAE,UAAU;IAI5B,YAAY;IAMlB,KAAK,GAAU,OAAO,GAAG,EAAE,UAAU,GAAG,mBASvC;IAEK,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIxE,MAAM,aAEZ;IAED,YAAY,QAAa,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAE9C;IAED,OAAO,CAAC,SAAS,CAAyC;IAEnD,SAAS,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;IAQ/C,OAAO,CAAC,UAAU;CAMrB;AAGD,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
package/dist/core/AuthService.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { createSignal } from './signals.js';
|
|
2
|
-
export class AuthService {
|
|
3
|
-
apiService;
|
|
4
|
-
session;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.session = createSignal({
|
|
7
|
-
user: null,
|
|
8
|
-
token: null,
|
|
9
|
-
status: 'loading',
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
init(apiService) {
|
|
13
|
-
this.apiService = apiService;
|
|
14
|
-
}
|
|
15
|
-
async checkSession() {
|
|
16
|
-
const fakeUser = { id: 1, name: "Local Dev", email: "dev@local.host" };
|
|
17
|
-
this.setSession({ user: fakeUser, token: "local-dev-token", status: 'authenticated' });
|
|
18
|
-
console.log('[Auth] CheckSession local - Auto autenticado.');
|
|
19
|
-
}
|
|
20
|
-
login = async (email, password) => {
|
|
21
|
-
const fakeUser = { id: 1, name: "Local Dev", email };
|
|
22
|
-
this.setSession({ user: fakeUser, token: "local-dev-token", status: 'authenticated' });
|
|
23
|
-
const fullscreenContainer = document.getElementById('fullscreen-view-container');
|
|
24
|
-
if (fullscreenContainer)
|
|
25
|
-
fullscreenContainer.innerHTML = '';
|
|
26
|
-
const appContainer = document.getElementById('app');
|
|
27
|
-
if (appContainer)
|
|
28
|
-
appContainer.style.display = 'block';
|
|
29
|
-
return fakeUser;
|
|
30
|
-
};
|
|
31
|
-
async register(username, email, password) {
|
|
32
|
-
return { success: true };
|
|
33
|
-
}
|
|
34
|
-
logout = () => {
|
|
35
|
-
this.setSession({ user: null, token: null, status: 'unauthenticated' });
|
|
36
|
-
};
|
|
37
|
-
refreshToken = async () => {
|
|
38
|
-
return "local-dev-token";
|
|
39
|
-
};
|
|
40
|
-
listeners = new Set();
|
|
41
|
-
subscribe(cb) {
|
|
42
|
-
this.listeners.add(cb);
|
|
43
|
-
cb(this.session[0]());
|
|
44
|
-
return () => {
|
|
45
|
-
this.listeners.delete(cb);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
setSession(partialState) {
|
|
49
|
-
const [get, set] = this.session;
|
|
50
|
-
set({ ...get(), ...partialState });
|
|
51
|
-
const newState = get();
|
|
52
|
-
this.listeners.forEach(cb => cb(newState));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// Exportamos una instancia única para toda la aplicación
|
|
56
|
-
export const authService = new AuthService();
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { StorageService } from './StorageService.js';
|
|
2
|
-
import { HookService } from './HookService.js';
|
|
3
|
-
import { ServiceContainer } from './ServiceContainer.js';
|
|
4
|
-
import { NotificationService } from './NotificationService.js';
|
|
5
|
-
import { GamificationService } from './GamificationService.js';
|
|
6
|
-
import { IPlatformAPI } from './api.js';
|
|
7
|
-
/**
|
|
8
|
-
* La clase base para todos los servicios de lógica de negocio.
|
|
9
|
-
* Utiliza el ServiceContainer para obtener sus dependencias, promoviendo
|
|
10
|
-
* un bajo acoplamiento.
|
|
11
|
-
*/
|
|
12
|
-
export declare class BaseService {
|
|
13
|
-
protected storage: StorageService;
|
|
14
|
-
protected hooks: HookService;
|
|
15
|
-
protected notifications: NotificationService;
|
|
16
|
-
protected gamification: GamificationService;
|
|
17
|
-
protected api: IPlatformAPI;
|
|
18
|
-
protected container: ServiceContainer;
|
|
19
|
-
constructor(container: ServiceContainer);
|
|
20
|
-
/**
|
|
21
|
-
* Envuelve la función global `updateState`.
|
|
22
|
-
* Este es el único punto de entrada para realizar cambios de estado persistentes.
|
|
23
|
-
* @param action El nombre de la acción para el historial de depuración (ej: 'TASK:CREATE').
|
|
24
|
-
* @param updater La función que modifica la señal de estado en memoria.
|
|
25
|
-
* @param persistenceFn La función asíncrona que guarda el cambio en IndexedDB.
|
|
26
|
-
*/
|
|
27
|
-
protected executeUpdate(action: string, updater: () => void, persistenceFn: () => Promise<void>): void;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=BaseService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseService.d.ts","sourceRoot":"","sources":["../../src/core/BaseService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,qBAAa,WAAW;IAEpB,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC;IAClC,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAC7C,SAAS,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC5C,SAAS,CAAC,GAAG,EAAE,YAAY,CAAC;IAC5B,SAAS,CAAC,SAAS,EAAE,gBAAgB,CAAC;gBAE1B,SAAS,EAAE,gBAAgB;IAUvC;;;;;;OAMG;IACH,SAAS,CAAC,aAAa,CACnB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,IAAI,EACnB,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;CAIzC"}
|
package/dist/core/BaseService.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* La clase base para todos los servicios de lógica de negocio.
|
|
3
|
-
* Utiliza el ServiceContainer para obtener sus dependencias, promoviendo
|
|
4
|
-
* un bajo acoplamiento.
|
|
5
|
-
*/
|
|
6
|
-
export class BaseService {
|
|
7
|
-
// Las dependencias comunes se declaran como protegidas
|
|
8
|
-
storage;
|
|
9
|
-
hooks;
|
|
10
|
-
notifications;
|
|
11
|
-
gamification;
|
|
12
|
-
api;
|
|
13
|
-
container;
|
|
14
|
-
constructor(container) {
|
|
15
|
-
// Cada servicio base pide al contenedor lo que necesita.
|
|
16
|
-
this.container = container;
|
|
17
|
-
this.storage = container.get('storage');
|
|
18
|
-
this.hooks = container.get('hooks');
|
|
19
|
-
this.notifications = container.get('notifications');
|
|
20
|
-
this.gamification = container.get('gamification');
|
|
21
|
-
this.api = container.get('api');
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Envuelve la función global `updateState`.
|
|
25
|
-
* Este es el único punto de entrada para realizar cambios de estado persistentes.
|
|
26
|
-
* @param action El nombre de la acción para el historial de depuración (ej: 'TASK:CREATE').
|
|
27
|
-
* @param updater La función que modifica la señal de estado en memoria.
|
|
28
|
-
* @param persistenceFn La función asíncrona que guarda el cambio en IndexedDB.
|
|
29
|
-
*/
|
|
30
|
-
executeUpdate(action, updater, persistenceFn) {
|
|
31
|
-
// updateState(action, updater, persistenceFn);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CalendarEvent } from '../types/platform.js';
|
|
2
|
-
import { IPlatformAPI } from './api.js';
|
|
3
|
-
export declare class CalendarService {
|
|
4
|
-
api: IPlatformAPI;
|
|
5
|
-
/**
|
|
6
|
-
* Crea un nuevo evento y lo añade al estado.
|
|
7
|
-
*/
|
|
8
|
-
createEvent(eventData: Omit<CalendarEvent, 'id'>): CalendarEvent;
|
|
9
|
-
/**
|
|
10
|
-
* Obtiene todos los eventos para un día específico.
|
|
11
|
-
* @param date El día para el que se quieren obtener los eventos.
|
|
12
|
-
*/
|
|
13
|
-
getEventsForDay(date: Date): void;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=CalendarService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarService.d.ts","sourceRoot":"","sources":["../../src/core/CalendarService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBAAa,eAAe;IACjB,GAAG,EAAG,YAAY,CAAC;IAE1B;;OAEG;IACI,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,aAAa;IAWvE;;;OAGG;IACI,eAAe,CAAC,IAAI,EAAE,IAAI;CAiBpC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// /src/core/CalendarService.ts
|
|
2
|
-
export class CalendarService {
|
|
3
|
-
api;
|
|
4
|
-
/**
|
|
5
|
-
* Crea un nuevo evento y lo añade al estado.
|
|
6
|
-
*/
|
|
7
|
-
createEvent(eventData) {
|
|
8
|
-
const newEvent = {
|
|
9
|
-
...eventData,
|
|
10
|
-
id: Date.now(),
|
|
11
|
-
};
|
|
12
|
-
// const currentEvents = this.api.state.calendar();
|
|
13
|
-
// this.api.state.setCalendar([...currentEvents, newEvent]);
|
|
14
|
-
this.api.notifications.show('success', 'Evento Creado', `Se añadió "${newEvent.title}" a tu calendario.`);
|
|
15
|
-
return newEvent;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Obtiene todos los eventos para un día específico.
|
|
19
|
-
* @param date El día para el que se quieren obtener los eventos.
|
|
20
|
-
*/
|
|
21
|
-
getEventsForDay(date) {
|
|
22
|
-
// const allEvents = this.api.state.calendar();
|
|
23
|
-
// const dayStart = new Date(date);
|
|
24
|
-
// dayStart.setHours(0, 0, 0, 0);
|
|
25
|
-
// const dayEnd = new Date(date);
|
|
26
|
-
// dayEnd.setHours(23, 59, 59, 999);
|
|
27
|
-
// return allEvents.filter((event: any) => {
|
|
28
|
-
// const eventStart = new Date(event.start);
|
|
29
|
-
// return eventStart >= dayStart && eventStart <= dayEnd;
|
|
30
|
-
// });
|
|
31
|
-
}
|
|
32
|
-
}
|