From cc6e6289733f3b0ab6c8840d27771de3128335f1 Mon Sep 17 00:00:00 2001 From: Paul Hovley Date: Fri, 8 Aug 2025 14:57:50 -0600 Subject: [PATCH 1/4] add api layer tests example --- src/CLAUDE.md | 114 +++++++- .../ebbApi/__tests__/focusScheduleApi.test.ts | 270 ++++++++++++++++++ 2 files changed, 381 insertions(+), 3 deletions(-) create mode 100644 src/api/ebbApi/__tests__/focusScheduleApi.test.ts diff --git a/src/CLAUDE.md b/src/CLAUDE.md index 1557fffb..291b4ce8 100644 --- a/src/CLAUDE.md +++ b/src/CLAUDE.md @@ -282,12 +282,120 @@ export default function FlowSessionList() { ## Testing -Run tests with: +### Testing Strategy + +Tests are written using Vitest and follow a layered approach matching our data architecture: + +**Test Categories:** +- **Repository Layer**: Test database operations and SQL queries +- **API Layer**: Test business logic and data transformations +- **Hooks Layer**: Generally not tested (see note below) + +### API Layer Testing Patterns + +When testing API functions, use this framework based on the function's complexity: + +**1. Passthrough Functions (Simple Success Test)** +Functions that only call repository methods without logic: + +```typescript +describe('getFocusSchedules', () => { + it('should return schedules successfully', async () => { + const mockSchedules = [{ id: '1', label: 'Test' }] + vi.mocked(FocusScheduleRepo.getFocusSchedules).mockResolvedValue(mockSchedules as any) + + const result = await FocusScheduleApi.getFocusSchedules() + + expect(result).toBe(mockSchedules) + }) +}) +``` + +**2. Business Logic Functions** +Functions with conditional logic (if statements, loops, validations): + +```typescript +// Test each logical branch +it('should throw error when workflow not found', async () => { + vi.mocked(WorkflowApi.getWorkflowById).mockResolvedValue(null) + + await expect( + FocusScheduleApi.createFocusSchedule('invalid-workflow', mockTime, mockRecurrence) + ).rejects.toThrow('Workflow not found') +}) +``` + +**3. Data Transformation Functions** +Functions that reshape, aggregate, or transform data: + +```typescript +// Test data shape and transformation accuracy +it('should transform parameters correctly with all fields', async () => { + await FocusScheduleApi.createFocusSchedule('workflow-1', mockTime, mockRecurrence, 'Label') + + expect(FocusScheduleRepo.createFocusSchedule).toHaveBeenCalledWith({ + id: 'test-uuid-123', + label: 'Label', + scheduled_time: '2024-01-15T09:00:00.000Z', + workflow_id: 'workflow-1', + recurrence_settings: '{"type":"daily"}', + is_active: 1, + }) +}) +``` + +**4. Complex Functions (Logic + Transformation)** +Test both business logic flows AND data shape: + +```typescript +describe('formatScheduleDisplay', () => { + // Test logic branches + it('should format daily recurring schedule', () => { + const schedule = { ...baseSchedule, recurrence: { type: 'daily' } } + const result = FocusScheduleApi.formatScheduleDisplay(schedule) + expect(result).toMatch(/Daily at \d{1,2}:\d{2} (AM|PM)/) + }) + + // Test edge cases + it('should handle edge cases gracefully', () => { + const invalidSchedule = { ...baseSchedule, recurrence: { type: 'weekly', daysOfWeek: [] } } + expect(FocusScheduleApi.formatScheduleDisplay(invalidSchedule)).toBe('Invalid schedule') + }) +}) +``` + +### React Query Hooks Testing Policy + +**Generally, do not test React Query hooks** unless otherwise directed +### Test File Organization + +``` +src/api/ebbApi/__tests__/ +├── focusScheduleApi.test.ts # API layer tests +└── ... + +src/db/ebb/__tests__/ +├── focusScheduleRepo.test.ts # Repository layer tests +└── ... + +# Note: src/api/hooks/ tests omitted per policy above +``` + +### Running Tests + ```bash +# Run all tests npm test -``` -Test files should be placed alongside the code they test with `.test.ts` or `.test.tsx` extensions. +# Run specific test file +npm test -- src/api/ebbApi/__tests__/focusScheduleApi.test.ts + +# Run tests in watch mode +npm test -- --watch + +# Run tests with coverage +npm test -- --coverage +``` ## Other preferences diff --git a/src/api/ebbApi/__tests__/focusScheduleApi.test.ts b/src/api/ebbApi/__tests__/focusScheduleApi.test.ts new file mode 100644 index 00000000..1af1590c --- /dev/null +++ b/src/api/ebbApi/__tests__/focusScheduleApi.test.ts @@ -0,0 +1,270 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { FocusScheduleApi, RecurrenceSettings } from '../focusScheduleApi' +import { FocusScheduleRepo } from '@/db/ebb/focusScheduleRepo' +import type { FocusSchedule } from '@/db/ebb/focusScheduleRepo' +import type { QueryResult } from '@tauri-apps/plugin-sql' +import { WorkflowApi } from '../workflowApi' +import type { Workflow } from '../workflowApi' + +// Mock dependencies +vi.mock('@/db/ebb/focusScheduleRepo', () => ({ + FocusScheduleRepo: { + createFocusSchedule: vi.fn(), + updateFocusSchedule: vi.fn(), + getFocusSchedules: vi.fn(), + getFocusSchedulesWithWorkflow: vi.fn(), + getFocusScheduleById: vi.fn(), + deleteFocusSchedule: vi.fn(), + }, +})) + +vi.mock('../workflowApi', () => ({ + WorkflowApi: { + getWorkflowById: vi.fn(), + }, +})) + +// Mock crypto.randomUUID for consistent test IDs +Object.defineProperty(globalThis, 'crypto', { + value: { + randomUUID: vi.fn(() => 'test-uuid-123'), + }, +}) + +describe('FocusScheduleApi', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + // === PASSTHROUGH FUNCTIONS (Simple success tests) === + + describe('getFocusSchedules', () => { + it('should return schedules successfully', async () => { + const mockSchedules: FocusSchedule[] = [{ + id: '1', + label: 'Test', + scheduled_time: '2024-01-15T09:00:00.000Z', + workflow_id: 'workflow-1', + is_active: 1, + created_at: '2024-01-01T00:00:00.000Z', + updated_at: '2024-01-01T00:00:00.000Z', + }] + vi.mocked(FocusScheduleRepo.getFocusSchedules).mockResolvedValue(mockSchedules) + + const result = await FocusScheduleApi.getFocusSchedules() + + expect(result).toBe(mockSchedules) + }) + }) + + describe('getFocusSchedulesWithWorkflow', () => { + it('should return schedules with workflow successfully', async () => { + const mockSchedules: (FocusSchedule & { workflow_name?: string })[] = [{ + id: '1', + label: 'Test', + scheduled_time: '2024-01-15T09:00:00.000Z', + workflow_id: 'workflow-1', + is_active: 1, + created_at: '2024-01-01T00:00:00.000Z', + updated_at: '2024-01-01T00:00:00.000Z', + workflow_name: 'Deep Work' + }] + vi.mocked(FocusScheduleRepo.getFocusSchedulesWithWorkflow).mockResolvedValue(mockSchedules) + + const result = await FocusScheduleApi.getFocusSchedulesWithWorkflow() + + expect(result).toBe(mockSchedules) + }) + }) + + describe('getFocusScheduleById', () => { + it('should return schedule by id successfully', async () => { + const mockSchedule: FocusSchedule = { + id: '1', + label: 'Test', + scheduled_time: '2024-01-15T09:00:00.000Z', + workflow_id: 'workflow-1', + is_active: 1, + created_at: '2024-01-01T00:00:00.000Z', + updated_at: '2024-01-01T00:00:00.000Z', + } + vi.mocked(FocusScheduleRepo.getFocusScheduleById).mockResolvedValue(mockSchedule) + + const result = await FocusScheduleApi.getFocusScheduleById('1') + + expect(result).toBe(mockSchedule) + }) + }) + + describe('deleteFocusSchedule', () => { + it('should delete schedule successfully', async () => { + const mockResult: QueryResult = { rowsAffected: 1 } + vi.mocked(FocusScheduleRepo.deleteFocusSchedule).mockResolvedValue(mockResult) + + const result = await FocusScheduleApi.deleteFocusSchedule('1') + + expect(result).toBe(mockResult) + }) + }) + + // === BUSINESS LOGIC + DATA TRANSFORMATION FUNCTIONS === + + describe('createFocusSchedule', () => { + const mockWorkflow: Workflow = { + id: 'workflow-1', + name: 'Deep Work', + selectedApps: [], + settings: { + typewriterMode: false, + hasBreathing: false, + hasMusic: false, + defaultDuration: null, + } + } + const mockScheduledTime = new Date('2024-01-15T09:00:00Z') + const mockRecurrence: RecurrenceSettings = { type: 'daily' } + + beforeEach(() => { + vi.mocked(WorkflowApi.getWorkflowById).mockResolvedValue(mockWorkflow) + const mockResult: QueryResult = { rowsAffected: 1 } + vi.mocked(FocusScheduleRepo.createFocusSchedule).mockResolvedValue(mockResult) + }) + + // Test business logic: workflow validation + it('should throw error when workflow not found', async () => { + vi.mocked(WorkflowApi.getWorkflowById).mockResolvedValue(null) + + await expect( + FocusScheduleApi.createFocusSchedule('invalid-workflow', mockScheduledTime, mockRecurrence) + ).rejects.toThrow('Workflow not found') + }) + + // Test data transformation: input parameters -> CreateFocusSchedule + it('should transform parameters correctly with all fields', async () => { + await FocusScheduleApi.createFocusSchedule( + 'workflow-1', + mockScheduledTime, + mockRecurrence, + 'Morning Focus' + ) + + expect(FocusScheduleRepo.createFocusSchedule).toHaveBeenCalledWith({ + id: 'test-uuid-123', + label: 'Morning Focus', + scheduled_time: '2024-01-15T09:00:00.000Z', + workflow_id: 'workflow-1', + recurrence_settings: '{"type":"daily"}', + is_active: 1, + }) + }) + + it('should transform parameters correctly without optional label', async () => { + await FocusScheduleApi.createFocusSchedule('workflow-1', mockScheduledTime, mockRecurrence) + + const call = vi.mocked(FocusScheduleRepo.createFocusSchedule).mock.calls[0][0] + expect(call.label).toBeUndefined() + expect(call.id).toBe('test-uuid-123') + expect(call.is_active).toBe(1) + }) + }) + + describe('updateFocusSchedule', () => { + beforeEach(() => { + const mockResult: QueryResult = { rowsAffected: 1 } + vi.mocked(FocusScheduleRepo.updateFocusSchedule).mockResolvedValue(mockResult) + }) + + // Test data transformation: update object -> partial CreateFocusSchedule + it('should transform all update fields correctly', async () => { + const updates = { + label: 'New Label', + workflowId: 'new-workflow', + scheduledTime: new Date('2024-01-16T10:00:00Z'), + recurrence: { type: 'weekly' as const, daysOfWeek: [1, 2, 3] } + } + + await FocusScheduleApi.updateFocusSchedule('schedule-1', updates) + + expect(FocusScheduleRepo.updateFocusSchedule).toHaveBeenCalledWith('schedule-1', { + label: 'New Label', + workflow_id: 'new-workflow', + scheduled_time: '2024-01-16T10:00:00.000Z', + recurrence_settings: '{"type":"weekly","daysOfWeek":[1,2,3]}' + }) + }) + + it('should handle partial updates and undefined values', async () => { + await FocusScheduleApi.updateFocusSchedule('schedule-1', { + label: undefined, + workflowId: 'new-workflow' + }) + + expect(FocusScheduleRepo.updateFocusSchedule).toHaveBeenCalledWith('schedule-1', { + label: undefined, + workflow_id: 'new-workflow' + }) + }) + }) + + describe('formatScheduleDisplay', () => { + const baseSchedule = { + id: '1', + scheduled_time: '2024-01-15T09:00:00Z', // 9 AM UTC + workflow_id: 'workflow-1', + is_active: 1, + created_at: '2024-01-01T00:00:00Z', + updated_at: '2024-01-01T00:00:00Z' + } + + // Test business logic: different recurrence types + it('should format one-time schedule (no recurrence)', () => { + const schedule = { ...baseSchedule, recurrence: { type: 'none' as const } } + + const result = FocusScheduleApi.formatScheduleDisplay(schedule) + + expect(result).toMatch(/\d{1,2}\/\d{1,2}\/\d{4} at \d{1,2}:\d{2} (AM|PM)/) + }) + + it('should format daily recurring schedule', () => { + const schedule = { ...baseSchedule, recurrence: { type: 'daily' as const } } + + const result = FocusScheduleApi.formatScheduleDisplay(schedule) + + expect(result).toMatch(/Daily at \d{1,2}:\d{2} (AM|PM)/) + }) + + it('should format single day weekly schedule', () => { + const schedule = { ...baseSchedule, recurrence: { type: 'weekly' as const, daysOfWeek: [1] } } + + const result = FocusScheduleApi.formatScheduleDisplay(schedule) + + expect(result).toMatch(/Mon at \d{1,2}:\d{2} (AM|PM)/) + }) + + it('should format two day weekly schedule', () => { + const schedule = { ...baseSchedule, recurrence: { type: 'weekly' as const, daysOfWeek: [1, 3] } } + + const result = FocusScheduleApi.formatScheduleDisplay(schedule) + + expect(result).toMatch(/Mon and Wed at \d{1,2}:\d{2} (AM|PM)/) + }) + + it('should format multi-day weekly schedule', () => { + const schedule = { ...baseSchedule, recurrence: { type: 'weekly' as const, daysOfWeek: [1, 2, 3, 4, 5] } } + + const result = FocusScheduleApi.formatScheduleDisplay(schedule) + + expect(result).toMatch(/Mon, Tue, Wed, Thu, and Fri at \d{1,2}:\d{2} (AM|PM)/) + }) + + it('should handle edge cases gracefully', () => { + // Empty days array + const invalidSchedule = { ...baseSchedule, recurrence: { type: 'weekly' as const, daysOfWeek: [] } } + expect(FocusScheduleApi.formatScheduleDisplay(invalidSchedule)).toBe('Invalid schedule') + + // No recurrence property + const noRecurrence = { ...baseSchedule } + expect(FocusScheduleApi.formatScheduleDisplay(noRecurrence)).toMatch(/\d{1,2}\/\d{1,2}\/\d{4} at \d{1,2}:\d{2} (AM|PM)/) + }) + }) +}) From 8d97f9c275851960620e37786d6cbc361928b9fc Mon Sep 17 00:00:00 2001 From: Paul Hovley Date: Sun, 10 Aug 2025 14:51:20 -0600 Subject: [PATCH 2/4] Add repo layer tests --- package-lock.json | 1703 ++++++++++++++++- package.json | 2 + src/CLAUDE.md | 125 ++ .../ebb/__tests__/focusScheduleRepo.test.ts | 353 ++++ src/lib/utils/__tests__/testDb.util.test.ts | 228 +++ .../utils/__tests__/testMigrations.test.ts | 190 ++ src/lib/utils/testDb.util.ts | 130 ++ src/lib/utils/testMigrations.ts | 307 +++ 8 files changed, 3022 insertions(+), 16 deletions(-) create mode 100644 src/db/ebb/__tests__/focusScheduleRepo.test.ts create mode 100644 src/lib/utils/__tests__/testDb.util.test.ts create mode 100644 src/lib/utils/__tests__/testMigrations.test.ts create mode 100644 src/lib/utils/testDb.util.ts create mode 100644 src/lib/utils/testMigrations.ts diff --git a/package-lock.json b/package-lock.json index 25ba4781..94162df9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,6 +69,7 @@ "@types/node": "^22.17.1", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", + "@types/sqlite3": "^3.1.11", "@typescript-eslint/eslint-plugin": "^8.19.1", "@typescript-eslint/parser": "^8.19.1", "@vitejs/plugin-react": "^4.2.1", @@ -79,6 +80,7 @@ "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.2.1", "postcss": "^8.4.49", + "sqlite3": "^5.1.7", "tailwindcss": "^3.4.17", "typescript": "^5.4.5", "typescript-eslint": "^8.19.1", @@ -1019,6 +1021,14 @@ "integrity": "sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==", "license": "MIT" }, + "node_modules/@gar/promisify": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", + "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", + "dev": true, + "license": "MIT", + "optional": true + }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -1231,6 +1241,48 @@ "node": ">=12.4.0" } }, + "node_modules/@npmcli/fs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", + "integrity": "sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "@gar/promisify": "^1.0.1", + "semver": "^7.3.5" + } + }, + "node_modules/@npmcli/fs/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/move-file": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", + "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", + "deprecated": "This functionality has been moved to @npmcli/fs", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -3225,6 +3277,17 @@ "@tauri-apps/api": "^2.6.0" } }, + "node_modules/@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/@tybys/wasm-util": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", @@ -3415,6 +3478,16 @@ "@types/react": "^18.0.0" } }, + "node_modules/@types/sqlite3": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/@types/sqlite3/-/sqlite3-3.1.11.tgz", + "integrity": "sha512-KYF+QgxAnnAh7DWPdNDroxkDI3/MspH1NMx6m/N/6fT1G6+jvsw4/ZePt8R8cr7ta58aboeTfYFBDxTJ5yv15w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/ws": { "version": "8.18.1", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", @@ -4017,6 +4090,14 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/acorn": { "version": "8.14.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", @@ -4051,6 +4132,35 @@ "node": ">= 6.0.0" } }, + "node_modules/agentkeepalive": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", + "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -4111,6 +4221,30 @@ "node": ">= 8" } }, + "node_modules/aproba": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.1.0.tgz", + "integrity": "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/are-we-there-yet": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", + "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", @@ -4336,6 +4470,27 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -4348,6 +4503,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -4401,6 +4578,31 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -4411,6 +4613,122 @@ "node": ">=8" } }, + "node_modules/cacache": { + "version": "15.3.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", + "integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "@npmcli/fs": "^1.0.0", + "@npmcli/move-file": "^1.0.1", + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "infer-owner": "^1.0.4", + "lru-cache": "^6.0.0", + "minipass": "^3.1.1", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.1", + "tar": "^6.0.2", + "unique-filename": "^1.1.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/cacache/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/cacache/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/cacache/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cacache/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/cacache/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacache/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/call-bind": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", @@ -4588,6 +4906,16 @@ "node": ">= 6" } }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, "node_modules/class-variance-authority": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz", @@ -4600,6 +4928,17 @@ "url": "https://polar.sh/cva" } }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -4652,6 +4991,17 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "license": "MIT" }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true, + "license": "ISC", + "optional": true, + "bin": { + "color-support": "bin.js" + } + }, "node_modules/commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", @@ -4668,6 +5018,14 @@ "dev": true, "license": "MIT" }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -4934,6 +5292,22 @@ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", "license": "MIT" }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/deep-eql": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", @@ -4944,6 +5318,16 @@ "node": ">=6" } }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -4987,14 +5371,32 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/detect-node-es": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", - "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==", - "license": "MIT" + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "dev": true, + "license": "MIT", + "optional": true }, - "node_modules/didyoumean": { - "version": "1.2.2", + "node_modules/detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-node-es": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", + "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==", + "license": "MIT" + }, + "node_modules/didyoumean": { + "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "license": "Apache-2.0" @@ -5072,6 +5474,45 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "license": "MIT" }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true, + "license": "MIT", + "optional": true + }, "node_modules/es-abstract": { "version": "1.23.9", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.9.tgz", @@ -5702,6 +6143,16 @@ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "license": "MIT" }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "dev": true, + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, "node_modules/expect-type": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.1.tgz", @@ -5805,6 +6256,13 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "license": "MIT" + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -5928,6 +6386,46 @@ } } }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true, + "license": "MIT" + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-minipass/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -5988,6 +6486,60 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gauge": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", + "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^3.0.7", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/gauge/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/gauge/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/gauge/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -6074,6 +6626,13 @@ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "dev": true, + "license": "MIT" + }, "node_modules/glob": { "version": "9.3.5", "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz", @@ -6157,6 +6716,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -6244,6 +6811,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", @@ -6271,6 +6846,30 @@ "integrity": "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w==", "license": "MIT" }, + "node_modules/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true + }, + "node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -6284,6 +6883,51 @@ "node": ">= 6" } }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -6321,6 +6965,25 @@ "node": ">=0.8.19" } }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -6340,6 +7003,13 @@ "dev": true, "license": "ISC" }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, + "license": "ISC" + }, "node_modules/internal-slot": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", @@ -6364,6 +7034,21 @@ "node": ">=12" } }, + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/is-array-buffer": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", @@ -6598,6 +7283,14 @@ "node": ">=0.10.0" } }, + "node_modules/is-lambda": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", + "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", + "dev": true, + "license": "MIT", + "optional": true + }, "node_modules/is-map": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", @@ -6848,6 +7541,14 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true, + "license": "MIT", + "optional": true + }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -7021,6 +7722,71 @@ "node": ">=12" } }, + "node_modules/make-fetch-happen": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", + "integrity": "sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "agentkeepalive": "^4.1.3", + "cacache": "^15.2.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^6.0.0", + "minipass": "^3.1.3", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^1.3.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.2", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^6.0.0", + "ssri": "^8.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/make-fetch-happen/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-fetch-happen/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/make-fetch-happen/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -7052,6 +7818,19 @@ "node": ">=8.6" } }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -7086,17 +7865,256 @@ "node": ">=8" } }, - "node_modules/motion": { - "version": "11.18.2", - "resolved": "https://registry.npmjs.org/motion/-/motion-11.18.2.tgz", - "integrity": "sha512-JLjvFDuFr42NFtcVoMAyC2sEjnpA8xpy6qWPyzQvCloznAyQ8FIXioxWfHiLtgYhoVpfUqSWpn1h9++skj9+Wg==", - "license": "MIT", + "node_modules/minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "license": "ISC", + "optional": true, "dependencies": { - "framer-motion": "^11.18.2", - "tslib": "^2.4.0" + "minipass": "^3.0.0" }, - "peerDependencies": { - "@emotion/is-prop-valid": "*", + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-collect/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-collect/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/minipass-fetch": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz", + "integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "minipass": "^3.1.0", + "minipass-sized": "^1.0.3", + "minizlib": "^2.0.0" + }, + "engines": { + "node": ">=8" + }, + "optionalDependencies": { + "encoding": "^0.1.12" + } + }, + "node_modules/minipass-fetch/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-fetch/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-flush/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/motion": { + "version": "11.18.2", + "resolved": "https://registry.npmjs.org/motion/-/motion-11.18.2.tgz", + "integrity": "sha512-JLjvFDuFr42NFtcVoMAyC2sEjnpA8xpy6qWPyzQvCloznAyQ8FIXioxWfHiLtgYhoVpfUqSWpn1h9++skj9+Wg==", + "license": "MIT", + "dependencies": { + "framer-motion": "^11.18.2", + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, @@ -7162,6 +8180,13 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "dev": true, + "license": "MIT" + }, "node_modules/napi-postinstall": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.1.5.tgz", @@ -7185,6 +8210,50 @@ "dev": true, "license": "MIT" }, + "node_modules/negotiator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-abi": { + "version": "3.75.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.75.0.tgz", + "integrity": "sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true, + "license": "MIT" + }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -7205,12 +8274,118 @@ } } }, + "node_modules/node-gyp": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", + "integrity": "sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "env-paths": "^2.2.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^9.1.0", + "nopt": "^5.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": ">= 10.12.0" + } + }, + "node_modules/node-gyp/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/node-gyp/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/node-gyp/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/node-releases": { "version": "2.0.19", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", "license": "MIT" }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -7230,6 +8405,24 @@ "node": ">=0.10.0" } }, + "node_modules/npmlog": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", + "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "are-we-there-yet": "^3.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^4.0.3", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -7420,6 +8613,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/package-json-from-dist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", @@ -7797,6 +9007,33 @@ "url": "https://opencollective.com/preact" } }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -7846,6 +9083,29 @@ "node": ">=0.4.0" } }, + "node_modules/promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -7863,6 +9123,17 @@ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "license": "MIT" }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -7908,6 +9179,32 @@ ], "license": "MIT" }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", @@ -8111,6 +9408,21 @@ "pify": "^2.3.0" } }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -8251,6 +9563,17 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/reusify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", @@ -8407,6 +9730,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/safe-push-apply": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", @@ -8442,6 +9786,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT", + "optional": true + }, "node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", @@ -8460,6 +9811,14 @@ "semver": "bin/semver.js" } }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/set-cookie-parser": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", @@ -8627,6 +9986,97 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.6.tgz", + "integrity": "sha512-pe4Y2yzru68lXCb38aAqRf5gvN8YdjP1lok5o0J7BOHljkyCGKVz7H3vpVIXKD27rj2giOJ7DwVyk/GWrPHDWA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-6.2.1.tgz", + "integrity": "sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, "node_modules/sonner": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.3.tgz", @@ -8646,6 +10096,75 @@ "node": ">=0.10.0" } }, + "node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/sqlite3": { + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.7.tgz", + "integrity": "sha512-GGIyOiFaG+TUra3JIfkI/zGP8yZYLPQ0pl1bH+ODjiX57sPhrLU5sQJn1y9bDKZUFYkX1crlrPfSYt0BKKdkog==", + "dev": true, + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^7.0.0", + "prebuild-install": "^7.1.1", + "tar": "^6.1.11" + }, + "optionalDependencies": { + "node-gyp": "8.x" + }, + "peerDependencies": { + "node-gyp": "8.x" + }, + "peerDependenciesMeta": { + "node-gyp": { + "optional": true + } + } + }, + "node_modules/ssri": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ssri/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ssri/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC", + "optional": true + }, "node_modules/stable-hash": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz", @@ -8667,6 +10186,16 @@ "dev": true, "license": "MIT" }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -9001,6 +10530,78 @@ "tailwindcss": ">=3.0.0 || insiders" } }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dev": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar-fs": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.3.tgz", + "integrity": "sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-fs/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true, + "license": "ISC" + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -9193,6 +10794,19 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, "node_modules/turbo-stream": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", @@ -9365,6 +10979,28 @@ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "license": "MIT" }, + "node_modules/unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "unique-slug": "^2.0.0" + } + }, + "node_modules/unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "imurmurhash": "^0.1.4" + } + }, "node_modules/unplugin": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.0.1.tgz", @@ -9906,6 +11542,41 @@ "node": ">=8" } }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wide-align/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/wide-align/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", diff --git a/package.json b/package.json index 6d089920..97c0f74f 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "@types/node": "^22.17.1", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", + "@types/sqlite3": "^3.1.11", "@typescript-eslint/eslint-plugin": "^8.19.1", "@typescript-eslint/parser": "^8.19.1", "@vitejs/plugin-react": "^4.2.1", @@ -94,6 +95,7 @@ "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.2.1", "postcss": "^8.4.49", + "sqlite3": "^5.1.7", "tailwindcss": "^3.4.17", "typescript": "^5.4.5", "typescript-eslint": "^8.19.1", diff --git a/src/CLAUDE.md b/src/CLAUDE.md index 291b4ce8..f14ba685 100644 --- a/src/CLAUDE.md +++ b/src/CLAUDE.md @@ -280,6 +280,29 @@ export default function FlowSessionList() { - Use generic types for repository patterns - Leverage discriminated unions for state management +## Required Development Validation + +**CRITICAL: Always run these commands before considering development complete:** + +```bash +# 1. REQUIRED: Run linting and fix any errors +npm run lint + +# 2. REQUIRED: Fix any auto-fixable issues +npm run format + +# 3. REQUIRED: Ensure TypeScript compilation and build succeed +npm run build + +# 4. RECOMMENDED: Run tests to validate functionality +npm test +``` + +**All commands must pass without errors before:** +- Committing code changes +- Creating pull requests +- Considering a task complete + ## Testing ### Testing Strategy @@ -364,6 +387,108 @@ describe('formatScheduleDisplay', () => { }) ``` +### Repository Layer Testing Patterns + +Repository tests focus on database operations and SQL query behavior. **Priority areas for testing:** + +**1. WHERE Conditions** +Test filtering logic to ensure correct data is returned: + +```typescript +it('should only return active records (is_active = 1)', async () => { + // Insert mix of active/inactive records + await testDb.execute(` + INSERT INTO focus_schedule (id, workflow_id, is_active) + VALUES ('active-1', 'workflow-1', 1), ('inactive-1', 'workflow-1', 0) + `) + + const results = await FocusScheduleRepo.getFocusSchedules() + + expect(results.every(r => r.is_active === 1)).toBe(true) + expect(results.find(r => r.id === 'inactive-1')).toBeUndefined() +}) +``` + +**2. ORDER BY Clauses** +Test sorting behavior by inserting data in non-sorted order: + +```typescript +it('should order by scheduled_time ASC', async () => { + // Insert in non-chronological order + await testDb.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active) + VALUES + ('late', '2024-01-17T15:00:00Z', 'workflow-1', 1), + ('early', '2024-01-15T09:00:00Z', 'workflow-1', 1), + ('middle', '2024-01-16T12:00:00Z', 'workflow-1', 1) + `) + + const results = await FocusScheduleRepo.getFocusSchedules() + + const times = results.map(r => r.scheduled_time) + expect(times).toEqual([...times].sort()) // Should be sorted +}) +``` + +**3. Data Transformations** +Test field renaming, JSON parsing, and virtual field creation: + +```typescript +it('should parse JSON and create virtual fields', async () => { + await testDb.execute(` + INSERT INTO focus_schedule (id, recurrence_settings, workflow_id, is_active) + VALUES ('test', '{"type":"daily","daysOfWeek":[1,2,3]}', 'workflow-1', 1) + `) + + const result = await FocusScheduleRepo.getFocusScheduleById('test') + + // JSON parsed into virtual field + expect(result.recurrence).toEqual({ type: 'daily', daysOfWeek: [1,2,3] }) +}) + +it('should add fields from JOINs', async () => { + await testDb.execute(` + INSERT INTO workflow (id, name, settings) VALUES ('wf-1', 'Deep Work', '{}'); + INSERT INTO focus_schedule (id, workflow_id, is_active) VALUES ('fs-1', 'wf-1', 1); + `) + + const results = await FocusScheduleRepo.getFocusSchedulesWithWorkflow() + + expect(results[0]).toHaveProperty('workflow_name', 'Deep Work') +}) +``` + +**Repository Test Setup Pattern:** + +```typescript +import { createEbbTestDatabase } from '@/lib/utils/testDb.util' +import { getEbbDb } from '../ebbDb' + +// Mock the database connection +vi.mock('../ebbDb', () => ({ + getEbbDb: vi.fn() +})) + +// Mock UUID generation for consistent tests +Object.defineProperty(globalThis, 'self', { + value: { crypto: { randomUUID: vi.fn(() => 'test-uuid-123') } } +}) + +describe('SomeRepo', () => { + let testDb: Database + + beforeEach(async () => { + testDb = await createEbbTestDatabase() // Schema already applied + vi.mocked(getEbbDb).mockResolvedValue(testDb) + }) + + afterEach(async () => { + if (testDb) await testDb.close() + vi.clearAllMocks() + }) +}) +``` + ### React Query Hooks Testing Policy **Generally, do not test React Query hooks** unless otherwise directed diff --git a/src/db/ebb/__tests__/focusScheduleRepo.test.ts b/src/db/ebb/__tests__/focusScheduleRepo.test.ts new file mode 100644 index 00000000..aa0b4a2f --- /dev/null +++ b/src/db/ebb/__tests__/focusScheduleRepo.test.ts @@ -0,0 +1,353 @@ +import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest' +import { FocusScheduleRepo, type CreateFocusSchedule } from '../focusScheduleRepo' +import { createEbbTestDatabase } from '@/lib/utils/testDb.util' +import { getEbbDb } from '../ebbDb' +import type Database from '@tauri-apps/plugin-sql' + +// Mock the getEbbDb function to use our test database +vi.mock('../ebbDb', () => ({ + getEbbDb: vi.fn() +})) + +// Mock crypto.randomUUID for predictable IDs +Object.defineProperty(globalThis, 'crypto', { + value: { + randomUUID: vi.fn(() => 'test-uuid-123'), + }, +}) + +// Mock self.crypto (used in repository code) +Object.defineProperty(globalThis, 'self', { + value: { + crypto: { + randomUUID: vi.fn(() => 'test-uuid-123'), + }, + }, +}) + +describe('FocusScheduleRepo', () => { + let testDb: Database + + beforeEach(async () => { + testDb = await createEbbTestDatabase() + vi.mocked(getEbbDb).mockResolvedValue(testDb) + }) + + afterEach(async () => { + if (testDb) { + await testDb.close() + } + vi.clearAllMocks() + }) + + describe('WHERE condition filtering', () => { + beforeEach(async () => { + // Create test workflow for foreign key constraint + await testDb.execute(` + INSERT INTO workflow (id, name, settings) + VALUES ('workflow-1', 'Test Workflow', '{}') + `) + + // Insert test data with mix of active/inactive schedules + await testDb.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active, recurrence_settings) + VALUES + ('active-1', '2024-01-15T09:00:00Z', 'workflow-1', 1, '{"type":"daily"}'), + ('active-2', '2024-01-16T10:00:00Z', 'workflow-1', 1, '{"type":"weekly","daysOfWeek":[1,2,3]}'), + ('inactive-1', '2024-01-17T11:00:00Z', 'workflow-1', 0, '{"type":"none"}'), + ('active-3', '2024-01-14T08:00:00Z', 'workflow-1', 1, NULL) + `) + }) + + it('getFocusSchedules should only return active schedules (is_active = 1)', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedules() + + expect(schedules).toHaveLength(3) + expect(schedules.every(s => s.is_active === 1)).toBe(true) + + const ids = schedules.map(s => s.id) + expect(ids).toContain('active-1') + expect(ids).toContain('active-2') + expect(ids).toContain('active-3') + expect(ids).not.toContain('inactive-1') + }) + + it('getFocusScheduleById should only return active schedule by id', async () => { + // Should find active schedule + const activeSchedule = await FocusScheduleRepo.getFocusScheduleById('active-1') + expect(activeSchedule).toBeDefined() + expect(activeSchedule!.id).toBe('active-1') + + // Should not find inactive schedule even with valid ID + const inactiveSchedule = await FocusScheduleRepo.getFocusScheduleById('inactive-1') + expect(inactiveSchedule).toBeUndefined() + + // Should not find non-existent schedule + const nonExistent = await FocusScheduleRepo.getFocusScheduleById('non-existent') + expect(nonExistent).toBeUndefined() + }) + + it('getFocusSchedulesWithWorkflow should only return active schedules', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedulesWithWorkflow() + + expect(schedules).toHaveLength(3) + expect(schedules.every(s => s.is_active === 1)).toBe(true) + + const ids = schedules.map(s => s.id) + expect(ids).not.toContain('inactive-1') + }) + }) + + describe('ORDER BY scheduled_time ASC', () => { + beforeEach(async () => { + await testDb.execute(` + INSERT INTO workflow (id, name, settings) + VALUES ('workflow-1', 'Test Workflow', '{}') + `) + + // Insert schedules in non-chronological order + await testDb.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active) + VALUES + ('schedule-c', '2024-01-17T15:00:00Z', 'workflow-1', 1), + ('schedule-a', '2024-01-15T09:00:00Z', 'workflow-1', 1), + ('schedule-d', '2024-01-18T16:00:00Z', 'workflow-1', 1), + ('schedule-b', '2024-01-16T12:00:00Z', 'workflow-1', 1) + `) + }) + + it('getFocusSchedules should order by scheduled_time ASC', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedules() + + expect(schedules).toHaveLength(4) + + const scheduledTimes = schedules.map(s => s.scheduled_time) + const sortedTimes = [...scheduledTimes].sort() + + expect(scheduledTimes).toEqual(sortedTimes) + + // Verify specific order + expect(schedules[0].id).toBe('schedule-a') // 2024-01-15 + expect(schedules[1].id).toBe('schedule-b') // 2024-01-16 + expect(schedules[2].id).toBe('schedule-c') // 2024-01-17 + expect(schedules[3].id).toBe('schedule-d') // 2024-01-18 + }) + + it('getFocusSchedulesWithWorkflow should order by scheduled_time ASC', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedulesWithWorkflow() + + expect(schedules).toHaveLength(4) + + const scheduledTimes = schedules.map(s => s.scheduled_time) + const sortedTimes = [...scheduledTimes].sort() + + expect(scheduledTimes).toEqual(sortedTimes) + }) + }) + + describe('JSON parsing transformation (recurrence_settings → recurrence)', () => { + beforeEach(async () => { + await testDb.execute(` + INSERT INTO workflow (id, name, settings) + VALUES ('workflow-1', 'Test Workflow', '{}') + `) + + await testDb.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active, recurrence_settings) + VALUES + ('daily-schedule', '2024-01-15T09:00:00Z', 'workflow-1', 1, '{"type":"daily"}'), + ('weekly-schedule', '2024-01-16T10:00:00Z', 'workflow-1', 1, '{"type":"weekly","daysOfWeek":[1,3,5]}'), + ('no-recurrence', '2024-01-17T11:00:00Z', 'workflow-1', 1, NULL), + ('empty-recurrence', '2024-01-18T12:00:00Z', 'workflow-1', 1, '') + `) + }) + + it('getFocusSchedules should parse recurrence_settings JSON correctly', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedules() + + const dailySchedule = schedules.find(s => s.id === 'daily-schedule')! + expect(dailySchedule.recurrence).toEqual({ type: 'daily' }) + + const weeklySchedule = schedules.find(s => s.id === 'weekly-schedule')! + expect(weeklySchedule.recurrence).toEqual({ + type: 'weekly', + daysOfWeek: [1, 3, 5] + }) + + const noRecurrence = schedules.find(s => s.id === 'no-recurrence')! + expect(noRecurrence.recurrence).toBeUndefined() + + const emptyRecurrence = schedules.find(s => s.id === 'empty-recurrence')! + expect(emptyRecurrence.recurrence).toBeUndefined() + }) + + it('getFocusScheduleById should parse recurrence_settings JSON correctly', async () => { + const schedule = await FocusScheduleRepo.getFocusScheduleById('weekly-schedule') + + expect(schedule!.recurrence).toEqual({ + type: 'weekly', + daysOfWeek: [1, 3, 5] + }) + }) + + it('getFocusSchedulesWithWorkflow should parse recurrence_settings JSON correctly', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedulesWithWorkflow() + + const dailySchedule = schedules.find(s => s.id === 'daily-schedule')! + expect(dailySchedule.recurrence).toEqual({ type: 'daily' }) + }) + }) + + describe('JOIN transformation (adding workflow_name field)', () => { + beforeEach(async () => { + // Create multiple workflows + await testDb.execute(` + INSERT INTO workflow (id, name, settings) + VALUES + ('workflow-1', 'Deep Work', '{}'), + ('workflow-2', 'Quick Tasks', '{}'), + ('workflow-3', 'Meeting Prep', '{}') + `) + + await testDb.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active) + VALUES + ('schedule-1', '2024-01-15T09:00:00Z', 'workflow-1', 1), + ('schedule-2', '2024-01-16T10:00:00Z', 'workflow-2', 1), + ('schedule-orphan', '2024-01-17T11:00:00Z', 'non-existent-workflow', 1) + `) + }) + + it('should add workflow_name field from JOIN', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedulesWithWorkflow() + + const schedule1 = schedules.find(s => s.id === 'schedule-1')! + expect(schedule1.workflow_name).toBe('Deep Work') + + const schedule2 = schedules.find(s => s.id === 'schedule-2')! + expect(schedule2.workflow_name).toBe('Quick Tasks') + }) + + it('should handle LEFT JOIN when workflow does not exist', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedulesWithWorkflow() + + const orphanSchedule = schedules.find(s => s.id === 'schedule-orphan')! + expect(orphanSchedule).toBeDefined() + expect(orphanSchedule.workflow_name).toBeNull() // LEFT JOIN returns NULL for missing workflow + }) + + it('should include all original focus_schedule fields plus workflow_name', async () => { + const schedules = await FocusScheduleRepo.getFocusSchedulesWithWorkflow() + + expect(schedules.length).toBeGreaterThan(0) + const schedule = schedules[0] + + // Original fields should be present + expect(schedule).toHaveProperty('id') + expect(schedule).toHaveProperty('scheduled_time') + expect(schedule).toHaveProperty('workflow_id') + expect(schedule).toHaveProperty('is_active') + expect(schedule).toHaveProperty('created_at') + expect(schedule).toHaveProperty('updated_at') + + // New joined field should be present + expect(schedule).toHaveProperty('workflow_name') + }) + }) + + describe('soft delete behavior', () => { + beforeEach(async () => { + await testDb.execute(` + INSERT INTO workflow (id, name, settings) + VALUES ('workflow-1', 'Test Workflow', '{}') + `) + + await testDb.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active) + VALUES ('schedule-to-delete', '2024-01-15T09:00:00Z', 'workflow-1', 1) + `) + }) + + it('deleteFocusSchedule should set is_active to 0 instead of deleting', async () => { + // Verify schedule exists and is active + const beforeDelete = await FocusScheduleRepo.getFocusScheduleById('schedule-to-delete') + expect(beforeDelete).toBeDefined() + expect(beforeDelete!.is_active).toBe(1) + + // Delete the schedule + const result = await FocusScheduleRepo.deleteFocusSchedule('schedule-to-delete') + expect(result.rowsAffected).toBe(1) + + // Verify schedule still exists in database but is inactive + const rawResult = await testDb.select>( + 'SELECT id, is_active FROM focus_schedule WHERE id = ?', + ['schedule-to-delete'] + ) + + expect(rawResult).toHaveLength(1) + expect(rawResult[0].is_active).toBe(0) // Should be marked inactive + + // Verify it no longer appears in active queries + const afterDelete = await FocusScheduleRepo.getFocusScheduleById('schedule-to-delete') + expect(afterDelete).toBeUndefined() + + const allActive = await FocusScheduleRepo.getFocusSchedules() + expect(allActive.find(s => s.id === 'schedule-to-delete')).toBeUndefined() + }) + }) + + describe('create and update operations', () => { + beforeEach(async () => { + await testDb.execute(` + INSERT INTO workflow (id, name, settings) + VALUES ('workflow-1', 'Test Workflow', '{}') + `) + }) + + it('createFocusSchedule should insert with generated UUID', async () => { + const createData: CreateFocusSchedule = { + id: 'will-be-overridden', + scheduled_time: '2024-01-15T09:00:00Z', + workflow_id: 'workflow-1', + is_active: 1, + recurrence_settings: '{"type":"daily"}' + } + + const result = await FocusScheduleRepo.createFocusSchedule(createData) + expect(result.rowsAffected).toBe(1) + + // Verify it was created with mocked UUID + const created = await testDb.select>( + 'SELECT id FROM focus_schedule WHERE workflow_id = ?', + ['workflow-1'] + ) + + expect(created).toHaveLength(1) + expect(created[0].id).toBe('test-uuid-123') // From our mock + }) + + it('updateFocusSchedule should update specified fields', async () => { + // First create a schedule + await testDb.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active, label) + VALUES ('update-test', '2024-01-15T09:00:00Z', 'workflow-1', 1, 'Original Label') + `) + + // Update only the label + const result = await FocusScheduleRepo.updateFocusSchedule('update-test', { + label: 'Updated Label' + }) + expect(result.rowsAffected).toBe(1) + + // Verify the update + const updated = await testDb.select>( + 'SELECT label, scheduled_time FROM focus_schedule WHERE id = ?', + ['update-test'] + ) + + expect(updated[0].label).toBe('Updated Label') + expect(updated[0].scheduled_time).toBe('2024-01-15T09:00:00Z') // Should be unchanged + }) + }) +}) + diff --git a/src/lib/utils/__tests__/testDb.util.test.ts b/src/lib/utils/__tests__/testDb.util.test.ts new file mode 100644 index 00000000..35e718f1 --- /dev/null +++ b/src/lib/utils/__tests__/testDb.util.test.ts @@ -0,0 +1,228 @@ +import { describe, it, expect, beforeEach, afterEach } from 'vitest' +import { createTestDatabase, TestDatabaseManager, mockTauriDatabaseModules } from '../testDb.util' + +describe('testDb.util', () => { + describe('createTestDatabase', () => { + it('should create an in-memory SQLite database', async () => { + const db = await createTestDatabase() + + expect(db).toBeDefined() + expect(typeof db.execute).toBe('function') + expect(typeof db.select).toBe('function') + expect(typeof db.close).toBe('function') + + await db.close() + }) + + it('should allow creating tables and inserting data', async () => { + const db = await createTestDatabase() + + // Create a test table + const createResult = await db.execute(` + CREATE TABLE test_users ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + created_at TEXT DEFAULT CURRENT_TIMESTAMP + ) + `) + expect(createResult.rowsAffected).toBe(0) // CREATE TABLE doesn't affect rows + + // Insert test data + const insertResult = await db.execute( + 'INSERT INTO test_users (name) VALUES (?)', + ['John Doe'] + ) + expect(insertResult.rowsAffected).toBe(1) + + // Query the data back + const users = await db.select>( + 'SELECT * FROM test_users WHERE name = ?', + ['John Doe'] + ) + + expect(users).toHaveLength(1) + expect(users[0].name).toBe('John Doe') + expect(users[0].id).toBe(1) + expect(users[0].created_at).toBeTruthy() + + await db.close() + }) + + it('should handle multiple concurrent operations', async () => { + const db = await createTestDatabase() + + await db.execute(` + CREATE TABLE concurrent_test ( + id INTEGER PRIMARY KEY, + value TEXT + ) + `) + + // Insert multiple records concurrently + const insertPromises = Array.from({ length: 5 }, (_, i) => + db.execute('INSERT INTO concurrent_test (value) VALUES (?)', [`value-${i}`]) + ) + + const results = await Promise.all(insertPromises) + results.forEach(result => { + expect(result.rowsAffected).toBe(1) + }) + + // Verify all records were inserted + const records = await db.select('SELECT * FROM concurrent_test ORDER BY id') + expect(records).toHaveLength(5) + + await db.close() + }) + + it('should handle SQL errors gracefully', async () => { + const db = await createTestDatabase() + + // Try to select from non-existent table + await expect( + db.select('SELECT * FROM non_existent_table') + ).rejects.toThrow() + + // Try invalid SQL + await expect( + db.execute('INVALID SQL STATEMENT') + ).rejects.toThrow() + + await db.close() + }) + }) + + describe('TestDatabaseManager', () => { + let manager: TestDatabaseManager + + beforeEach(() => { + manager = new TestDatabaseManager() + }) + + afterEach(async () => { + await manager.cleanup() + }) + + it('should create and manage separate EBB and Monitor databases', async () => { + const ebbDb = await manager.getEbbTestDb() + const monitorDb = await manager.getMonitorTestDb() + + expect(ebbDb).toBeDefined() + expect(monitorDb).toBeDefined() + expect(ebbDb).not.toBe(monitorDb) // Should be different instances + }) + + it('should return the same database instance on multiple calls', async () => { + const ebbDb1 = await manager.getEbbTestDb() + const ebbDb2 = await manager.getEbbTestDb() + + expect(ebbDb1).toBe(ebbDb2) // Should be the same instance + }) + + it('should create isolated databases', async () => { + const ebbDb = await manager.getEbbTestDb() + const monitorDb = await manager.getMonitorTestDb() + + // Create different tables in each database + await ebbDb.execute('CREATE TABLE ebb_table (id INTEGER PRIMARY KEY, data TEXT)') + await monitorDb.execute('CREATE TABLE monitor_table (id INTEGER PRIMARY KEY, info TEXT)') + + // Insert data into EBB database + await ebbDb.execute('INSERT INTO ebb_table (data) VALUES (?)', ['ebb-data']) + + // Insert data into Monitor database + await monitorDb.execute('INSERT INTO monitor_table (info) VALUES (?)', ['monitor-info']) + + // Verify isolation - each database only has its own data + const ebbData = await ebbDb.select>('SELECT * FROM ebb_table') + expect(ebbData).toHaveLength(1) + expect(ebbData[0].data).toBe('ebb-data') + + const monitorData = await monitorDb.select>('SELECT * FROM monitor_table') + expect(monitorData).toHaveLength(1) + expect(monitorData[0].info).toBe('monitor-info') + + // Verify cross-database isolation + await expect( + ebbDb.select('SELECT * FROM monitor_table') + ).rejects.toThrow() // Table doesn't exist in EBB database + + await expect( + monitorDb.select('SELECT * FROM ebb_table') + ).rejects.toThrow() // Table doesn't exist in Monitor database + }) + + it('should cleanup databases properly', async () => { + const ebbDb = await manager.getEbbTestDb() + const monitorDb = await manager.getMonitorTestDb() + + // Create tables to verify they exist + await ebbDb.execute('CREATE TABLE test_cleanup (id INTEGER)') + await monitorDb.execute('CREATE TABLE test_cleanup (id INTEGER)') + + // Cleanup should close connections + await expect(manager.cleanup()).resolves.not.toThrow() + + // After cleanup, attempting to use the databases should fail + // Note: This might vary by SQLite implementation, but typically closed connections throw errors + await expect( + ebbDb.select('SELECT * FROM test_cleanup') + ).rejects.toThrow() + }) + }) + + describe('mockTauriDatabaseModules', () => { + it('should mock the required database modules', () => { + mockTauriDatabaseModules() + + // The actual verification of mocks would be done in integration tests + // Here we just verify the function runs without error + expect(() => mockTauriDatabaseModules()).not.toThrow() + }) + }) + + describe('Database interface compatibility', () => { + it('should implement the same interface as Tauri Database', async () => { + const db = await createTestDatabase() + + // Verify required methods exist with correct signatures + expect(db.execute).toBeInstanceOf(Function) + expect(db.select).toBeInstanceOf(Function) + expect(db.close).toBeInstanceOf(Function) + + // Test method signatures work as expected + const executeResult = await db.execute('CREATE TABLE interface_test (id INTEGER)') + expect(executeResult).toHaveProperty('rowsAffected') + expect(typeof executeResult.rowsAffected).toBe('number') + + const selectResult = await db.select('SELECT 1 as test_value') + expect(Array.isArray(selectResult)).toBe(true) + + await db.close() + }) + + it('should handle bind parameters the same way as Tauri Database', async () => { + const db = await createTestDatabase() + + await db.execute('CREATE TABLE param_test (id INTEGER PRIMARY KEY, name TEXT, count INTEGER)') + + // Test with positional parameters + await db.execute( + 'INSERT INTO param_test (name, count) VALUES (?, ?)', + ['test-name', 42] + ) + + const results = await db.select>( + 'SELECT * FROM param_test WHERE name = ? AND count = ?', + ['test-name', 42] + ) + + expect(results).toHaveLength(1) + expect(results[0].name).toBe('test-name') + expect(results[0].count).toBe(42) + + await db.close() + }) + }) +}) + diff --git a/src/lib/utils/__tests__/testMigrations.test.ts b/src/lib/utils/__tests__/testMigrations.test.ts new file mode 100644 index 00000000..22b02a98 --- /dev/null +++ b/src/lib/utils/__tests__/testMigrations.test.ts @@ -0,0 +1,190 @@ +import { describe, it, expect, afterEach } from 'vitest' +import { + runTestMigrations, + getLatestMigrationVersion, + verifyFocusScheduleSchema, + TEST_MIGRATIONS +} from '../testMigrations' +import { createTestDatabase, createEbbTestDatabase } from '../testDb.util' +import type Database from '@tauri-apps/plugin-sql' + +describe('testMigrations', () => { + let db: Database | null = null + + afterEach(async () => { + if (db) { + try { + await db.close() + } catch { + // Ignore errors from closing already closed database + } + db = null + } + }) + + describe('TEST_MIGRATIONS', () => { + it('should have migrations in correct order', () => { + const versions = TEST_MIGRATIONS.map(m => m.version) + const sortedVersions = [...versions].sort((a, b) => a - b) + + expect(versions).toEqual(sortedVersions) + }) + + it('should have unique version numbers', () => { + const versions = TEST_MIGRATIONS.map(m => m.version) + const uniqueVersions = new Set(versions) + + expect(uniqueVersions.size).toBe(versions.length) + }) + + it('should have non-empty SQL for each migration', () => { + TEST_MIGRATIONS.forEach(migration => { + expect(migration.sql.trim()).not.toBe('') + expect(migration.description).not.toBe('') + }) + }) + + it('should include focus_schedule table creation (our test case)', () => { + const focusScheduleMigration = TEST_MIGRATIONS.find( + m => m.description === 'create_focus_schedule' + ) + + expect(focusScheduleMigration).toBeDefined() + expect(focusScheduleMigration!.sql).toContain('CREATE TABLE IF NOT EXISTS focus_schedule') + }) + }) + + describe('runTestMigrations', () => { + it('should successfully run all migrations on empty database', async () => { + db = await createTestDatabase() + + await expect(runTestMigrations(db)).resolves.not.toThrow() + }) + + it('should create all expected tables', async () => { + db = await createTestDatabase() + await runTestMigrations(db) + + // Note: device table creation might fail in migration 14 due to re-running migrations + + const expectedTables = [ + 'flow_session', + 'flow_period', + 'blocking_preference', + 'workflow', + 'user_preference', // this still exists after migration 11 + 'device_profile', // renamed from user_profile in migration 14 + 'user_notification', + 'focus_schedule' // our key table + ] + + for (const tableName of expectedTables) { + const tables = await db.select>( + 'SELECT name FROM sqlite_master WHERE type=\'table\' AND name=?', + [tableName] + ) + + expect(tables).toHaveLength(1) + } + }) + + it('should handle migration errors gracefully', async () => { + db = await createTestDatabase() + + // First run migrations successfully + await runTestMigrations(db) + + // Running again should not fail (due to IF NOT EXISTS clauses) + await expect(runTestMigrations(db)).resolves.not.toThrow() + }) + }) + + describe('getLatestMigrationVersion', () => { + it('should return the highest migration version', () => { + const latest = getLatestMigrationVersion() + const maxVersion = Math.max(...TEST_MIGRATIONS.map(m => m.version)) + + expect(latest).toBe(maxVersion) + }) + + it('should return version 17 or higher (current schema)', () => { + const latest = getLatestMigrationVersion() + + expect(latest).toBeGreaterThanOrEqual(17) + }) + }) + + describe('verifyFocusScheduleSchema', () => { + it('should pass validation after migrations', async () => { + db = await createTestDatabase() + await runTestMigrations(db) + + await expect(verifyFocusScheduleSchema(db)).resolves.not.toThrow() + }) + + it('should fail validation on empty database', async () => { + db = await createTestDatabase() + + await expect(verifyFocusScheduleSchema(db)).rejects.toThrow('focus_schedule table does not exist') + }) + + it('should verify all required columns exist', async () => { + db = await createTestDatabase() + await runTestMigrations(db) + + // Get table schema + const columns = await db.select>( + 'PRAGMA table_info(focus_schedule)' + ) + + const columnNames = columns.map(c => c.name) + const expectedColumns = [ + 'id', 'label', 'scheduled_time', 'workflow_id', + 'recurrence_settings', 'is_active', 'created_at', 'updated_at' + ] + + for (const expectedCol of expectedColumns) { + expect(columnNames).toContain(expectedCol) + } + }) + }) + + describe('integration with createEbbTestDatabase', () => { + it('should create database with migrations already applied', async () => { + db = await createEbbTestDatabase() + + // Should pass schema validation immediately + await expect(verifyFocusScheduleSchema(db)).resolves.not.toThrow() + + // Should be able to insert data into focus_schedule + const insertResult = await db.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active) + VALUES (?, ?, ?, ?) + `, ['test-schedule-1', '2024-01-15T09:00:00Z', 'workflow-1', 1]) + + expect(insertResult.rowsAffected).toBe(1) + }) + + it('should enforce foreign key constraints', async () => { + db = await createEbbTestDatabase() + + // First create a workflow (referenced table) + await db.execute(` + INSERT INTO workflow (id, name, settings) + VALUES (?, ?, ?) + `, ['workflow-1', 'Test Workflow', '{}']) + + // Now create focus schedule with valid workflow_id + const validInsert = await db.execute(` + INSERT INTO focus_schedule (id, scheduled_time, workflow_id, is_active) + VALUES (?, ?, ?, ?) + `, ['test-schedule-1', '2024-01-15T09:00:00Z', 'workflow-1', 1]) + + expect(validInsert.rowsAffected).toBe(1) + + // Note: SQLite foreign key enforcement depends on PRAGMA foreign_keys=ON + // which might not be enabled in our test setup by default + }) + }) +}) + diff --git a/src/lib/utils/testDb.util.ts b/src/lib/utils/testDb.util.ts new file mode 100644 index 00000000..06293664 --- /dev/null +++ b/src/lib/utils/testDb.util.ts @@ -0,0 +1,130 @@ +import { Database as SQLiteDatabase, sqlite3 } from 'sqlite3' +import type Database from '@tauri-apps/plugin-sql' +import { vi } from 'vitest' +import { runTestMigrations } from './testMigrations' + +/** + * Test database wrapper that mimics Tauri's Database interface + * Uses sqlite3 directly for testing without Tauri runtime + */ +class TestDatabase { + private db: SQLiteDatabase + + constructor(db: SQLiteDatabase) { + this.db = db + } + + async execute(sql: string, bindValues?: unknown[]): Promise<{ rowsAffected: number }> { + return new Promise((resolve, reject) => { + this.db.run(sql, bindValues || [], function(this: sqlite3['RunResult'], err) { + if (err) { + reject(err) + } else { + // `this` refers to the RunResult which has the changes property + resolve({ rowsAffected: this.changes || 0 }) + } + }) + }) + } + + async select(sql: string, bindValues?: unknown[]): Promise { + return new Promise((resolve, reject) => { + this.db.all(sql, bindValues || [], (err, rows) => { + if (err) { + reject(err) + } else { + resolve(rows as T) + } + }) + }) + } + + async close(): Promise { + return new Promise((resolve, reject) => { + this.db.close((err) => { + if (err) reject(err) + else resolve() + }) + }) + } +} + +/** + * Create an in-memory SQLite database for testing + */ +export const createTestDatabase = async (): Promise => { + return new Promise((resolve, reject) => { + const db = new SQLiteDatabase(':memory:', (err) => { + if (err) { + reject(err) + } else { + resolve(new TestDatabase(db) as unknown as Database) + } + }) + }) +} + +/** + * Mock the Tauri database modules for testing + */ +export const mockTauriDatabaseModules = () => { + // Mock the ebbDb module + vi.doMock('@/db/ebb/ebbDb', () => ({ + getEbbDb: vi.fn(), + })) + + // Mock the monitorDb module + vi.doMock('@/db/monitor/monitorDb', () => ({ + MonitorDb: { + getMonitorDb: vi.fn(), + } + })) +} + +/** + * Test database manager for setting up isolated test databases with schema + */ +export class TestDatabaseManager { + private ebbTestDb: Database | null = null + private monitorTestDb: Database | null = null + + async getEbbTestDb(): Promise { + if (!this.ebbTestDb) { + this.ebbTestDb = await createTestDatabase() + // Run migrations to set up the schema + await runTestMigrations(this.ebbTestDb) + } + return this.ebbTestDb + } + + async getMonitorTestDb(): Promise { + if (!this.monitorTestDb) { + this.monitorTestDb = await createTestDatabase() + // Note: Monitor DB migrations would need to be added separately + // For now, this creates an empty database + } + return this.monitorTestDb + } + + async cleanup(): Promise { + if (this.ebbTestDb) { + await this.ebbTestDb.close() + this.ebbTestDb = null + } + if (this.monitorTestDb) { + await this.monitorTestDb.close() + this.monitorTestDb = null + } + } +} + +/** + * Create a test database with EBB schema already applied + * Convenience function for simple test cases + */ +export const createEbbTestDatabase = async (): Promise => { + const db = await createTestDatabase() + await runTestMigrations(db) + return db +} + diff --git a/src/lib/utils/testMigrations.ts b/src/lib/utils/testMigrations.ts new file mode 100644 index 00000000..0e140841 --- /dev/null +++ b/src/lib/utils/testMigrations.ts @@ -0,0 +1,307 @@ +import type Database from '@tauri-apps/plugin-sql' + +/** + * Test migrations extracted from Rust migrations.rs (src-tauri/src/ebb_db/src/migrations.rs) + * + * IMPORTANT: Keep in sync with Rust migrations when schema changes! + * Last synced: 2024-01-08 (version 17) + */ + +export interface TestMigration { + version: number + description: string + sql: string +} + +export const TEST_MIGRATIONS: TestMigration[] = [ + { + version: 1, + description: 'create_flow_session', + sql: ` + CREATE TABLE IF NOT EXISTS flow_session ( + id TEXT PRIMARY KEY NOT NULL, + objective TEXT NOT NULL, + self_score REAL, + start DATETIME NOT NULL, + end DATETIME + );` + }, + { + version: 2, + description: 'create_flow_period', + sql: ` + CREATE TABLE IF NOT EXISTS flow_period ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + start_time TIMESTAMP NOT NULL, + end_time TIMESTAMP NOT NULL, + score REAL NOT NULL, + details TEXT NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + );` + }, + { + version: 3, + description: 'add_stats_to_flow_session', + sql: ` + -- Add stats column if it doesn't exist + ALTER TABLE flow_session ADD COLUMN stats TEXT NOT NULL DEFAULT '{}';` + }, + { + version: 4, + description: 'add_previous_flow_period_id_to_flow_period', + sql: ` + ALTER TABLE flow_period + ADD COLUMN previous_flow_period_id INTEGER; + CREATE UNIQUE INDEX idx_previous_flow_period + ON flow_period(previous_flow_period_id) + WHERE previous_flow_period_id IS NOT NULL;` + }, + { + version: 5, + description: 'add_duration_to_flow_session', + sql: ` + ALTER TABLE flow_session + ADD COLUMN duration INTEGER;` + }, + { + version: 6, + description: 'create_blocking_preference', + sql: ` + CREATE TABLE IF NOT EXISTS blocking_preference ( + id TEXT PRIMARY KEY NOT NULL, + app_id TEXT, + tag_id TEXT, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + );` + }, + { + version: 7, + description: 'create_workflow', + sql: ` + CREATE TABLE IF NOT EXISTS workflow ( + id TEXT PRIMARY KEY NOT NULL, + name TEXT NOT NULL, + settings TEXT NOT NULL, + last_selected TIMESTAMP, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + );` + }, + { + version: 8, + description: 'add_workflow_id_to_blocking_preference', + sql: ` + ALTER TABLE blocking_preference ADD COLUMN workflow_id TEXT;` + }, + { + version: 9, + description: 'create_user_preference', + sql: ` + CREATE TABLE IF NOT EXISTS user_preference ( + key TEXT PRIMARY KEY NOT NULL, + value TEXT NOT NULL, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + );` + }, + { + version: 10, + description: 'add_audit_timestamps_to_tables', + sql: ` + -- Add timestamps to flow_session + ALTER TABLE flow_session ADD COLUMN created_at DATETIME; + ALTER TABLE flow_session ADD COLUMN updated_at DATETIME; + + -- Add updated_at to flow_period + ALTER TABLE flow_period ADD COLUMN updated_at DATETIME; + + -- Update existing rows with current timestamp + UPDATE flow_session SET created_at = datetime('now'), updated_at = datetime('now'); + UPDATE flow_period SET updated_at = datetime('now');` + }, + { + version: 11, + description: 'create_user_profile', + sql: ` + CREATE TABLE IF NOT EXISTS user_profile ( + id TEXT PRIMARY KEY NOT NULL, + user_id TEXT, + preferences TEXT NOT NULL DEFAULT '{}', + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME DEFAULT CURRENT_TIMESTAMP + ); + -- Migrate user_preference data into user_profile.preferences (as a single row, if any exist) + INSERT INTO user_profile (id, user_id, preferences, created_at, updated_at) + SELECT + 'default', + NULL, + ( + SELECT '{' || group_concat('"' || key || '":' || value) || '}' FROM ( + SELECT key, json_quote(value) as value FROM user_preference + ) + ), + CURRENT_TIMESTAMP, + CURRENT_TIMESTAMP + WHERE EXISTS (SELECT 1 FROM user_preference);` + }, + { + version: 12, + description: 'create_user_notification', + sql: ` + CREATE TABLE IF NOT EXISTS user_notification ( + id TEXT PRIMARY KEY NOT NULL, + user_id TEXT, + content TEXT NOT NULL, + notification_type TEXT NOT NULL, + notification_sub_type TEXT NOT NULL, + notification_sent_id TEXT NOT NULL, + read INTEGER NOT NULL DEFAULT 0, + dismissed INTEGER NOT NULL DEFAULT 0, + notification_sent_at DATETIME DEFAULT CURRENT_TIMESTAMP, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, + UNIQUE(user_id, notification_sent_id) + );` + }, + { + version: 13, + description: 'delete_duplicate_blocking_preferences', + sql: ` + DELETE FROM blocking_preference + WHERE id NOT IN ( + SELECT MIN(id) + FROM blocking_preference + GROUP BY workflow_id, app_id, tag_id + ); + + CREATE UNIQUE INDEX IF NOT EXISTS idx_blocking_preference_workflow_tag_unique + ON blocking_preference(workflow_id, tag_id); + + CREATE UNIQUE INDEX IF NOT EXISTS idx_blocking_preference_workflow_app_unique + ON blocking_preference(workflow_id, app_id);` + }, + { + version: 14, + description: 'rename_user_profile_to_device_profile_and_add_device_id', + sql: ` + ALTER TABLE user_profile RENAME TO device_profile; + ALTER TABLE device_profile ADD COLUMN device_id TEXT; + CREATE UNIQUE INDEX idx_device_profile_device_id_unique ON device_profile(device_id); + + CREATE TABLE IF NOT EXISTS device ( + id TEXT PRIMARY KEY NOT NULL, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME DEFAULT CURRENT_TIMESTAMP + );` + }, + { + version: 15, + description: 'add_workflow_id_to_flow_session_and_set_default_workflow_in_device_profile', + sql: ` + ALTER TABLE flow_session ADD COLUMN workflow_id TEXT; + ALTER TABLE flow_session ADD COLUMN type TEXT;` + }, + { + version: 16, + description: 'ensure_single_active_flow_session', + sql: ` + -- Delete duplicate active flow sessions, keeping only the most recent one + DELETE FROM flow_session + WHERE end IS NULL + AND id NOT IN ( + SELECT id + FROM flow_session + WHERE end IS NULL + ORDER BY start DESC + LIMIT 1 + ); + + -- Create a unique constraint to ensure only one active session can exist + CREATE UNIQUE INDEX idx_single_active_session + ON flow_session(1) + WHERE end IS NULL;` + }, + { + version: 17, + description: 'create_focus_schedule', + sql: ` + CREATE TABLE IF NOT EXISTS focus_schedule ( + id TEXT PRIMARY KEY NOT NULL, + label TEXT, + scheduled_time DATETIME NOT NULL, + workflow_id TEXT NOT NULL, + recurrence_settings TEXT, + is_active INTEGER NOT NULL DEFAULT 1, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, + updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (workflow_id) REFERENCES workflow (id) + ); + ALTER TABLE flow_session ADD COLUMN focus_schedule_id TEXT;` + }, +] + +/** + * Run all test migrations on a database + */ +export async function runTestMigrations(db: Database): Promise { + for (const migration of TEST_MIGRATIONS) { + try { + await db.execute(migration.sql) + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error) + + // Some migrations may fail on re-run due to schema already existing + // This is expected for ADD COLUMN operations + const isExpectedError = errorMessage.includes('duplicate column name') || + errorMessage.includes('already exists') || + errorMessage.includes('constraint failed') || + errorMessage.includes('already another table or index with this name') + + if (!isExpectedError) { + throw new Error(`Migration ${migration.version} (${migration.description}) failed: ${error}`) + } + // Silently continue for expected errors + } + } +} + +/** + * Get the latest migration version (for validation) + */ +export function getLatestMigrationVersion(): number { + return Math.max(...TEST_MIGRATIONS.map(m => m.version)) +} + +/** + * Verify that focus_schedule table exists with correct schema + * This is our key table for the current test example + */ +export async function verifyFocusScheduleSchema(db: Database): Promise { + // Check table exists + const tables = await db.select>( + 'SELECT name FROM sqlite_master WHERE type=\'table\' AND name=\'focus_schedule\'' + ) + + if (tables.length === 0) { + throw new Error('focus_schedule table does not exist') + } + + // Check key columns exist + const columns = await db.select>( + 'PRAGMA table_info(focus_schedule)' + ) + + const expectedColumns = [ + 'id', 'label', 'scheduled_time', 'workflow_id', + 'recurrence_settings', 'is_active', 'created_at', 'updated_at' + ] + + const actualColumns = columns.map(c => c.name) + + for (const expectedCol of expectedColumns) { + if (!actualColumns.includes(expectedCol)) { + throw new Error(`Missing column '${expectedCol}' in focus_schedule table`) + } + } +} + From 91e4a416ddbb1b12d69c21c911d8426fb4d01ddf Mon Sep 17 00:00:00 2001 From: Paul Hovley Date: Sun, 10 Aug 2025 15:04:09 -0600 Subject: [PATCH 3/4] Fix lint and typing issues --- src/tests/mocks/integrations/spotifyApi.ts | 10 +++++----- src/tests/mocks/integrations/spotifyAuth.ts | 2 +- src/tests/mocks/integrations/supabase.ts | 12 ++++++------ src/tests/mocks/tauri/deep-link.ts | 2 +- src/tests/mocks/tauri/event.ts | 2 +- src/tests/mocks/tauri/log.ts | 4 ++-- src/tests/mocks/tauri/menu.ts | 2 +- src/tests/mocks/tauri/sql.ts | 6 +++--- src/tests/mocks/tauri/tray.ts | 10 ++++------ src/tests/mocks/tauri/updater.ts | 2 +- 10 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/tests/mocks/integrations/spotifyApi.ts b/src/tests/mocks/integrations/spotifyApi.ts index da13b82a..1a19b83a 100644 --- a/src/tests/mocks/integrations/spotifyApi.ts +++ b/src/tests/mocks/integrations/spotifyApi.ts @@ -1,18 +1,18 @@ -export type PlaybackState = any +export type PlaybackState = unknown export const SpotifyApiService = { async initSdkScript() {}, async createPlayer() { return { - addListener: (_name: string, _cb: any) => {}, + addListener: () => {}, disconnect: () => {}, pause: async () => {}, } }, async transferPlaybackToComputerDevice() {}, - async startPlayback(_playlistId?: string, _deviceId?: string) {}, + async startPlayback() {}, } -export const getSpotifyIdFromUri = (_uri: string) => '' -export const openSpotifyLink = async (_uri: string) => {} +export const getSpotifyIdFromUri = () => '' +export const openSpotifyLink = async () => {} diff --git a/src/tests/mocks/integrations/spotifyAuth.ts b/src/tests/mocks/integrations/spotifyAuth.ts index 2dadd2ec..5251444c 100644 --- a/src/tests/mocks/integrations/spotifyAuth.ts +++ b/src/tests/mocks/integrations/spotifyAuth.ts @@ -1,5 +1,5 @@ export const SpotifyAuthService = { async isConnected() { return false }, - async handleCallback(_code: string, _state: string) {}, + async handleCallback() {}, } diff --git a/src/tests/mocks/integrations/supabase.ts b/src/tests/mocks/integrations/supabase.ts index cb28e20b..0a18dbe7 100644 --- a/src/tests/mocks/integrations/supabase.ts +++ b/src/tests/mocks/integrations/supabase.ts @@ -6,19 +6,19 @@ const auth = { async getSession() { return { data: { session } } }, async signOut() { session = null; return { error: null } }, async signInWithOAuth() { return { data: { url: 'http://localhost:1420/auth-success' }, error: null } }, - onAuthStateChange(_cb: any) { + onAuthStateChange() { return { data: { subscription: { unsubscribe() {} } } } }, - async exchangeCodeForSession(_code: string) { session = { user: { id: 'user-1', email: 'test@example.com' } }; return { data: { session }, error: null } }, + async exchangeCodeForSession() { session = { user: { id: 'user-1', email: 'test@example.com' } }; return { data: { session }, error: null } }, } const functions = { - async invoke(_name: string, _args?: unknown) { return { data: {}, error: null } }, + async invoke() { return { data: {}, error: null } }, } -const from = (_table: string) => ({ - insert: (_v: any) => ({ select: () => ({ order: () => ({ limit: () => ({ data: [], error: null }) }) }) }), - update: (_v: any) => ({ eq: () => ({ select: () => ({ order: () => ({ limit: () => ({ data: [], error: null }) }) }) }) }), +const from = () => ({ + insert: () => ({ select: () => ({ order: () => ({ limit: () => ({ data: [], error: null }) }) }) }), + update: () => ({ eq: () => ({ select: () => ({ order: () => ({ limit: () => ({ data: [], error: null }) }) }) }) }), select: () => ({ data: [], error: null }), }) diff --git a/src/tests/mocks/tauri/deep-link.ts b/src/tests/mocks/tauri/deep-link.ts index 47ac77e3..a1838066 100644 --- a/src/tests/mocks/tauri/deep-link.ts +++ b/src/tests/mocks/tauri/deep-link.ts @@ -6,7 +6,7 @@ export const onOpenUrl = (cb: OnOpenUrlHandler) => { handler = cb } -;(window as any).__tauriMockOpenUrl = async (url: string) => { +;(window as unknown as Record).__tauriMockOpenUrl = async (url: string) => { if (handler) await handler([url]) } diff --git a/src/tests/mocks/tauri/event.ts b/src/tests/mocks/tauri/event.ts index 64e3bae4..fac54bfe 100644 --- a/src/tests/mocks/tauri/event.ts +++ b/src/tests/mocks/tauri/event.ts @@ -13,5 +13,5 @@ export const emit = async (name: string, payload?: unknown) => { listeners.get(name)?.forEach((cb) => cb({ payload })) } -;(window as any).__tauriMockEmit = (name: string, payload?: unknown) => emit(name, payload) +;(window as unknown as Record).__tauriMockEmit = (name: string, payload?: unknown) => emit(name, payload) diff --git a/src/tests/mocks/tauri/log.ts b/src/tests/mocks/tauri/log.ts index cb4ca7ef..12608e0f 100644 --- a/src/tests/mocks/tauri/log.ts +++ b/src/tests/mocks/tauri/log.ts @@ -1,3 +1,3 @@ -export const info = (..._args: unknown[]) => {} -export const error = (..._args: unknown[]) => {} +export const info = () => {} +export const error = () => {} diff --git a/src/tests/mocks/tauri/menu.ts b/src/tests/mocks/tauri/menu.ts index d8970221..f62ec0fe 100644 --- a/src/tests/mocks/tauri/menu.ts +++ b/src/tests/mocks/tauri/menu.ts @@ -1,5 +1,5 @@ export const Menu = { - async new(opts: any) { + async new(opts: unknown) { return opts } } diff --git a/src/tests/mocks/tauri/sql.ts b/src/tests/mocks/tauri/sql.ts index 648886ed..5beee075 100644 --- a/src/tests/mocks/tauri/sql.ts +++ b/src/tests/mocks/tauri/sql.ts @@ -1,13 +1,13 @@ export type QueryResult = { rowsAffected?: number } export default class Database { - static async load(_url: string) { + static async load() { return new Database() } - async select(_query: string, _params?: unknown[]): Promise { + async select(): Promise { return [] as T[] } - async execute(_query: string, _params?: unknown[]): Promise { + async execute(): Promise { return { rowsAffected: 0 } } } diff --git a/src/tests/mocks/tauri/tray.ts b/src/tests/mocks/tauri/tray.ts index f5d1282e..e0e16a95 100644 --- a/src/tests/mocks/tauri/tray.ts +++ b/src/tests/mocks/tauri/tray.ts @@ -1,12 +1,10 @@ -type MenuType = any - class MockTray { id: string constructor(id: string) { this.id = id } - async setTitle(_t: string) {} - async setIcon(_i: any) {} - async setIconAsTemplate(_b: boolean) {} - async setMenu(_m: MenuType) {} + async setTitle() {} + async setIcon() {} + async setIconAsTemplate() {} + async setMenu() {} } const registry = new Map() diff --git a/src/tests/mocks/tauri/updater.ts b/src/tests/mocks/tauri/updater.ts index 9e6a4377..842dbadf 100644 --- a/src/tests/mocks/tauri/updater.ts +++ b/src/tests/mocks/tauri/updater.ts @@ -2,7 +2,7 @@ type UpdateInfo = { version: string date: string body: string - downloadAndInstall: (cb: (ev: any) => void) => Promise + downloadAndInstall: (cb: (ev: unknown) => void) => Promise } export const check = async (): Promise => { From 5b49ee809c49b7ca9a1f501d5064f821fd7c45c8 Mon Sep 17 00:00:00 2001 From: Paul Hovley Date: Sun, 10 Aug 2025 15:19:08 -0600 Subject: [PATCH 4/4] prevent updates from showing multiple times --- src/hooks/__tests__/useUpdate.test.ts | 84 +++++++++++++++++++++++++++ src/hooks/useUpdate.ts | 70 ++++++++++------------ 2 files changed, 116 insertions(+), 38 deletions(-) create mode 100644 src/hooks/__tests__/useUpdate.test.ts diff --git a/src/hooks/__tests__/useUpdate.test.ts b/src/hooks/__tests__/useUpdate.test.ts new file mode 100644 index 00000000..22708c08 --- /dev/null +++ b/src/hooks/__tests__/useUpdate.test.ts @@ -0,0 +1,84 @@ +import { vi, describe, it, expect, beforeEach } from 'vitest' + +// Mock FlowSessionApi to ensure no in-progress session blocks the update flow +vi.mock('@/api/ebbApi/flowSessionApi', () => ({ + FlowSessionApi: { + getInProgressFlowSession: vi.fn().mockResolvedValue(null), + }, +})) + +// Mock environment util to not be dev +vi.mock('@/lib/utils/environment.util', () => ({ + isDev: () => false, +})) + +// Mock logger and process +vi.mock('@tauri-apps/plugin-log', async () => { + const mod = await import('@/tests/mocks/tauri/log') + return mod +}) +vi.mock('@tauri-apps/plugin-process', async () => { + const mod = await import('@/tests/mocks/tauri/process') + return mod +}) + +// Updater event type subset used by our test +type UpdateEvent = + | { event: 'Started'; data: { contentLength?: number | null } } + | { event: 'Progress'; data: { chunkLength: number } } + | { event: 'Finished' } + +// Helper to build a fake update object compatible with our hook logic +const makeUpdate = (version: string) => ({ + version, + date: new Date().toISOString(), + body: `Release ${version}`, + downloadAndInstall: vi.fn().mockImplementation(async (cb?: (ev: UpdateEvent) => void) => { + cb?.({ event: 'Started', data: { contentLength: 100 } }) + cb?.({ event: 'Progress', data: { chunkLength: 50 } }) + cb?.({ event: 'Progress', data: { chunkLength: 50 } }) + cb?.({ event: 'Finished' }) + }), +}) + +// We will hot-swap the updater's check return value between calls +const checkMock = vi.fn() +vi.mock('@tauri-apps/plugin-updater', () => ({ + check: (...args: unknown[]) => checkMock(...args), +})) + +// Mock toast and capture calls +const toastSuccess = vi.fn() +vi.mock('sonner', () => ({ + toast: { success: (...args: unknown[]) => toastSuccess(...args) }, +})) + +import { checkAndUpdate } from '@/hooks/useUpdate' + +describe('useUpdate - toast replacement across sequential updates', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('replaces the update toast when a new update becomes available', async () => { + // First call returns v1, second call returns v2 + checkMock + .mockResolvedValueOnce(makeUpdate('1.2.3')) + .mockResolvedValueOnce(makeUpdate('1.2.4')) + + // Trigger first update + await checkAndUpdate() + expect(toastSuccess).toHaveBeenCalledTimes(1) + expect(toastSuccess.mock.calls[0][0]).toContain('1.2.3') + // Ensure a stable id is used so subsequent toasts replace the previous one + expect(toastSuccess.mock.calls[0][1]).toMatchObject({ id: 'app-update', duration: Infinity }) + + // Trigger second update + await checkAndUpdate() + expect(toastSuccess).toHaveBeenCalledTimes(2) + expect(toastSuccess.mock.calls[1][0]).toContain('1.2.4') + // Confirms same id used again, implying replacement behavior in Sonner + expect(toastSuccess.mock.calls[1][1]).toMatchObject({ id: 'app-update', duration: Infinity }) + }) +}) + diff --git a/src/hooks/useUpdate.ts b/src/hooks/useUpdate.ts index f7291076..b099b1ce 100644 --- a/src/hooks/useUpdate.ts +++ b/src/hooks/useUpdate.ts @@ -7,7 +7,8 @@ import { logAndToastError } from '@/lib/utils/ebbError.util' import { toast } from 'sonner' let consecutiveErrorCount = 0 -let lastNotifiedVersion: string | null = null +const UPDATE_TOAST_ID = 'app-update' + const checkForUpdate = async () => { try { @@ -35,46 +36,39 @@ export const checkAndUpdate = async () => { const update = await checkForUpdate() if (update) { // Only show notification if we haven't already notified about this version - if (lastNotifiedVersion !== update.version) { - info( - `found update ${update.version} from ${update.date} with notes ${update.body}` - ) - let downloaded = 0 - let contentLength = 0 - await update.downloadAndInstall((event) => { - switch (event.event) { - case 'Started': - contentLength = event.data.contentLength ?? 0 - info(`started downloading ${event.data.contentLength} bytes`) - break - case 'Progress': - downloaded += event.data.chunkLength - info(`downloaded ${downloaded} from ${contentLength}`) - break - case 'Finished': - info('download finished') - break - } - }) + info( + `found update ${update.version} from ${update.date} with notes ${update.body}` + ) + let downloaded = 0 + let contentLength = 0 + await update.downloadAndInstall((event) => { + switch (event.event) { + case 'Started': + contentLength = event.data.contentLength ?? 0 + info(`started downloading ${event.data.contentLength} bytes`) + break + case 'Progress': + downloaded += event.data.chunkLength + info(`downloaded ${downloaded} from ${contentLength}`) + break + case 'Finished': + info('download finished') + break + } + }) - info('update installed') + info('update installed') - // Show notification with restart button instead of auto-restarting - toast.success(`Ebb ${update.version} is available. Restart to apply latest updates.`, { - duration: Infinity, // Don't auto-dismiss - action: { - label: 'Restart Now', - onClick: () => { - // Reset the tracked version when user restarts - lastNotifiedVersion = null - relaunch() - } + toast.success(`Ebb ${update.version} is available. Restart to apply latest updates.`, { + id: UPDATE_TOAST_ID, + duration: Infinity, + action: { + label: 'Restart Now', + onClick: () => { + relaunch() } - }) - - // Remember that we've notified about this version - lastNotifiedVersion = update.version - } + } + }) } }