TypeScript API / laikacms/storage / StorageRepository
Abstract Class: StorageRepository
Extended by
InMemoryStorageRepositoryDrizzleStorageRepositoryFileSystemStorageRepositoryR2StorageRepositoryWebStorageRepositoryWebFsStorageRepositoryWebDavStorageRepositoryBitbucketStorageRepositoryGithubStorageRepositoryGitlabStorageRepositoryGithubCdnStorageRepositoryStorageJsonApiProxyRepository
Constructors
Constructor
new StorageRepository(): StorageRepository;Returns
StorageRepository
Methods
createFolder()
abstract createFolder(folderCreate): LaikaTask<{
createdAt?: string;
key: string;
type: "folder";
updatedAt?: string;
}>;Parameters
| Parameter | Type |
|---|---|
folderCreate | { key: string; type?: "folder"; } |
folderCreate.key | string |
folderCreate.type? | "folder" |
Returns
LaikaTask<{ createdAt?: string; key: string; type: "folder"; updatedAt?: string; }>
createObject()
abstract createObject(create): LaikaTask<{
content: {
[key: string]: any;
};
createdAt?: string;
key: string;
metadata?: {
extension?: string;
revisionId?: string;
};
type: "object";
updatedAt?: string;
}>;Parameters
| Parameter | Type | Description |
|---|---|---|
create | { content: { [key: string]: any; }; key: string; metadata?: { extension?: string; revisionId?: string; }; type?: "object"; } | - |
create.content | { [key: string]: any; } | - |
create.key | string | - |
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? | string | File 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? | string | Backend-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; }>
createOrUpdateObject()
abstract createOrUpdateObject(create): LaikaTask<{
content: {
[key: string]: any;
};
createdAt?: string;
key: string;
metadata?: {
extension?: string;
revisionId?: string;
};
type: "object";
updatedAt?: string;
}>;Parameters
| Parameter | Type | Description |
|---|---|---|
create | { content: { [key: string]: any; }; key: string; metadata?: { extension?: string; revisionId?: string; }; type?: "object"; } | - |
create.content | { [key: string]: any; } | - |
create.key | string | - |
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? | string | File 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? | string | Backend-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; }>
getAtom()
abstract 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
| Parameter | Type |
|---|---|
key | string |
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; }>
getCapabilities()
abstract 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; }; }>
getFolder()
abstract getFolder(key): LaikaTask<{
createdAt?: string;
key: string;
type: "folder";
updatedAt?: string;
}>;Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
LaikaTask<{ createdAt?: string; key: string; type: "folder"; updatedAt?: string; }>
getObject()
abstract getObject(key): LaikaTask<{
content: {
[key: string]: any;
};
createdAt?: string;
key: string;
metadata?: {
extension?: string;
revisionId?: string;
};
type: "object";
updatedAt?: string;
}>;Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
LaikaTask<{ content: { [key: string]: any; }; createdAt?: string; key: string; metadata?: { extension?: string; revisionId?: string; }; type: "object"; updatedAt?: string; }>
listAtoms()
abstract 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
| Parameter | Type |
|---|---|
folderKey | string |
options | ListAtomsOptions |
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>
listAtomSummaries()
abstract listAtomSummaries(folderKey, options): LaikaStream<
| {
createdAt?: string;
key: string;
type: "object-summary";
updatedAt?: string;
}
| {
createdAt?: string;
key: string;
type: "folder-summary";
updatedAt?: string;
}, LaikaDone>;Parameters
| Parameter | Type |
|---|---|
folderKey | string |
options | ListAtomsOptions |
Returns
LaikaStream< | { createdAt?: string; key: string; type: "object-summary"; updatedAt?: string; } | { createdAt?: string; key: string; type: "folder-summary"; updatedAt?: string; }, LaikaDone>
removeAtoms()
abstract removeAtoms(keys): LaikaStream<string, RemoveAtomsDone>;Parameters
| Parameter | Type |
|---|---|
keys | readonly string[] |
Returns
LaikaStream<string, RemoveAtomsDone>
subscribeChanges()
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
| Parameter | Type |
|---|---|
options | SubscribeChangesOptions |
listener | ChangeListener |
Returns
updateObject()
abstract updateObject(update): LaikaTask<{
content: {
[key: string]: any;
};
createdAt?: string;
key: string;
metadata?: {
extension?: string;
revisionId?: string;
};
type: "object";
updatedAt?: string;
}>;Parameters
| Parameter | Type | Description |
|---|---|---|
update | { content?: { [key: string]: any; }; key: string; metadata?: { extension?: string; revisionId?: string; }; type?: "object"; } | - |
update.content? | { [key: string]: any; } | - |
update.key | string | - |
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? | string | File 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? | string | Backend-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; }>