Skip to content

TypeScript API / @laikacms/bitbucket/storage-bb / BitbucketStorageRepository

Class: BitbucketStorageRepository ​

A StorageRepository backed by a Bitbucket Cloud repository. Closes the git-platform triumvirate alongside @laikacms/github and @laikacms/gitlab.

The Bitbucket-shaped quirk: all writes go through one endpoint. Creates, updates, and deletes are folded into multipart POST /src payloads, which means a future "transactional commit" (multiple files in one commit) is a thin layer above dataSource.commit({...}). The current repository surface stays one-file-at-a-time for API parity with the other git platforms.

Extends ​

Constructors ​

Constructor ​

ts
new BitbucketStorageRepository(options): BitbucketStorageRepository;

Parameters ​

ParameterType
optionsBitbucketStorageRepositoryOptions

Returns ​

BitbucketStorageRepository

Overrides ​

StorageRepository.constructor

Methods ​

createFolder() ​

ts
createFolder(folderCreate): LaikaTask<{
  createdAt?: string;
  key: string;
  type: "folder";
  updatedAt?: string;
}>;

Parameters ​

ParameterType
folderCreate{ key: string; type?: "folder"; }
folderCreate.keystring
folderCreate.type?"folder"

Returns ​

LaikaTask<{ createdAt?: string; key: string; type: "folder"; updatedAt?: string; }>

Overrides ​

StorageRepository.createFolder


createObject() ​

ts
createObject(create): LaikaTask<{
  content: {
   [key: string]: any;
  };
  createdAt?: string;
  key: string;
  metadata?: {
     extension?: string;
     revisionId?: string;
  };
  type: "object";
  updatedAt?: string;
}>;

Parameters ​

ParameterTypeDescription
create{ content: { [key: string]: any; }; key: string; metadata?: { extension?: string; revisionId?: string; }; type?: "object"; }-
create.content{ [key: string]: any; }-
create.keystring-
create.metadata?{ extension?: string; revisionId?: string; }Optional capability-driven metadata hints. Read by the storage's determineExtension callback to decide the on-disk format.
create.metadata.extension?stringFile extension to use when (de)serializing this object. Active on backends whose Capabilities.fileExtensions.supported is true. Must match a key in Capabilities.fileExtensions.supportedExtensions. On writes: hint to the backend to use this extension's serializer. On reads: the extension the backend used to (de)serialize the object.
create.metadata.revisionId?stringBackend-specific revision identifier (e.g., GitHub commit SHA, R2 ETag, version ID). Active on backends that track per-object revisions.
create.type?"object"-

Returns ​

LaikaTask<{ content: { [key: string]: any; }; createdAt?: string; key: string; metadata?: { extension?: string; revisionId?: string; }; type: "object"; updatedAt?: string; }>

Overrides ​

StorageRepository.createObject


createOrUpdateObject() ​

ts
createOrUpdateObject(create): LaikaTask<{
  content: {
   [key: string]: any;
  };
  createdAt?: string;
  key: string;
  metadata?: {
     extension?: string;
     revisionId?: string;
  };
  type: "object";
  updatedAt?: string;
}>;

Parameters ​

ParameterTypeDescription
create{ content: { [key: string]: any; }; key: string; metadata?: { extension?: string; revisionId?: string; }; type?: "object"; }-
create.content{ [key: string]: any; }-
create.keystring-
create.metadata?{ extension?: string; revisionId?: string; }Optional capability-driven metadata hints. Read by the storage's determineExtension callback to decide the on-disk format.
create.metadata.extension?stringFile extension to use when (de)serializing this object. Active on backends whose Capabilities.fileExtensions.supported is true. Must match a key in Capabilities.fileExtensions.supportedExtensions. On writes: hint to the backend to use this extension's serializer. On reads: the extension the backend used to (de)serialize the object.
create.metadata.revisionId?stringBackend-specific revision identifier (e.g., GitHub commit SHA, R2 ETag, version ID). Active on backends that track per-object revisions.
create.type?"object"-

Returns ​

LaikaTask<{ content: { [key: string]: any; }; createdAt?: string; key: string; metadata?: { extension?: string; revisionId?: string; }; type: "object"; updatedAt?: string; }>

Overrides ​

StorageRepository.createOrUpdateObject


getAtom() ​

ts
getAtom(key): LaikaTask<
  | {
  createdAt?: string;
  key: string;
  type: "folder";
  updatedAt?: string;
}
  | {
  content: {
   [key: string]: any;
  };
  createdAt?: string;
  key: string;
  metadata?: {
     extension?: string;
     revisionId?: string;
  };
  type: "object";
  updatedAt?: string;
}>;

Parameters ​

ParameterType
keystring

Returns ​

LaikaTask< | { createdAt?: string; key: string; type: "folder"; updatedAt?: string; } | { content: { [key: string]: any; }; createdAt?: string; key: string; metadata?: { extension?: string; revisionId?: string; }; type: "object"; updatedAt?: string; }>

Overrides ​

StorageRepository.getAtom


getCapabilities() ​

ts
getCapabilities(): LaikaTask<{
  changes:   | {
     description: string;
     supported: false;
   }
     | {
     changeFeed: boolean;
     description: string;
     subscription: boolean;
     supported: true;
     syncToken: boolean;
   };
  compatibilityDate: string & Brand<"StorageRepositoryCompatibilityDate">;
  fileExtensions:   | {
     description: string;
     supported: false;
   }
     | {
     description: string;
     supported: true;
     supportedExtensions: {
      [key: string]: object;
     };
   };
  pagination:   | {
     description: string;
     supported: false;
   }
     | {
     description: string;
     styles: {
        cursor: boolean;
        offset: boolean;
        page: boolean;
     };
     supported: true;
   };
}>;

