MCPcopy Index your code
hub / github.com/directus/directus / listProviderProjects

Method listProviderProjects

api/src/services/deployment.ts:311–331  ·  view source on GitHub ↗

* List projects from provider with caching

(provider: ProviderType)

Source from the content-addressed store, hash-verified

309 * List projects from provider with caching
310 */
311 async listProviderProjects(provider: ProviderType): Promise<CachedResult<Project[]>> {
312 const cacheKey = `${provider}:projects`;
313 const { deploymentCache } = getCache();
314
315 // Check cache first
316 const cached = await getCacheValueWithTTL(deploymentCache, cacheKey);
317
318 if (cached) {
319 return { data: cached.data, remainingTTL: cached.remainingTTL };
320 }
321
322 // Fetch from driver
323 const driver = await this.getDriver(provider);
324 const projects = await driver.listProjects();
325
326 // Store in cache
327 await setCacheValueWithExpiry(deploymentCache, cacheKey, projects, DEPLOYMENT_CACHE_TTL);
328
329 // Return with full TTL (just cached)
330 return { data: projects, remainingTTL: DEPLOYMENT_CACHE_TTL };
331 }
332
333 /**
334 * Get project details from provider with caching

Callers

nothing calls this directly

Calls 5

getDriverMethod · 0.95
getCacheValueWithTTLFunction · 0.85
setCacheValueWithExpiryFunction · 0.85
getCacheFunction · 0.50
listProjectsMethod · 0.45

Tested by

no test coverage detected