Skip to content

TypeScript API / contentia/catalog-decap / DecapCatalogProvider

Class: DecapCatalogProvider ​

CatalogProvider that derives Catalog settings from a Decap CMS config file. Read-only: the Decap config is the source of truth, so put* operations fail with InvalidData instead of silently diverging.

Schemas are derived on the fly from each collection's fields. The mapping covers the common widgets (string/text/markdown/boolean/number/date/datetime/ object/list/select/image/file/relation) and falls back to "anything goes" for unknown widgets so downstream validators stay permissive.

Extends ​

Constructors ​

Constructor ​

ts
new DecapCatalogProvider(options): DecapCatalogProvider;

Parameters ​

ParameterType
optionsDecapCatalogProviderOptions

Returns ​

DecapCatalogProvider

Overrides ​

CatalogProvider.constructor

Methods ​

getCatalog() ​

ts
getCatalog(): ContentiaTask<{
  collections?: {
   [key: string]: 
     | {
     directory?: string;
     documentDescriptionKey?: string;
     documentStatusKey?: string;
     documentTitleKey?: string;
     format?: string & Brand<"StorageFormat">;
     key: string;
     name?: string;
     recursive?: boolean;
     revisionDirectory?: string;
     type: "document";
     unpublishedStatuses?: {
      [key: string]: object;
     };
   }
     | {
     accept?: readonly string[];
     directory?: string;
     key: string;
     name?: string;
     pathFormat?: string;
     recursive?: boolean;
     type: "media";
     url?: string;
   };
  };
}>;

Returns ​

ContentiaTask<{ collections?: { [key: string]: | { directory?: string; documentDescriptionKey?: string; documentStatusKey?: string; documentTitleKey?: string; format?: string & Brand<"StorageFormat">; key: string; name?: string; recursive?: boolean; revisionDirectory?: string; type: "document"; unpublishedStatuses?: { [key: string]: object; }; } | { accept?: readonly string[]; directory?: string; key: string; name?: string; pathFormat?: string; recursive?: boolean; type: "media"; url?: string; }; }; }>

Overrides ​

CatalogProvider.getCatalog


getCollectionSchema() ​

ts
getCollectionSchema(collection): ContentiaTask<JSONSchema7>;

Parameters ​

ParameterType
collectionstring

Returns ​

ContentiaTask<JSONSchema7>

Overrides ​

CatalogProvider.getCollectionSchema


getDocumentCollectionSettings() ​

ts
getDocumentCollectionSettings(collection): ContentiaTask<{
  directory?: string;
  documentDescriptionKey?: string;
  documentStatusKey?: string;
  documentTitleKey?: string;
  format?: string & Brand<"StorageFormat">;
  key: string;
  name?: string;
  recursive?: boolean;
  revisionDirectory?: string;
  type: "document";
  unpublishedStatuses?: {
   [key: string]: object;
  };
}>;

Returns settings for a document collection. If the collection is not explicitly configured, a deterministic default derived solely from the collection key is returned (stable across instances — see class-level cache-key stability invariant).

Parameters ​

ParameterType
collectionstring

Returns ​

ContentiaTask<{ directory?: string; documentDescriptionKey?: string; documentStatusKey?: string; documentTitleKey?: string; format?: string & Brand<"StorageFormat">; key: string; name?: string; recursive?: boolean; revisionDirectory?: string; type: "document"; unpublishedStatuses?: { [key: string]: object; }; }>

Overrides ​

CatalogProvider.getDocumentCollectionSettings


getMediaCollectionSettings() ​

ts
getMediaCollectionSettings(collection): ContentiaTask<{
  accept?: readonly string[];
  directory?: string;
  key: string;
  name?: string;
  pathFormat?: string;
  recursive?: boolean;
  type: "media";
  url?: string;
}>;

Returns settings for a media collection. If the collection is not explicitly configured, a deterministic default derived solely from the collection key is returned (stable across instances — see class-level cache-key stability invariant).

