Skip to content

CloudStorageProvider

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/storage/cloud-storage.provider.ts

Cloud storage provider implementation

Implements: IStorageProvider

Methods

MethodSignatureReturns
getModegetMode()StorageMode
saveScreenshotsaveScreenshot(buffer: Buffer, metadata: ScreenshotMetadata)Promise<ScreenshotSaveResult>
findExistingScreenshotfindExistingScreenshot(metadata: Partial<ScreenshotMetadata>)`Promise<ScreenshotSaveResult
saveDocumentsaveDocument(document: DocumentMetadata)Promise<DocumentSaveResult>
documentExistsdocumentExists(projectId: string, categoryPath: string[], slug: string)Promise<boolean>
listDocumentslistDocuments(projectId: string, categoryPath: string[])Promise<Array<{ id: string; title: string; slug: string; url: string }>>

Where it refuses work

  • CloudStorageProvider stops the work with Error when !config?.apiBaseUrl — “CloudStorageProvider requires a non-empty apiBaseUrl”.
  • CloudStorageProvider stops the work with Error when !config.projectId — “CloudStorageProvider requires a non-empty projectId”.
  • CloudStorageProvider stops the work with an early return when !categoryId, in 2 places.
  • CloudStorageProvider stops the work with an early return when existing.
  • CloudStorageProvider stops the work with an early return when !category.

When something fails

  • CloudStorageProvider handles failure in 5 places: it turns it into a return value in all 5.

Was this page helpful?

Download as PDF