chore: fix typescript config issues
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import { AuthConfig } from './types';
|
||||
import { AuthConfig } from './types.js';
|
||||
|
||||
// Single base domain for all URLs
|
||||
// Build-time: process.env.TM_PUBLIC_BASE_DOMAIN gets replaced by tsup's env option
|
||||
|
||||
@@ -427,7 +427,7 @@ describe('CredentialStore', () => {
|
||||
|
||||
// Should not throw
|
||||
expect(() => store.clearCredentials()).not.toThrow();
|
||||
|
||||
|
||||
// Should not try to unlink non-existent file
|
||||
expect(fs.unlinkSync).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -511,18 +511,20 @@ describe('CredentialStore', () => {
|
||||
|
||||
// Credentials without expiry are considered invalid
|
||||
expect(store.hasValidCredentials()).toBe(false);
|
||||
|
||||
|
||||
// Should log warning about missing expiration
|
||||
expect(mockLogger.warn).toHaveBeenCalledWith('No valid expiration time provided for token');
|
||||
expect(mockLogger.warn).toHaveBeenCalledWith(
|
||||
'No valid expiration time provided for token'
|
||||
);
|
||||
});
|
||||
|
||||
it('should use allowExpired=false by default', () => {
|
||||
// Spy on getCredentials to verify it's called with correct params
|
||||
const getCredentialsSpy = vi.spyOn(store, 'getCredentials');
|
||||
|
||||
|
||||
vi.mocked(fs.existsSync).mockReturnValue(false);
|
||||
store.hasValidCredentials();
|
||||
|
||||
|
||||
expect(getCredentialsSpy).toHaveBeenCalledWith({ allowExpired: false });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,11 +10,11 @@ import { getLogger } from '../logger/index.js';
|
||||
|
||||
/**
|
||||
* CredentialStore manages the persistence and retrieval of authentication credentials.
|
||||
*
|
||||
*
|
||||
* Runtime vs Persisted Shape:
|
||||
* - When retrieved (getCredentials): expiresAt is normalized to number (milliseconds since epoch)
|
||||
* - When persisted (saveCredentials): expiresAt is stored as ISO string for readability
|
||||
*
|
||||
*
|
||||
* This normalization ensures consistent runtime behavior while maintaining
|
||||
* human-readable persisted format in the auth.json file.
|
||||
*/
|
||||
@@ -67,12 +67,15 @@ export class CredentialStore {
|
||||
// Check if the token has expired (with clock skew tolerance)
|
||||
const now = Date.now();
|
||||
const allowExpired = options?.allowExpired ?? false;
|
||||
if (now >= (expiresAtMs - this.CLOCK_SKEW_MS) && !allowExpired) {
|
||||
this.logger.warn('Authentication token has expired or is about to expire', {
|
||||
expiresAt: authData.expiresAt,
|
||||
currentTime: new Date(now).toISOString(),
|
||||
skewWindow: `${this.CLOCK_SKEW_MS / 1000}s`
|
||||
});
|
||||
if (now >= expiresAtMs - this.CLOCK_SKEW_MS && !allowExpired) {
|
||||
this.logger.warn(
|
||||
'Authentication token has expired or is about to expire',
|
||||
{
|
||||
expiresAt: authData.expiresAt,
|
||||
currentTime: new Date(now).toISOString(),
|
||||
skewWindow: `${this.CLOCK_SKEW_MS / 1000}s`
|
||||
}
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -206,12 +209,12 @@ export class CredentialStore {
|
||||
for (const entry of entries) {
|
||||
if (!entry.isFile()) continue;
|
||||
const file = entry.name;
|
||||
|
||||
|
||||
// Check if file matches pattern: baseName.corrupt-{timestamp}
|
||||
if (!file.startsWith(prefix)) continue;
|
||||
const suffix = file.slice(prefix.length);
|
||||
if (!/^\d+$/.test(suffix)) continue; // Fixed regex, not from variable input
|
||||
|
||||
|
||||
const filePath = path.join(dir, file);
|
||||
try {
|
||||
const stats = fs.statSync(filePath);
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
* Authentication module exports
|
||||
*/
|
||||
|
||||
export { AuthManager } from './auth-manager';
|
||||
export { CredentialStore } from './credential-store';
|
||||
export { OAuthService } from './oauth-service';
|
||||
export { AuthManager } from './auth-manager.js';
|
||||
export { CredentialStore } from './credential-store.js';
|
||||
export { OAuthService } from './oauth-service.js';
|
||||
|
||||
export type {
|
||||
AuthCredentials,
|
||||
OAuthFlowOptions,
|
||||
AuthConfig,
|
||||
CliData
|
||||
} from './types';
|
||||
} from './types.js';
|
||||
|
||||
export { AuthenticationError } from './types';
|
||||
export { AuthenticationError } from './types.js';
|
||||
|
||||
export {
|
||||
DEFAULT_AUTH_CONFIG,
|
||||
getAuthConfig
|
||||
} from './config';
|
||||
} from './config.js';
|
||||
|
||||
@@ -12,11 +12,11 @@ import {
|
||||
OAuthFlowOptions,
|
||||
AuthConfig,
|
||||
CliData
|
||||
} from './types';
|
||||
import { CredentialStore } from './credential-store';
|
||||
import { SupabaseAuthClient } from '../clients/supabase-client';
|
||||
import { getAuthConfig } from './config';
|
||||
import { getLogger } from '../logger';
|
||||
} from './types.js';
|
||||
import { CredentialStore } from './credential-store.js';
|
||||
import { SupabaseAuthClient } from '../clients/supabase-client.js';
|
||||
import { getAuthConfig } from './config.js';
|
||||
import { getLogger } from '../logger/index.js';
|
||||
import packageJson from '../../../../package.json' with { type: 'json' };
|
||||
|
||||
export class OAuthService {
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
* Client exports
|
||||
*/
|
||||
|
||||
export { SupabaseAuthClient } from './supabase-client';
|
||||
export { SupabaseAuthClient } from './supabase-client.js';
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
import { createClient, SupabaseClient, User } from '@supabase/supabase-js';
|
||||
import { AuthenticationError } from '../auth/types';
|
||||
import { getLogger } from '../logger';
|
||||
import { AuthenticationError } from '../auth/types.js';
|
||||
import { getLogger } from '../logger/index.js';
|
||||
|
||||
export class SupabaseAuthClient {
|
||||
private client: SupabaseClient | null = null;
|
||||
|
||||
@@ -9,19 +9,19 @@ export {
|
||||
createTaskMasterCore,
|
||||
type TaskMasterCoreOptions,
|
||||
type ListTasksResult
|
||||
} from './task-master-core';
|
||||
} from './task-master-core.js';
|
||||
|
||||
// Re-export types
|
||||
export type * from './types';
|
||||
export type * from './types/index.js';
|
||||
|
||||
// Re-export interfaces (types only to avoid conflicts)
|
||||
export type * from './interfaces';
|
||||
export type * from './interfaces/index.js';
|
||||
|
||||
// Re-export constants
|
||||
export * from './constants';
|
||||
export * from './constants/index.js';
|
||||
|
||||
// Re-export providers
|
||||
export * from './providers';
|
||||
export * from './providers/index.js';
|
||||
|
||||
// Re-export storage (selectively to avoid conflicts)
|
||||
export {
|
||||
@@ -29,20 +29,20 @@ export {
|
||||
ApiStorage,
|
||||
StorageFactory,
|
||||
type ApiStorageConfig
|
||||
} from './storage';
|
||||
export { PlaceholderStorage, type StorageAdapter } from './storage';
|
||||
} from './storage/index.js';
|
||||
export { PlaceholderStorage, type StorageAdapter } from './storage/index.js';
|
||||
|
||||
// Re-export parser
|
||||
export * from './parser';
|
||||
export * from './parser/index.js';
|
||||
|
||||
// Re-export utilities
|
||||
export * from './utils';
|
||||
export * from './utils/index.js';
|
||||
|
||||
// Re-export errors
|
||||
export * from './errors';
|
||||
export * from './errors/index.js';
|
||||
|
||||
// Re-export entities
|
||||
export { TaskEntity } from './entities/task.entity';
|
||||
export { TaskEntity } from './entities/task.entity.js';
|
||||
|
||||
// Re-export authentication
|
||||
export {
|
||||
@@ -51,7 +51,7 @@ export {
|
||||
type AuthCredentials,
|
||||
type OAuthFlowOptions,
|
||||
type AuthConfig
|
||||
} from './auth';
|
||||
} from './auth/index.js';
|
||||
|
||||
// Re-export logger
|
||||
export { getLogger, createLogger, setGlobalLogger } from './logger';
|
||||
export { getLogger, createLogger, setGlobalLogger } from './logger/index.js';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file defines the contract for configuration management
|
||||
*/
|
||||
|
||||
import type { TaskComplexity, TaskPriority } from '../types/index';
|
||||
import type { TaskComplexity, TaskPriority } from '../types/index.js';
|
||||
|
||||
/**
|
||||
* Model configuration for different AI roles
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
*/
|
||||
|
||||
// Storage interfaces
|
||||
export type * from './storage.interface';
|
||||
export * from './storage.interface';
|
||||
export type * from './storage.interface.js';
|
||||
export * from './storage.interface.js';
|
||||
|
||||
// AI Provider interfaces
|
||||
export type * from './ai-provider.interface';
|
||||
export * from './ai-provider.interface';
|
||||
export type * from './ai-provider.interface.js';
|
||||
export * from './ai-provider.interface.js';
|
||||
|
||||
// Configuration interfaces
|
||||
export type * from './configuration.interface';
|
||||
export * from './configuration.interface';
|
||||
export type * from './configuration.interface.js';
|
||||
export * from './configuration.interface.js';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file defines the contract for all storage implementations
|
||||
*/
|
||||
|
||||
import type { Task, TaskMetadata } from '../types/index';
|
||||
import type { Task, TaskMetadata } from '../types/index.js';
|
||||
|
||||
/**
|
||||
* Interface for storage operations on tasks
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @fileoverview Logger factory and singleton management
|
||||
*/
|
||||
|
||||
import { Logger, LoggerConfig } from './logger.js';
|
||||
import { Logger, type LoggerConfig } from './logger.js';
|
||||
|
||||
// Global logger instance
|
||||
let globalLogger: Logger | null = null;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file exports all parsing-related classes and functions
|
||||
*/
|
||||
|
||||
import type { PlaceholderTask } from '../types/index';
|
||||
import type { PlaceholderTask } from '../types/index.js';
|
||||
|
||||
// Parser implementations will be defined here
|
||||
// export * from './prd-parser.js';
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
* Provides business logic and service layer functionality
|
||||
*/
|
||||
|
||||
export { TaskService } from './task-service';
|
||||
export { TaskService } from './task-service.js';
|
||||
|
||||
@@ -11,7 +11,7 @@ export {
|
||||
isValidTaskId,
|
||||
isValidSubtaskId,
|
||||
getParentTaskId
|
||||
} from './id-generator';
|
||||
} from './id-generator.js';
|
||||
|
||||
// Additional utility exports
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "bundler",
|
||||
"moduleDetection": "force",
|
||||
"types": ["node"],
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"paths": {
|
||||
|
||||
Reference in New Issue
Block a user