Returns ​

LaikaTask<{ changes: | { description: string; supported: false; } | { changeFeed: boolean; description: string; subscription: boolean; supported: true; syncToken: boolean; }; compatibilityDate: string & Brand<"StorageRepositoryCompatibilityDate">; fileExtensions: | { description: string; supported: false; } | { description: string; supported: true; supportedExtensions: { [key: string]: object; }; }; pagination: | { description: string; supported: false; } | { description: string; styles: { cursor: boolean; offset: boolean; page: boolean; }; supported: true; }; }>

Overrides ​

StorageRepository.getCapabilities


getFolder() ​

ts
getFolder(key): LaikaTask<{
  createdAt?: string;
  key: string;
  type: "folder";
  updatedAt?: string;
}>;

Parameters ​

ParameterType
keystring

Returns ​

LaikaTask<{ createdAt?: string; key: string; type: "folder"; updatedAt?: string; }>

Overrides ​

StorageRepository.getFolder


getObject() ​

ts
getObject(key): LaikaTask<{
  content: {
   [key: string]: any;
  };
  createdAt?: string;
  key: string;
  metadata?: {
     extension?: string;
     revisionId?: string;
  };
  type: "object";
  updatedAt?: string;
}>;

Parameters ​

ParameterType
keystring

Returns ​

LaikaTask<{ content: { [key: string]: any; }; createdAt?: string; key: string; metadata?: { extension?: string; revisionId?: string; }; type: "object"; updatedAt?: string; }>

Overrides ​

StorageRepository.getObject


listAtoms() ​

ts
listAtoms(folderKey, options): LaikaStream<
  | {
  createdAt?: string;
  key: string;
  type: "folder";
  updatedAt?: string;
}
  | {
  content: {
   [key: string]: any;
  };
  createdAt?: string;
  key: string;
  metadata?: {
     extension?: string;
     revisionId?: string;
  };
  type: "object";
  updatedAt?: string;
}, LaikaDone>;

Parameters ​

ParameterType
folderKeystring
optionsListAtomsOptions

Returns ​

LaikaStream< | { createdAt?: string; key: string; type: "folder"; updatedAt?: string; } | { content: { [key: string]: any; }; createdAt?: string; key: string; metadata?: { extension?: string; revisionId?: string; }; type: "object"; updatedAt?: string; }, LaikaDone>

Overrides ​

StorageRepository.listAtoms


listAtomSummaries() ​

ts
listAtomSummaries(folderKey, options): LaikaStream<
  | {
  createdAt?: string;
  key: string;
  type: "object-summary";
  updatedAt?: string;
}
  | {
  createdAt?: string;
  key: string;
  type: "folder-summary";
  updatedAt?: string;
}, LaikaDone>;

Parameters ​

ParameterType
folderKeystring
optionsListAtomsOptions

Returns ​

LaikaStream< | { createdAt?: string; key: string; type: "object-summary"; updatedAt?: string; } | { createdAt?: string; key: string; type: "folder-summary"; updatedAt?: string; }, LaikaDone>

Overrides ​

StorageRepository.listAtomSummaries


removeAtoms() ​

ts
removeAtoms(keys): LaikaStream<string, RemoveAtomsDone>;

Parameters ​

ParameterType
keysreadonly string[]

Returns ​

LaikaStream<string, RemoveAtomsDone>

Overrides ​

StorageRepository.removeAtoms


subscribeChanges() ​

ts
subscribeChanges(options, listener): Unsubscribe;

Subscribe to live change notifications for a scope (a folder, or the whole store when omitted). listener is invoked with a coalesced, non-empty batch of ChangeSummary entries each time the scope changes. Returns an Unsubscribe that stops delivery; when the last listener leaves, the repository releases any underlying watch resource.

This is the PUSH counterpart to the pull getSyncToken / listChanges feed. Non-abstract on purpose: existing subclasses stay source-compatible. The base implementation throws NotImplementedError; check getCapabilities().changes (the enabled variant's subscription flag) before calling.

Parameters ​

ParameterType
optionsSubscribeChangesOptions
listenerChangeListener

Returns ​

Unsubscribe

Inherited from ​

StorageRepository.subscribeChanges


updateObject() ​

ts
updateObject(update): LaikaTask<{
  content: {
   [key: string]: any;
  };
  createdAt?: string;
  key: string;
  metadata?: {
     extension?: string;
     revisionId?: string;
  };
  type: "object";
  updatedAt?: string;
}>;

Parameters ​

ParameterTypeDescription
update{ content?: { [key: string]: any; }; key: string; metadata?: { extension?: string; revisionId?: string; }; type?: "object"; }-
update.content?{ [key: string]: any; }-
update.keystring-
update.metadata?{ extension?: string; revisionId?: string; }Optional capability-driven metadata hints. May carry a revisionId from a prior read for optimistic concurrency on backends that support it.
update.metadata.extension?stringFile extension to use when (de)serializing this object. Active on backends whose Capabilities.fileExtensions.supported is true. Must match a key in Capabilities.fileExtensions.supportedExtensions. On writes: hint to the backend to use this extension's serializer. On reads: the extension the backend used to (de)serialize the object.
update.metadata.revisionId?stringBackend-specific revision identifier (e.g., GitHub commit SHA, R2 ETag, version ID). Active on backends that track per-object revisions.
update.type?"object"-

Returns ​

LaikaTask<{ content: { [key: string]: any; }; createdAt?: string; key: string; metadata?: { extension?: string; revisionId?: string; }; type: "object"; updatedAt?: string; }>

Overrides ​

StorageRepository.updateObject

Released under the MIT License.