farseer-cli 1.0.10 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +19 -0
  2. package/dist/commands/app.js +348 -344
  3. package/dist/commands/app.js.map +7 -0
  4. package/dist/commands/apps.js +110 -82
  5. package/dist/commands/apps.js.map +7 -0
  6. package/dist/commands/cells.js +161 -0
  7. package/dist/commands/cells.js.map +7 -0
  8. package/dist/commands/checkout.js +140 -155
  9. package/dist/commands/checkout.js.map +7 -0
  10. package/dist/commands/config.js +128 -126
  11. package/dist/commands/config.js.map +7 -0
  12. package/dist/commands/dashboards.js +130 -0
  13. package/dist/commands/dashboards.js.map +7 -0
  14. package/dist/commands/diff.js +171 -193
  15. package/dist/commands/diff.js.map +7 -0
  16. package/dist/commands/dimensions.js +222 -119
  17. package/dist/commands/dimensions.js.map +7 -0
  18. package/dist/commands/files.js +96 -77
  19. package/dist/commands/files.js.map +7 -0
  20. package/dist/commands/formula.js +116 -0
  21. package/dist/commands/formula.js.map +7 -0
  22. package/dist/commands/install.js +74 -76
  23. package/dist/commands/install.js.map +7 -0
  24. package/dist/commands/list.js +91 -73
  25. package/dist/commands/list.js.map +7 -0
  26. package/dist/commands/login.js +137 -98
  27. package/dist/commands/login.js.map +7 -0
  28. package/dist/commands/logout.js +59 -41
  29. package/dist/commands/logout.js.map +7 -0
  30. package/dist/commands/mcp-server.js +36 -23
  31. package/dist/commands/mcp-server.js.map +7 -0
  32. package/dist/commands/model.js +186 -175
  33. package/dist/commands/model.js.map +7 -0
  34. package/dist/commands/pull.js +264 -274
  35. package/dist/commands/pull.js.map +7 -0
  36. package/dist/commands/push.js +209 -221
  37. package/dist/commands/push.js.map +7 -0
  38. package/dist/commands/run.js +276 -321
  39. package/dist/commands/run.js.map +7 -0
  40. package/dist/commands/sheets.js +200 -0
  41. package/dist/commands/sheets.js.map +7 -0
  42. package/dist/commands/status.js +149 -169
  43. package/dist/commands/status.js.map +7 -0
  44. package/dist/commands/variables.js +247 -188
  45. package/dist/commands/variables.js.map +7 -0
  46. package/dist/commands/whoami.js +65 -44
  47. package/dist/commands/whoami.js.map +7 -0
  48. package/dist/index.js +179 -115
  49. package/dist/index.js.map +7 -0
  50. package/dist/mcp/index.js +33 -16
  51. package/dist/mcp/index.js.map +7 -0
  52. package/dist/mcp/prompts/workflows.js +191 -145
  53. package/dist/mcp/prompts/workflows.js.map +7 -0
  54. package/dist/mcp/resources/documentation.js +158 -148
  55. package/dist/mcp/resources/documentation.js.map +7 -0
  56. package/dist/mcp/server.js +56 -33
  57. package/dist/mcp/server.js.map +7 -0
  58. package/dist/mcp/tools/appTools.js +309 -277
  59. package/dist/mcp/tools/appTools.js.map +7 -0
  60. package/dist/mcp/tools/authTools.js +130 -121
  61. package/dist/mcp/tools/authTools.js.map +7 -0
  62. package/dist/mcp/tools/cellTools.js +148 -0
  63. package/dist/mcp/tools/cellTools.js.map +7 -0
  64. package/dist/mcp/tools/dashboardTools.js +133 -0
  65. package/dist/mcp/tools/dashboardTools.js.map +7 -0
  66. package/dist/mcp/tools/dataTools.js +270 -267
  67. package/dist/mcp/tools/dataTools.js.map +7 -0
  68. package/dist/mcp/tools/modelTools.js +575 -229
  69. package/dist/mcp/tools/modelTools.js.map +7 -0
  70. package/dist/mcp/tools/runTools.js +201 -203
  71. package/dist/mcp/tools/runTools.js.map +7 -0
  72. package/dist/mcp/tools/sheetTools.js +240 -0
  73. package/dist/mcp/tools/sheetTools.js.map +7 -0
  74. package/dist/mcp/tools/syncTools.js +335 -314
  75. package/dist/mcp/tools/syncTools.js.map +7 -0
  76. package/dist/mcp/utils/helpers.js +117 -123
  77. package/dist/mcp/utils/helpers.js.map +7 -0
  78. package/dist/services/appSyncService.js +381 -437
  79. package/dist/services/appSyncService.js.map +7 -0
  80. package/dist/services/configService.js +154 -143
  81. package/dist/services/configService.js.map +7 -0
  82. package/dist/services/farseerApi.js +422 -399
  83. package/dist/services/farseerApi.js.map +7 -0
  84. package/dist/services/farseerFactory.js +208 -273
  85. package/dist/services/farseerFactory.js.map +7 -0
  86. package/dist/services/farseerService.js +467 -486
  87. package/dist/services/farseerService.js.map +7 -0
  88. package/dist/services/syncService.js +661 -731
  89. package/dist/services/syncService.js.map +7 -0
  90. package/dist/utils/constants.js +52 -19
  91. package/dist/utils/constants.js.map +7 -0
  92. package/dist/utils/entityResolver.js +78 -0
  93. package/dist/utils/entityResolver.js.map +7 -0
  94. package/dist/utils/helpers.js +331 -365
  95. package/dist/utils/helpers.js.map +7 -0
  96. package/dist/utils/logger.js +74 -42
  97. package/dist/utils/logger.js.map +7 -0
  98. package/package.json +3 -2
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/services/syncService.ts"],
4
+ "sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { IFarseerClient, RemoteFile, DEFAULT_SCRIPT_EXTENSIONS } from './farseerFactory';\nimport {\n calculateHash,\n getTenantFilesDir,\n getSyncFilePath,\n ensureDirectoryExists,\n getAllFilesInDir,\n fetchWithConcurrency,\n} from '../utils/helpers';\nimport { logger } from '../utils/logger';\n\nexport interface SyncFileInfo {\n localHash: string;\n remoteHash: string;\n metadata?: {\n uploadTime?: string;\n uploaderEmail?: string;\n uploaderName?: string;\n lastFetched?: string;\n };\n}\n\nexport interface SyncState {\n lastSync: string;\n files: Record<string, SyncFileInfo>;\n}\n\nexport interface SyncStatus {\n modifiedLocally: string[];\n modifiedRemotely: string[];\n onlyLocal: string[];\n onlyRemote: string[];\n inSync: string[];\n conflicts?: SyncConflict[];\n}\n\n// Three-way comparison types\n\nexport type FileChangeType =\n | 'unchanged'\n | 'local_modified'\n | 'remote_modified'\n | 'remote_deleted'\n | 'local_deleted'\n | 'local_new'\n | 'remote_new'\n | 'conflict_both_modified'\n | 'conflict_local_modified_remote_deleted'\n | 'conflict_local_deleted_remote_modified'\n | 'conflict_both_new';\n\nexport interface FileCompareResult {\n filePath: string;\n changeType: FileChangeType;\n currentLocalHash: string | null;\n currentRemoteHash: string | null;\n baselineLocalHash: string | null;\n baselineRemoteHash: string | null;\n}\n\nexport interface SyncConflict {\n filePath: string;\n type: 'both_modified' | 'local_modified_remote_deleted' | 'local_deleted_remote_modified' | 'both_new';\n description: string;\n}\n\nexport type ConflictResolution = 'keep_local' | 'keep_remote' | 'keep_both';\nexport type ConflictResolutions = Record<string, ConflictResolution>;\n\nexport class SyncService {\n private tenant: string;\n private farseerClient: IFarseerClient;\n\n constructor(tenant: string, farseerClient: IFarseerClient) {\n this.tenant = tenant;\n this.farseerClient = farseerClient;\n }\n\n loadSyncState(): SyncState {\n const syncFilePath = getSyncFilePath(this.tenant);\n\n if (!fs.existsSync(syncFilePath)) {\n return {\n lastSync: '',\n files: {},\n };\n }\n\n try {\n const content = fs.readFileSync(syncFilePath, 'utf-8');\n return JSON.parse(content) as SyncState;\n } catch {\n return {\n lastSync: '',\n files: {},\n };\n }\n }\n\n saveSyncState(state: SyncState): void {\n const syncFilePath = getSyncFilePath(this.tenant);\n ensureDirectoryExists(path.dirname(syncFilePath));\n fs.writeFileSync(syncFilePath, JSON.stringify(state, null, 2), 'utf-8');\n }\n\n /**\n * Fast status check that uses sync state instead of downloading remote file content.\n * This is much faster than getStatus() but may miss changes made by others since last pull.\n * Use this for push operations where we trust the sync state.\n */\n async getStatusFast(options?: { all?: boolean }): Promise<SyncStatus> {\n const syncState = this.loadSyncState();\n const filesDir = getTenantFilesDir(this.tenant);\n\n // Get local files\n let localFiles = getAllFilesInDir(filesDir);\n\n // Filter to scripts only unless --all is specified\n if (!options?.all) {\n localFiles = localFiles.filter((f) =>\n DEFAULT_SCRIPT_EXTENSIONS.some((ext) => f.toLowerCase().endsWith(ext)),\n );\n }\n\n // Get remote file list only (no content download)\n let remoteFiles = await this.farseerClient.listFiles();\n\n // Filter to scripts only unless --all is specified\n if (!options?.all) {\n remoteFiles = remoteFiles.filter((f) =>\n DEFAULT_SCRIPT_EXTENSIONS.some((ext) => f.name.toLowerCase().endsWith(ext)),\n );\n }\n\n const remoteFilePaths = new Set(remoteFiles.map((f) => f.path));\n\n const status: SyncStatus = {\n modifiedLocally: [],\n modifiedRemotely: [],\n onlyLocal: [],\n onlyRemote: [],\n inSync: [],\n conflicts: [],\n };\n\n // Check local files\n for (const localFile of localFiles) {\n const localPath = path.join(filesDir, localFile);\n const content = fs.readFileSync(localPath);\n const localHash = calculateHash(content);\n const syncInfo = syncState.files[localFile];\n\n if (remoteFilePaths.has(localFile)) {\n // File exists both locally and remotely\n if (syncInfo && localHash === syncInfo.localHash) {\n // Local file hasn't changed since last sync\n status.inSync.push(localFile);\n } else {\n // Local file changed (or no sync info)\n status.modifiedLocally.push(localFile);\n }\n } else {\n // File only exists locally\n if (syncInfo && syncInfo.remoteHash) {\n // Was synced before, deleted on remote\n if (localHash !== syncInfo.localHash) {\n // Local also modified - CONFLICT\n status.conflicts!.push({\n filePath: localFile,\n type: 'local_modified_remote_deleted',\n description: 'File modified locally but deleted on remote',\n });\n } else {\n // Local unchanged, safe to mark as remote change\n status.modifiedRemotely.push(localFile);\n }\n } else {\n status.onlyLocal.push(localFile);\n }\n }\n }\n\n // Check remote files that don't exist locally\n for (const remoteFile of remoteFiles) {\n if (!localFiles.includes(remoteFile.path)) {\n const syncInfo = syncState.files[remoteFile.path];\n if (syncInfo && syncInfo.localHash) {\n // Was synced before, deleted locally\n status.modifiedLocally.push(remoteFile.path);\n } else {\n status.onlyRemote.push(remoteFile.path);\n }\n }\n }\n\n return status;\n }\n\n async getStatus(options?: { all?: boolean }): Promise<SyncStatus> {\n const syncState = this.loadSyncState();\n const filesDir = getTenantFilesDir(this.tenant);\n\n // Get local files and their hashes\n let localFiles = getAllFilesInDir(filesDir);\n if (!options?.all) {\n localFiles = localFiles.filter((f) =>\n DEFAULT_SCRIPT_EXTENSIONS.some((ext) => f.toLowerCase().endsWith(ext)),\n );\n }\n\n const localHashes = new Map<string, string>();\n for (const file of localFiles) {\n const fullPath = path.join(filesDir, file);\n const content = fs.readFileSync(fullPath);\n localHashes.set(file, calculateHash(content));\n }\n\n // Get remote files and their hashes\n let remoteFiles = await this.farseerClient.listFiles();\n if (!options?.all) {\n remoteFiles = remoteFiles.filter((f) =>\n DEFAULT_SCRIPT_EXTENSIONS.some((ext) => f.name.toLowerCase().endsWith(ext)),\n );\n }\n\n const remoteHashes = new Map<string, string>();\n const fileContents = await fetchWithConcurrency(\n remoteFiles,\n async (file) => {\n const content = await this.farseerClient.getFileContentAsBuffer(file.reference);\n return { path: file.path, hash: calculateHash(content) };\n },\n 15,\n );\n for (const { path: filePath, hash } of fileContents) {\n remoteHashes.set(filePath, hash);\n }\n\n // Three-way comparison\n const comparisons = this.compareFiles({ localHashes, remoteHashes, syncState, all: options?.all });\n\n const status: SyncStatus = {\n modifiedLocally: [],\n modifiedRemotely: [],\n onlyLocal: [],\n onlyRemote: [],\n inSync: [],\n conflicts: [],\n };\n\n for (const c of comparisons) {\n switch (c.changeType) {\n case 'unchanged':\n status.inSync.push(c.filePath);\n break;\n case 'local_modified':\n status.modifiedLocally.push(c.filePath);\n break;\n case 'remote_modified':\n status.modifiedRemotely.push(c.filePath);\n break;\n case 'local_new':\n status.onlyLocal.push(c.filePath);\n break;\n case 'remote_new':\n status.onlyRemote.push(c.filePath);\n break;\n case 'remote_deleted':\n status.modifiedRemotely.push(c.filePath);\n break;\n case 'local_deleted':\n status.modifiedLocally.push(c.filePath);\n break;\n default:\n // All conflict types\n status.conflicts!.push(SyncService.buildConflicts([c])[0]);\n break;\n }\n }\n\n return status;\n }\n\n async pull(options?: { all?: boolean; force?: boolean; conflictResolutions?: ConflictResolutions }): Promise<{\n downloaded: string[];\n deleted: string[];\n unchanged: string[];\n conflicts: SyncConflict[];\n conflictFilesWritten: string[];\n }> {\n const filesDir = getTenantFilesDir(this.tenant);\n ensureDirectoryExists(filesDir);\n\n const syncState = this.loadSyncState();\n let remoteFiles = await this.farseerClient.listFiles();\n\n // Filter to scripts only unless --all is specified\n if (!options?.all) {\n remoteFiles = remoteFiles.filter((f) =>\n DEFAULT_SCRIPT_EXTENSIONS.some((ext) => f.name.toLowerCase().endsWith(ext)),\n );\n }\n\n // Batch fetch metadata for all files\n remoteFiles = await this.fetchMetadataForFiles(remoteFiles);\n\n const result = {\n downloaded: [] as string[],\n deleted: [] as string[],\n unchanged: [] as string[],\n conflicts: [] as SyncConflict[],\n conflictFilesWritten: [] as string[],\n };\n\n // Download file contents in parallel with concurrency limit\n logger.dim(`Fetching ${remoteFiles.length} files in parallel...`);\n const fileContents = await fetchWithConcurrency(\n remoteFiles,\n async (file, index) => {\n const content = await this.farseerClient.getFileContentAsBuffer(file.reference);\n // Show progress every 10 files\n if ((index + 1) % 10 === 0 || index === remoteFiles.length - 1) {\n process.stdout.write(`\\r Progress: ${index + 1}/${remoteFiles.length} files`);\n }\n return { file, content };\n },\n 15,\n );\n // Clear progress line\n if (remoteFiles.length > 0) {\n process.stdout.write('\\r' + ' '.repeat(50) + '\\r');\n }\n\n // Build remote content map with hashes\n const remoteContentMap = new Map<string, { file: RemoteFile; content: Buffer; hash: string }>();\n const remoteHashes = new Map<string, string>();\n for (const { file, content } of fileContents) {\n const hash = calculateHash(content);\n remoteContentMap.set(file.path, { file, content, hash });\n remoteHashes.set(file.path, hash);\n }\n\n // Build local hashes\n const localFiles = getAllFilesInDir(filesDir);\n const localHashes = new Map<string, string>();\n for (const localFile of localFiles) {\n if (!options?.all && !DEFAULT_SCRIPT_EXTENSIONS.some((ext) => localFile.toLowerCase().endsWith(ext))) {\n continue;\n }\n const localPath = path.join(filesDir, localFile);\n const content = fs.readFileSync(localPath);\n localHashes.set(localFile, calculateHash(content));\n }\n\n // Three-way comparison\n const comparisons = this.compareFiles({ localHashes, remoteHashes, syncState, all: options?.all });\n const resolutions = options?.conflictResolutions ?? {};\n\n for (const comparison of comparisons) {\n const { filePath, changeType } = comparison;\n const localPath = path.join(filesDir, filePath);\n const remoteInfo = remoteContentMap.get(filePath);\n\n switch (changeType) {\n case 'unchanged':\n case 'local_modified':\n case 'local_new':\n result.unchanged.push(filePath);\n // Update sync state for remote side if we have remote info\n if (remoteInfo) {\n const existingSync = syncState.files[filePath];\n if (existingSync) {\n existingSync.remoteHash = remoteInfo.hash;\n existingSync.metadata = this.buildMetadata(remoteInfo.file);\n }\n }\n break;\n\n case 'local_deleted':\n // Local deleted, remote unchanged - skip (push will handle)\n result.unchanged.push(filePath);\n break;\n\n case 'remote_modified':\n case 'remote_new':\n // Safe to write\n ensureDirectoryExists(path.dirname(localPath));\n fs.writeFileSync(localPath, remoteInfo!.content);\n result.downloaded.push(filePath);\n syncState.files[filePath] = {\n localHash: remoteInfo!.hash,\n remoteHash: remoteInfo!.hash,\n metadata: this.buildMetadata(remoteInfo!.file),\n };\n break;\n\n case 'remote_deleted':\n // Safe to delete (local is unchanged)\n if (fs.existsSync(localPath)) {\n fs.unlinkSync(localPath);\n }\n result.deleted.push(filePath);\n delete syncState.files[filePath];\n break;\n\n case 'conflict_both_modified':\n case 'conflict_local_modified_remote_deleted':\n case 'conflict_local_deleted_remote_modified':\n case 'conflict_both_new': {\n if (options?.force) {\n // Force: apply remote state\n if (remoteInfo) {\n ensureDirectoryExists(path.dirname(localPath));\n fs.writeFileSync(localPath, remoteInfo.content);\n result.downloaded.push(filePath);\n syncState.files[filePath] = {\n localHash: remoteInfo.hash,\n remoteHash: remoteInfo.hash,\n metadata: this.buildMetadata(remoteInfo.file),\n };\n } else {\n // Remote deleted, force means delete local\n if (fs.existsSync(localPath)) {\n fs.unlinkSync(localPath);\n result.deleted.push(filePath);\n }\n delete syncState.files[filePath];\n }\n break;\n }\n\n const resolution = resolutions[filePath];\n if (!resolution) {\n // No resolution provided - report conflict, skip file\n result.conflicts.push(SyncService.buildConflicts([comparison])[0]);\n break;\n }\n\n switch (resolution) {\n case 'keep_local':\n // Keep local as-is, update sync state to mark conflict resolved\n if (fs.existsSync(localPath)) {\n const localContent = fs.readFileSync(localPath);\n const localHash = calculateHash(localContent);\n syncState.files[filePath] = {\n localHash,\n remoteHash: comparison.currentRemoteHash ?? '',\n metadata: remoteInfo ? this.buildMetadata(remoteInfo.file) : undefined,\n };\n } else {\n // Local was deleted, user wants to keep that decision\n delete syncState.files[filePath];\n }\n result.unchanged.push(filePath);\n break;\n\n case 'keep_remote':\n if (remoteInfo) {\n ensureDirectoryExists(path.dirname(localPath));\n fs.writeFileSync(localPath, remoteInfo.content);\n result.downloaded.push(filePath);\n syncState.files[filePath] = {\n localHash: remoteInfo.hash,\n remoteHash: remoteInfo.hash,\n metadata: this.buildMetadata(remoteInfo.file),\n };\n } else {\n // Remote deleted\n if (fs.existsSync(localPath)) {\n fs.unlinkSync(localPath);\n result.deleted.push(filePath);\n }\n delete syncState.files[filePath];\n }\n break;\n\n case 'keep_both':\n if (remoteInfo) {\n // Write remote version as .remote file alongside local\n const ext = path.extname(filePath);\n const base = filePath.slice(0, -ext.length || undefined);\n const conflictFileName = `${base}.remote${ext}`;\n const conflictPath = path.join(filesDir, conflictFileName);\n ensureDirectoryExists(path.dirname(conflictPath));\n fs.writeFileSync(conflictPath, remoteInfo.content);\n result.conflictFilesWritten.push(conflictFileName);\n }\n // Keep local, update sync state\n if (fs.existsSync(localPath)) {\n const localContent = fs.readFileSync(localPath);\n const localHash = calculateHash(localContent);\n syncState.files[filePath] = {\n localHash,\n remoteHash: comparison.currentRemoteHash ?? '',\n metadata: remoteInfo ? this.buildMetadata(remoteInfo.file) : undefined,\n };\n }\n result.unchanged.push(filePath);\n break;\n }\n break;\n }\n }\n }\n\n syncState.lastSync = new Date().toISOString();\n this.saveSyncState(syncState);\n\n return result;\n }\n\n private buildMetadata(file: RemoteFile): SyncFileInfo['metadata'] {\n if (!file.metadata) return undefined;\n return {\n uploadTime: file.metadata.uploadTime,\n uploaderEmail: file.metadata.uploader?.email,\n uploaderName: file.metadata.uploader\n ? `${file.metadata.uploader.firstName} ${file.metadata.uploader.lastName}`.trim()\n : undefined,\n lastFetched: new Date().toISOString(),\n };\n }\n\n async push(options?: { force?: boolean }): Promise<{\n uploaded: string[];\n updated: string[];\n deleted: string[];\n unchanged: string[];\n conflicts: SyncConflict[];\n }> {\n const filesDir = getTenantFilesDir(this.tenant);\n const syncState = this.loadSyncState();\n\n const result = {\n uploaded: [] as string[],\n updated: [] as string[],\n deleted: [] as string[],\n unchanged: [] as string[],\n conflicts: [] as SyncConflict[],\n };\n\n // Get current remote files (just the list, not content)\n const remoteFiles = await this.farseerClient.listFiles();\n const remoteFileMap = new Map<string, RemoteFile>();\n for (const file of remoteFiles) {\n remoteFileMap.set(file.path, file);\n }\n\n // Get local files and hashes\n const localFiles = getAllFilesInDir(filesDir);\n const localHashes = new Map<string, string>();\n const localContents = new Map<string, Buffer>();\n for (const localFile of localFiles) {\n const localPath = path.join(filesDir, localFile);\n const content = fs.readFileSync(localPath);\n localHashes.set(localFile, calculateHash(content));\n localContents.set(localFile, content);\n }\n\n // Identify candidates that need remote content check for conflict detection\n const candidateFiles: string[] = [];\n for (const localFile of localFiles) {\n const syncInfo = syncState.files[localFile];\n const localHash = localHashes.get(localFile)!;\n if (!syncInfo || localHash !== syncInfo.localHash) {\n // Changed or new locally\n if (remoteFileMap.has(localFile)) {\n candidateFiles.push(localFile);\n }\n }\n }\n // Also check files in sync state that no longer exist locally (local deletions)\n const locallyDeletedFiles = Object.keys(syncState.files).filter(\n (f) => !localFiles.includes(f) && remoteFileMap.has(f),\n );\n const filesToFetchRemote = [...new Set([...candidateFiles, ...locallyDeletedFiles])];\n\n // Fetch remote content for conflict detection\n const remoteHashes = new Map<string, string>();\n if (filesToFetchRemote.length > 0 && !options?.force) {\n const toFetch = filesToFetchRemote.filter((f) => remoteFileMap.has(f)).map((f) => remoteFileMap.get(f)!);\n\n const fetched = await fetchWithConcurrency(\n toFetch,\n async (file) => {\n const content = await this.farseerClient.getFileContentAsBuffer(file.reference);\n return { file, hash: calculateHash(content) };\n },\n 15,\n );\n\n for (const { file, hash } of fetched) {\n remoteHashes.set(file.path, hash);\n }\n }\n\n // Three-way comparison for conflict detection\n const comparisons = this.compareFiles({ localHashes, remoteHashes, syncState, all: true });\n const conflictPaths = new Set<string>();\n\n if (!options?.force) {\n for (const c of comparisons) {\n if (c.changeType.startsWith('conflict_')) {\n const conflict = SyncService.buildConflicts([c])[0];\n result.conflicts.push(conflict);\n conflictPaths.add(c.filePath);\n }\n }\n }\n\n // Process non-conflicting files\n for (const localFile of localFiles) {\n if (conflictPaths.has(localFile)) continue;\n\n const localPath = path.join(filesDir, localFile);\n const content = localContents.get(localFile)!;\n const localHash = localHashes.get(localFile)!;\n\n const remoteFile = remoteFileMap.get(localFile);\n const syncInfo = syncState.files[localFile];\n\n if (remoteFile) {\n // File exists on remote - check if local changed since last sync\n if (syncInfo && localHash === syncInfo.localHash) {\n result.unchanged.push(localFile);\n } else {\n // Local file changed - needs update\n await this.farseerClient.updateFile(remoteFile.reference, content, path.basename(localFile));\n result.updated.push(localFile);\n syncState.files[localFile] = {\n localHash: localHash,\n remoteHash: localHash,\n };\n }\n } else {\n // File doesn't exist on remote\n if (syncInfo && localHash === syncInfo.localHash) {\n // Local unchanged, was deleted on remote - skip (don't re-upload)\n result.unchanged.push(localFile);\n } else {\n // New or modified local file - upload\n const pathParts = localFile.split('/');\n const fileName = pathParts.pop()!;\n const folderPath = ['Files', ...pathParts];\n await this.farseerClient.createFile(content, fileName, folderPath);\n result.uploaded.push(localFile);\n syncState.files[localFile] = {\n localHash: localHash,\n remoteHash: localHash,\n };\n }\n }\n }\n\n // Delete files on remote that were deleted locally (non-conflicting only)\n const localFileSet = new Set(localFiles);\n for (const [remotePath, remoteFile] of remoteFileMap) {\n if (!localFileSet.has(remotePath) && !conflictPaths.has(remotePath)) {\n const syncInfo = syncState.files[remotePath];\n if (syncInfo) {\n // Was synced before, now deleted locally - delete on remote\n await this.farseerClient.deleteFile(remoteFile.reference);\n result.deleted.push(remotePath);\n delete syncState.files[remotePath];\n }\n }\n }\n\n syncState.lastSync = new Date().toISOString();\n this.saveSyncState(syncState);\n\n return result;\n }\n\n async checkRemoteChanges(): Promise<boolean> {\n const syncState = this.loadSyncState();\n let remoteFiles = await this.farseerClient.listFiles();\n\n // Filter to scripts only (same as pull/status) to avoid false positives\n // from non-script files like .json, .png, etc.\n remoteFiles = remoteFiles.filter((f) =>\n DEFAULT_SCRIPT_EXTENSIONS.some((ext) => f.name.toLowerCase().endsWith(ext)),\n );\n\n // Quick check: new files on remote that we don't have in sync state\n for (const file of remoteFiles) {\n const syncInfo = syncState.files[file.path];\n if (!syncInfo) {\n return true; // New file on remote\n }\n }\n\n // Quick check: files deleted on remote that we have in sync state\n for (const filePath of Object.keys(syncState.files)) {\n // Only check script files\n const isScript = DEFAULT_SCRIPT_EXTENSIONS.some((ext) => filePath.toLowerCase().endsWith(ext));\n if (!isScript) continue;\n\n const exists = remoteFiles.some((f) => f.path === filePath);\n if (!exists && syncState.files[filePath].remoteHash) {\n return true; // File was deleted on remote\n }\n }\n\n // Note: We don't check for content changes here anymore for performance.\n // After a pull, sync state is accurate. Content changes by others\n // between pull and push are a rare edge case - user should pull first.\n return false;\n }\n\n async getFileDiff(filePath: string): Promise<{\n localContent: string | null;\n remoteContent: string | null;\n }> {\n const filesDir = getTenantFilesDir(this.tenant);\n const localPath = path.join(filesDir, filePath);\n\n let localContent: string | null = null;\n let remoteContent: string | null = null;\n\n if (fs.existsSync(localPath)) {\n // For diff, read as text (diff only makes sense for text files)\n localContent = fs.readFileSync(localPath, 'utf-8');\n }\n\n const remoteFile = await this.farseerClient.getFileByPath(filePath);\n if (remoteFile) {\n remoteContent = await this.farseerClient.getFileContent(remoteFile.reference);\n }\n\n return { localContent, remoteContent };\n }\n\n /**\n * Three-way comparison of all files.\n * Compares current local state, current remote state, and baseline from sync state.\n */\n compareFiles(options: {\n localHashes: Map<string, string>;\n remoteHashes: Map<string, string>;\n syncState: SyncState;\n all?: boolean;\n }): FileCompareResult[] {\n const { localHashes, remoteHashes, syncState } = options;\n\n // Union of all known file paths\n const allPaths = new Set<string>([\n ...localHashes.keys(),\n ...remoteHashes.keys(),\n ...Object.keys(syncState.files),\n ]);\n\n const results: FileCompareResult[] = [];\n\n for (const filePath of allPaths) {\n // Filter non-script files unless --all\n if (!options.all) {\n if (!DEFAULT_SCRIPT_EXTENSIONS.some((ext) => filePath.toLowerCase().endsWith(ext))) {\n continue;\n }\n }\n\n const currentLocalHash = localHashes.get(filePath) ?? null;\n const currentRemoteHash = remoteHashes.get(filePath) ?? null;\n const baseline = syncState.files[filePath];\n const baselineLocalHash = baseline?.localHash ?? null;\n const baselineRemoteHash = baseline?.remoteHash ?? null;\n\n const localExists = currentLocalHash !== null;\n const remoteExists = currentRemoteHash !== null;\n const hadBaseline = baseline != null;\n\n let changeType: FileChangeType;\n\n if (localExists && remoteExists) {\n // Both exist\n if (currentLocalHash === currentRemoteHash) {\n changeType = 'unchanged';\n } else if (!hadBaseline) {\n changeType = 'conflict_both_new';\n } else {\n const localChanged = currentLocalHash !== baselineLocalHash;\n const remoteChanged = currentRemoteHash !== baselineRemoteHash;\n\n if (localChanged && remoteChanged) {\n changeType = 'conflict_both_modified';\n } else if (localChanged) {\n changeType = 'local_modified';\n } else if (remoteChanged) {\n changeType = 'remote_modified';\n } else {\n changeType = 'unchanged';\n }\n }\n } else if (localExists && !remoteExists) {\n // Only local exists\n if (!hadBaseline) {\n changeType = 'local_new';\n } else {\n const localChanged = currentLocalHash !== baselineLocalHash;\n if (localChanged) {\n changeType = 'conflict_local_modified_remote_deleted';\n } else {\n changeType = 'remote_deleted';\n }\n }\n } else if (!localExists && remoteExists) {\n // Only remote exists\n if (!hadBaseline) {\n changeType = 'remote_new';\n } else {\n const remoteChanged = currentRemoteHash !== baselineRemoteHash;\n if (remoteChanged) {\n changeType = 'conflict_local_deleted_remote_modified';\n } else {\n changeType = 'local_deleted';\n }\n }\n } else {\n // Neither exists - both deleted since baseline, clean up\n continue;\n }\n\n results.push({\n filePath,\n changeType,\n currentLocalHash,\n currentRemoteHash,\n baselineLocalHash,\n baselineRemoteHash,\n });\n }\n\n return results;\n }\n\n /**\n * Extract SyncConflict[] from FileCompareResult[].\n */\n static buildConflicts(comparisons: FileCompareResult[]): SyncConflict[] {\n const conflicts: SyncConflict[] = [];\n for (const c of comparisons) {\n switch (c.changeType) {\n case 'conflict_both_modified':\n conflicts.push({\n filePath: c.filePath,\n type: 'both_modified',\n description: 'Both local and remote versions modified since last sync',\n });\n break;\n case 'conflict_local_modified_remote_deleted':\n conflicts.push({\n filePath: c.filePath,\n type: 'local_modified_remote_deleted',\n description: 'File modified locally but deleted on remote',\n });\n break;\n case 'conflict_local_deleted_remote_modified':\n conflicts.push({\n filePath: c.filePath,\n type: 'local_deleted_remote_modified',\n description: 'File deleted locally but modified on remote',\n });\n break;\n case 'conflict_both_new':\n conflicts.push({\n filePath: c.filePath,\n type: 'both_new',\n description: 'File exists both locally and remotely with different content (no sync baseline)',\n });\n break;\n }\n }\n return conflicts;\n }\n\n /**\n * Batch fetch metadata for multiple files in parallel.\n * Fetches metadata in batches of 10 to avoid overwhelming the API.\n * Non-critical operation - failures are silently ignored.\n */\n private async fetchMetadataForFiles(files: RemoteFile[]): Promise<RemoteFile[]> {\n const batchSize = 10;\n\n for (let i = 0; i < files.length; i += batchSize) {\n const batch = files.slice(i, i + batchSize);\n\n await Promise.all(\n batch.map(async (file) => {\n try {\n const metadata = await this.farseerClient.getFileMetadata(file.reference);\n if (metadata) {\n file.metadata = metadata;\n }\n } catch {\n // Silently ignore metadata fetch errors - non-critical\n }\n }),\n );\n }\n\n return files;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,4BAAsE;AACtE,qBAOO;AACP,oBAAuB;AA4DhB,MAAM,YAAY;AAAA,EAIrB,YAAY,QAAgB,eAA+B;AACvD,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACzB;AAAA,EAEA,gBAA2B;AACvB,U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,EAAE;AAAA,YACZ,MAAM;AAAA,YACN,aAAa;AAAA,UACjB,CAAC;AACD;AAAA,QACJ,KAAK;AACD,oBAAU,KAAK;AAAA,YACX,UAAU,EAAE;AAAA,YACZ,MAAM;AAAA,YACN,aAAa;AAAA,UACjB,CAAC;AACD;AAAA,QACJ,KAAK;AACD,oBAAU,KAAK;AAAA,YACX,UAAU,EAAE;AAAA,YACZ,MAAM;AAAA,YACN,aAAa;AAAA,UACjB,CAAC;AACD;AAAA,QACJ,KAAK;AACD,oBAAU,KAAK;AAAA,YACX,UAAU,EAAE;AAAA,YACZ,MAAM;AAAA,YACN,aAAa;AAAA,UACjB,CAAC;AACD;AAAA,MACR;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAc,sBAAsB,OAA4C;AAC5E,UAAM,YAAY;AAElB,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,WAAW;AAC9C,YAAM,QAAQ,MAAM,MAAM,GAAG,IAAI,SAAS;AAE1C,YAAM,QAAQ;AAAA,QACV,MAAM,IAAI,OAAO,SAAS;AACtB,cAAI;AACA,kBAAM,WAAW,MAAM,KAAK,cAAc,gBAAgB,KAAK,SAAS;AACxE,gBAAI,UAAU;AACV,mBAAK,WAAW;AAAA,YACpB;AAAA,UACJ,QAAQ;AAAA,UAER;AAAA,QACJ,CAAC;AAAA,MACL;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AACJ;",
6
+ "names": []
7
+ }
@@ -1,21 +1,54 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SCRIPT_EXTENSIONS = exports.SCRIPTS_FOLDER_PATH = exports.KEYCLOAK_CLIENT_ID = exports.KEYCLOAK_TOKEN_URL = exports.FARSEER_CLIENT_AXIOS_URL = exports.FARSEER_CLIENT_URL = exports.CLI_VERSION = void 0;
7
- // CLI version - read dynamically from package.json
8
- const fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
10
- const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '../../package.json'), 'utf-8'));
11
- exports.CLI_VERSION = packageJson.version;
12
- // Farseer client package URLs - update these when new versions are released
13
- exports.FARSEER_CLIENT_URL = 'https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client/release-1.4.5.tar';
14
- exports.FARSEER_CLIENT_AXIOS_URL = 'https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client-axios/6898c0cb-5dca-4b2f-b325-119efc7f099e/v1.0.1.tar';
15
- // Keycloak auth configuration
16
- exports.KEYCLOAK_TOKEN_URL = 'https://login.farseer.io/auth/realms/master/protocol/openid-connect/token';
17
- exports.KEYCLOAK_CLIENT_ID = 'security-admin-console';
18
- // Default paths
19
- exports.SCRIPTS_FOLDER_PATH = ['Files', 'Scripts'];
20
- // Supported script file extensions
21
- exports.SCRIPT_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs'];
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var constants_exports = {};
30
+ __export(constants_exports, {
31
+ CLI_VERSION: () => CLI_VERSION,
32
+ FARSEER_CLIENT_AXIOS_URL: () => FARSEER_CLIENT_AXIOS_URL,
33
+ FARSEER_CLIENT_URL: () => FARSEER_CLIENT_URL,
34
+ SCRIPTS_FOLDER_PATH: () => SCRIPTS_FOLDER_PATH,
35
+ SCRIPT_EXTENSIONS: () => SCRIPT_EXTENSIONS
36
+ });
37
+ module.exports = __toCommonJS(constants_exports);
38
+ var import_fs = __toESM(require("fs"));
39
+ var import_path = __toESM(require("path"));
40
+ const packageJson = JSON.parse(import_fs.default.readFileSync(import_path.default.join(__dirname, "../../package.json"), "utf-8"));
41
+ const CLI_VERSION = packageJson.version;
42
+ const FARSEER_CLIENT_URL = "https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client/release-1.4.5.tar";
43
+ const FARSEER_CLIENT_AXIOS_URL = "https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client-axios/6898c0cb-5dca-4b2f-b325-119efc7f099e/v1.0.1.tar";
44
+ const SCRIPTS_FOLDER_PATH = ["Files", "Scripts"];
45
+ const SCRIPT_EXTENSIONS = [".ts", ".js", ".mjs", ".cjs"];
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ CLI_VERSION,
49
+ FARSEER_CLIENT_AXIOS_URL,
50
+ FARSEER_CLIENT_URL,
51
+ SCRIPTS_FOLDER_PATH,
52
+ SCRIPT_EXTENSIONS
53
+ });
54
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/constants.ts"],
4
+ "sourcesContent": ["// CLI version - read dynamically from package.json\nimport fs from 'fs';\nimport path from 'path';\n\nconst packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'));\nexport const CLI_VERSION: string = packageJson.version;\n\n// Farseer client package URLs - update these when new versions are released\nexport const FARSEER_CLIENT_URL =\n 'https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client/release-1.4.5.tar';\nexport const FARSEER_CLIENT_AXIOS_URL =\n 'https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client-axios/6898c0cb-5dca-4b2f-b325-119efc7f099e/v1.0.1.tar';\n\n// Default paths\nexport const SCRIPTS_FOLDER_PATH = ['Files', 'Scripts'];\n\n// Supported script file extensions\nexport const SCRIPT_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs'];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAAe;AACf,kBAAiB;AAEjB,MAAM,cAAc,KAAK,MAAM,UAAAA,QAAG,aAAa,YAAAC,QAAK,KAAK,WAAW,oBAAoB,GAAG,OAAO,CAAC;AAC5F,MAAM,cAAsB,YAAY;AAGxC,MAAM,qBACT;AACG,MAAM,2BACT;AAGG,MAAM,sBAAsB,CAAC,SAAS,SAAS;AAG/C,MAAM,oBAAoB,CAAC,OAAO,OAAO,QAAQ,MAAM;",
6
+ "names": ["fs", "path"]
7
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var entityResolver_exports = {};
30
+ __export(entityResolver_exports, {
31
+ resolveDashboardId: () => resolveDashboardId,
32
+ resolveSheetId: () => resolveSheetId
33
+ });
34
+ module.exports = __toCommonJS(entityResolver_exports);
35
+ var farseer = __toESM(require("farseer-client"));
36
+ async function resolveSheetId(nativeClient, nameOrId) {
37
+ const parsed = Number(nameOrId);
38
+ if (!isNaN(parsed) && String(parsed) === nameOrId) {
39
+ try {
40
+ const sheet = await nativeClient.sheets.get(parsed);
41
+ return { id: sheet.id, name: sheet.name };
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+ const entities = await nativeClient.entities.getAll([farseer.EntityType.Sheet]);
47
+ const match = entities.find((e) => {
48
+ const meta = e.meta;
49
+ return meta?.name?.toLowerCase() === nameOrId.toLowerCase();
50
+ });
51
+ if (match) {
52
+ return { id: match.id, name: match.meta?.name || nameOrId };
53
+ }
54
+ return null;
55
+ }
56
+ async function resolveDashboardId(nativeClient, nameOrId) {
57
+ const parsed = Number(nameOrId);
58
+ if (!isNaN(parsed) && String(parsed) === nameOrId) {
59
+ try {
60
+ const dashboard = await nativeClient.dashboards.get(parsed);
61
+ return { id: dashboard.id, name: dashboard.name };
62
+ } catch {
63
+ return null;
64
+ }
65
+ }
66
+ const dashboards = await nativeClient.dashboards.list();
67
+ const match = dashboards.find((d) => d.name.toLowerCase() === nameOrId.toLowerCase());
68
+ if (match) {
69
+ return { id: match.id, name: match.name };
70
+ }
71
+ return null;
72
+ }
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ resolveDashboardId,
76
+ resolveSheetId
77
+ });
78
+ //# sourceMappingURL=entityResolver.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/entityResolver.ts"],
4
+ "sourcesContent": ["/**\n * Entity Resolver Utilities\n *\n * Resolve sheet/dashboard names to IDs using the native Farseer client.\n */\n\nimport * as farseer from 'farseer-client';\n\n/**\n * Resolve a sheet by name or ID.\n * - If numeric, fetches directly by ID\n * - If string, searches all sheet entities by name (case-insensitive)\n */\nexport async function resolveSheetId(\n nativeClient: farseer.FarseerClient,\n nameOrId: string,\n): Promise<{ id: number; name: string } | null> {\n const parsed = Number(nameOrId);\n if (!isNaN(parsed) && String(parsed) === nameOrId) {\n try {\n const sheet = await nativeClient.sheets.get(parsed);\n return { id: sheet.id, name: sheet.name };\n } catch {\n return null;\n }\n }\n\n // Search by name\n const entities = await nativeClient.entities.getAll([farseer.EntityType.Sheet]);\n const match = entities.find((e) => {\n const meta = (e as any).meta;\n return meta?.name?.toLowerCase() === nameOrId.toLowerCase();\n });\n\n if (match) {\n return { id: (match as any).id, name: (match as any).meta?.name || nameOrId };\n }\n\n return null;\n}\n\n/**\n * Resolve a dashboard by name or ID.\n * - If numeric, fetches directly by ID\n * - If string, lists all dashboards and matches by name (case-insensitive)\n */\nexport async function resolveDashboardId(\n nativeClient: farseer.FarseerClient,\n nameOrId: string,\n): Promise<{ id: number; name: string } | null> {\n const parsed = Number(nameOrId);\n if (!isNaN(parsed) && String(parsed) === nameOrId) {\n try {\n const dashboard = await nativeClient.dashboards.get(parsed);\n return { id: dashboard.id, name: dashboard.name };\n } catch {\n return null;\n }\n }\n\n // Search by name\n const dashboards = await nativeClient.dashboards.list();\n const match = dashboards.find((d) => d.name.toLowerCase() === nameOrId.toLowerCase());\n\n if (match) {\n return { id: match.id, name: match.name };\n }\n\n return null;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,cAAyB;AAOzB,eAAsB,eAClB,cACA,UAC4C;AAC5C,QAAM,SAAS,OAAO,QAAQ;AAC9B,MAAI,CAAC,MAAM,MAAM,KAAK,OAAO,MAAM,MAAM,UAAU;AAC/C,QAAI;AACA,YAAM,QAAQ,MAAM,aAAa,OAAO,IAAI,MAAM;AAClD,aAAO,EAAE,IAAI,MAAM,IAAI,MAAM,MAAM,KAAK;AAAA,IAC5C,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AAGA,QAAM,WAAW,MAAM,aAAa,SAAS,OAAO,CAAC,QAAQ,WAAW,KAAK,CAAC;AAC9E,QAAM,QAAQ,SAAS,KAAK,CAAC,MAAM;AAC/B,UAAM,OAAQ,EAAU;AACxB,WAAO,MAAM,MAAM,YAAY,MAAM,SAAS,YAAY;AAAA,EAC9D,CAAC;AAED,MAAI,OAAO;AACP,WAAO,EAAE,IAAK,MAAc,IAAI,MAAO,MAAc,MAAM,QAAQ,SAAS;AAAA,EAChF;AAEA,SAAO;AACX;AAOA,eAAsB,mBAClB,cACA,UAC4C;AAC5C,QAAM,SAAS,OAAO,QAAQ;AAC9B,MAAI,CAAC,MAAM,MAAM,KAAK,OAAO,MAAM,MAAM,UAAU;AAC/C,QAAI;AACA,YAAM,YAAY,MAAM,aAAa,WAAW,IAAI,MAAM;AAC1D,aAAO,EAAE,IAAI,UAAU,IAAI,MAAM,UAAU,KAAK;AAAA,IACpD,QAAQ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