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

Method readFileMetadata

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

readFileMetadataFunction · 0.90

Tested by

no test coverage detected