Skip to content

TypeScript API / laikacms/storage / collectAtomSummariesWithDepth

Function: collectAtomSummariesWithDepth() ​

ts
function collectAtomSummariesWithDepth(
   folderKey, 
   listFolderLevel, 
   depth
): Effect<(
  | {
  createdAt?: string;
  key: string;
  type: "object-summary";
  updatedAt?: string;
}
  | {
  createdAt?: string;
  key: string;
  type: "folder-summary";
  updatedAt?: string;
})[], LaikaError<ErrorCode, number>>;

Shared depth-traversal helper for listAtoms / listAtomSummaries.

Collects every AtomSummary reachable from folderKey up to depth levels deep by calling the backend-supplied listFolderLevel callback for each folder encountered.

  • depth = 1: direct children only (no recursion beyond the first call).
  • depth = 2: children and their immediate sub-folders, etc.

Failures from sub-folder listings are swallowed (the failing sub-tree is silently omitted) to match the behaviour of all existing per-backend implementations — a single inaccessible nested folder should not abort the entire listing.

Parameters ​

ParameterTypeDescription
folderKeystringRoot folder to start from.
listFolderLevelListFolderLevelBackend-specific flat lister (no recursion).
depthnumberMaximum traversal depth (≥ 1).

Returns ​

Effect<( | { createdAt?: string; key: string; type: "object-summary"; updatedAt?: string; } | { createdAt?: string; key: string; type: "folder-summary"; updatedAt?: string; })[], LaikaError<ErrorCode, number>>

Released under the MIT License.