diff --git a/nuxt4-app/app/plugins/tableStores.client.ts b/nuxt4-app/app/plugins/tableStores.client.ts deleted file mode 100644 index 7b50107..0000000 --- a/nuxt4-app/app/plugins/tableStores.client.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { useMetadataStore } from '~/stores/metadata' -import { createTableDataStore } from '~/stores/tableDataFactory' - -export default defineNuxtPlugin(async (nuxtApp) => { - console.log('[TableStoresPlugin] Initializing...') - - // Wait for metadata to be available - const metadataStore = useMetadataStore() - - // Initialize metadata first - await metadataStore.initialize() - console.log(`[TableStoresPlugin] Metadata initialized, found ${metadataStore.allTables.length} tables`) - - // Create stores for all available tables and preload from cache - const tableStores = new Map>() - const storeInstances = new Map>>() - - // Load all caches in parallel for better performance - const cacheLoadPromises = metadataStore.allTables.map(async (metadata) => { - const datasourceName = metadata.name // Use datasource name, not table name - console.log(`[TableStoresPlugin] Creating store for datasource: ${datasourceName}`) - - const storeFactory = createTableDataStore(datasourceName, 100) - const storeInstance = storeFactory() - - // Register both factory and instance - tableStores.set(datasourceName, storeFactory) - storeInstances.set(datasourceName, storeInstance) - - // Load from cache immediately - await storeInstance.loadFromCache() - console.log(`[TableStoresPlugin] Loaded ${storeInstance.recordCount} records for ${datasourceName}`) - }) - - // Wait for all caches to load - await Promise.all(cacheLoadPromises) - console.log('[TableStoresPlugin] All caches loaded successfully') - - // Provide access to table stores - return { - provide: { - tableStores, - // Helper function to get a table store (returns existing instance) - getTableStore: (tableName: string) => { - // First try to get existing instance - const existingInstance = storeInstances.get(tableName) - if (existingInstance) { - return existingInstance - } - - // Fall back to creating new instance from factory - const storeFactory = tableStores.get(tableName) - if (!storeFactory) { - console.warn(`[TableStoresPlugin] Table store for "${tableName}" not found`) - return null - } - - const newInstance = storeFactory() - storeInstances.set(tableName, newInstance) - return newInstance - } - } - } -}) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 08c0ffa..0a7e238 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2024,21 +2024,6 @@ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", "license": "MIT" }, - "node_modules/@pinia/nuxt": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/@pinia/nuxt/-/nuxt-0.11.2.tgz", - "integrity": "sha512-CgvSWpbktxxWBV7ModhAcsExsQZqpPq6vMYEe9DexmmY6959ev8ukL4iFhr/qov2Nb9cQAWd7niFDnaWkN+FHg==", - "license": "MIT", - "dependencies": { - "@nuxt/kit": "^3.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "pinia": "^3.0.3" - } - }, "node_modules/@rollup/plugin-node-resolve": { "version": "15.3.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz", @@ -2523,15 +2508,6 @@ "@vue/shared": "3.5.22" } }, - "node_modules/@vue/devtools-api": { - "version": "7.7.7", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.7.tgz", - "integrity": "sha512-lwOnNBH2e7x1fIIbVT7yF5D+YWhqELm55/4ZKf45R9T8r9dE2AIOy8HKjfqzGsoTHFbWbr337O4E0A0QADnjBg==", - "license": "MIT", - "dependencies": { - "@vue/devtools-kit": "^7.7.7" - } - }, "node_modules/@vue/devtools-kit": { "version": "7.7.7", "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.7.tgz", @@ -4714,27 +4690,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pinia": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.3.tgz", - "integrity": "sha512-ttXO/InUULUXkMHpTdp9Fj4hLpD/2AoJdmAbAeW2yu1iy1k+pkFekQXw5VpC0/5p51IOR/jDaDRfRWRnMMsGOA==", - "license": "MIT", - "dependencies": { - "@vue/devtools-api": "^7.7.2" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "typescript": ">=4.4.4", - "vue": "^2.7.0 || ^3.5.11" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/pkg-types": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.0.tgz", @@ -6410,11 +6365,8 @@ "@nuxt/image": "^1.11.0", "@nuxt/test-utils": "^3.19.2", "@nuxt/ui": "^4.0.0", - "@pinia/nuxt": "^0.11.2", - "@supabase/supabase-js": "^2.48.0", "@vite-pwa/nuxt": "^0.9.1", "nuxt": "^4.1.2", - "pinia": "^3.0.3", "typescript": "^5.9.2", "vue": "^3.5.22", "vue-router": "^4.5.1" @@ -7922,66 +7874,6 @@ "version": "1.0.0", "license": "MIT" }, - "nuxt4-app/node_modules/@supabase/auth-js": { - "version": "2.72.0", - "license": "MIT", - "dependencies": { - "@supabase/node-fetch": "^2.6.14" - } - }, - "nuxt4-app/node_modules/@supabase/functions-js": { - "version": "2.5.0", - "license": "MIT", - "dependencies": { - "@supabase/node-fetch": "^2.6.14" - } - }, - "nuxt4-app/node_modules/@supabase/node-fetch": { - "version": "2.6.15", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "nuxt4-app/node_modules/@supabase/postgrest-js": { - "version": "1.21.4", - "license": "MIT", - "dependencies": { - "@supabase/node-fetch": "^2.6.14" - } - }, - "nuxt4-app/node_modules/@supabase/realtime-js": { - "version": "2.15.5", - "license": "MIT", - "dependencies": { - "@supabase/node-fetch": "^2.6.13", - "@types/phoenix": "^1.6.6", - "@types/ws": "^8.18.1", - "ws": "^8.18.2" - } - }, - "nuxt4-app/node_modules/@supabase/storage-js": { - "version": "2.12.2", - "license": "MIT", - "dependencies": { - "@supabase/node-fetch": "^2.6.14" - } - }, - "nuxt4-app/node_modules/@supabase/supabase-js": { - "version": "2.58.0", - "license": "MIT", - "dependencies": { - "@supabase/auth-js": "2.72.0", - "@supabase/functions-js": "2.5.0", - "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.21.4", - "@supabase/realtime-js": "2.15.5", - "@supabase/storage-js": "2.12.2" - } - }, "nuxt4-app/node_modules/@swc/helpers": { "version": "0.5.17", "license": "Apache-2.0", @@ -8133,6 +8025,8 @@ "nuxt4-app/node_modules/@types/node": { "version": "24.6.0", "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "undici-types": "~7.13.0" } @@ -8141,21 +8035,10 @@ "version": "7.0.3", "license": "MIT" }, - "nuxt4-app/node_modules/@types/phoenix": { - "version": "1.6.6", - "license": "MIT" - }, "nuxt4-app/node_modules/@types/web-bluetooth": { "version": "0.0.21", "license": "MIT" }, - "nuxt4-app/node_modules/@types/ws": { - "version": "8.18.1", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "nuxt4-app/node_modules/@unhead/vue": { "version": "2.0.17", "license": "MIT", @@ -12694,7 +12577,9 @@ }, "nuxt4-app/node_modules/undici-types": { "version": "7.13.0", - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "nuxt4-app/node_modules/unenv": { "version": "2.0.0-rc.21",