Parameters ​

ParameterType
collectionstring

Returns ​

ContentiaTask<{ accept?: readonly string[]; directory?: string; key: string; name?: string; pathFormat?: string; recursive?: boolean; type: "media"; url?: string; }>

Overrides ​

CatalogProvider.getMediaCollectionSettings


putCatalog() ​

ts
putCatalog(_settings): ContentiaTask<void>;

Parameters ​

ParameterType
_settings{ collections?: { [key: string]: | { directory?: string; documentDescriptionKey?: string; documentStatusKey?: string; documentTitleKey?: string; format?: string & Brand<"StorageFormat">; key: string; name?: string; recursive?: boolean; revisionDirectory?: string; type: "document"; unpublishedStatuses?: { [key: string]: object; }; } | { accept?: readonly string[]; directory?: string; key: string; name?: string; pathFormat?: string; recursive?: boolean; type: "media"; url?: string; }; }; }
_settings.collections?{ [key: string]: | { directory?: string; documentDescriptionKey?: string; documentStatusKey?: string; documentTitleKey?: string; format?: string & Brand<"StorageFormat">; key: string; name?: string; recursive?: boolean; revisionDirectory?: string; type: "document"; unpublishedStatuses?: { [key: string]: object; }; } | { accept?: readonly string[]; directory?: string; key: string; name?: string; pathFormat?: string; recursive?: boolean; type: "media"; url?: string; }; }

Returns ​

ContentiaTask<void>

Overrides ​

CatalogProvider.putCatalog


putCollectionSchema() ​

ts
putCollectionSchema(_collection, _schema): ContentiaTask<void>;

Parameters ​

ParameterType
_collectionstring
_schemaJSONSchema7

Returns ​

ContentiaTask<void>

Overrides ​

CatalogProvider.putCollectionSchema


putDocumentCollectionSettings() ​

ts
putDocumentCollectionSettings(_collection, _settings): ContentiaTask<void>;

Parameters ​

ParameterTypeDescription
_collectionstring-
_settings{ directory?: string; documentDescriptionKey?: string; documentStatusKey?: string; documentTitleKey?: string; format?: string & Brand<"StorageFormat">; key: string; name?: string; recursive?: boolean; revisionDirectory?: string; type: "document"; unpublishedStatuses?: { [key: string]: object; }; }-
_settings.directory?string-
_settings.documentDescriptionKey?string-
_settings.documentStatusKey?string-
_settings.documentTitleKey?string-
_settings.format?string & Brand<"StorageFormat">-
_settings.key?string-
_settings.name?string-
_settings.recursive?boolean-
_settings.revisionDirectory?stringDirectory for storing revisions (version history)
_settings.type?"document"-
_settings.unpublishedStatuses?{ [key: string]: object; }Map of unpublished status values to their configuration The key is the status value stored in the 'unpublished' document type's 'status' field Documents with these statuses are stored in .contentia/[collection]/[status.directory]

Returns ​

ContentiaTask<void>

Overrides ​

CatalogProvider.putDocumentCollectionSettings


putMediaCollectionSettings() ​

ts
putMediaCollectionSettings(_collection, _settings): ContentiaTask<void>;

Parameters ​

ParameterTypeDescription
_collectionstring-
_settings{ accept?: readonly string[]; directory?: string; key: string; name?: string; pathFormat?: string; recursive?: boolean; type: "media"; url?: string; }-
_settings.accept?readonly string[]The files the collection accepts, written as in the HTML accept attribute: MIME types (image/png), wildcards (image/*), or file extensions (.png), matched against an asset's filename and key. Empty or left out accepts any file.
_settings.directory?string-
_settings.key?string-
_settings.name?string-
_settings.pathFormat?string-
_settings.recursive?boolean-
_settings.type?"media"-
_settings.url?string-

Returns ​

ContentiaTask<void>

Overrides ​

CatalogProvider.putMediaCollectionSettings