MCPcopy Create free account
hub / github.com/decaporg/decap-cms / readFileMetadata

Method readFileMetadata

packages/decap-cms-backend-azure/src/API.ts:318–346  ·  view source on GitHub ↗
(
    path: string,
    sha: string | null | undefined,
    { branch = this.branch } = {},
  )

Source from the content-addressed store, hash-verified

316 };
317
318 async readFileMetadata(
319 path: string,
320 sha: string | null | undefined,
321 { branch = this.branch } = {},
322 ) {
323 const fetchFileMetadata = async () => {
324 try {
325 const { value } = await this.requestJSON<AzureArray<AzureCommit>>({
326 url: `${this.endpointUrl}/commits/`,
327 params: {
328 'searchCriteria.itemPath': path,
329 'searchCriteria.itemVersion.version': branch,
330 'searchCriteria.$top': 1,
331 },
332 });
333 const [commit] = value;
334
335 return {
336 author: commit.author.name || commit.author.email,
337 updatedOn: commit.author.date,
338 };
339 } catch (error) {
340 return { author: '', updatedOn: '' };
341 }
342 };
343
344 const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
345 return fileMetadata;
346 }
347
348 readFile = (
349 path: string,

Callers

nothing calls this directly

Calls 1

readFileMetadataFunction · 0.90

Tested by

no test coverage detected