New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cloudcannon/configuration-types

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudcannon/configuration-types - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

build/cloudcannon-config-default.json

25

package.json
{
"name": "@cloudcannon/configuration-types",
"version": "0.0.3",
"description": "Contains types and generates JSON Schemas for the CloudCannon configuration file.",
"version": "0.0.4",
"description": "Contains TypeScript declarations and generates JSONSchema files for the CloudCannon configuration file.",
"author": "CloudCannon <support@cloudcannon.com>",

@@ -21,6 +21,7 @@ "license": "MIT",

"scripts": {
"build:default": "ts-json-schema-generator --path src/index.ts --type Configuration > build/cloudcannon-config.json",
"build:eleventy": "ts-json-schema-generator --path src/index.ts --type EleventyConfiguration > build/cloudcannon-config-eleventy.json",
"build:jekyll": "ts-json-schema-generator --path src/index.ts --type JekyllConfiguration > build/cloudcannon-config-jekyll.json",
"build:hugo": "ts-json-schema-generator --path src/index.ts --type HugoConfiguration > build/cloudcannon-config-hugo.json",
"build:unknown": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type Configuration --out build/cloudcannon-config.json",
"build:default": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type DefaultConfiguration --out build/cloudcannon-config-default.json",
"build:eleventy": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type EleventyConfiguration --out build/cloudcannon-config-eleventy.json",
"build:jekyll": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type JekyllConfiguration --out build/cloudcannon-config-jekyll.json",
"build:hugo": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type HugoConfiguration --out build/cloudcannon-config-hugo.json",
"build": "run-p build:*",

@@ -36,12 +37,16 @@ "prebuild": "mkdir -p build && rimraf --glob 'build/*.json'",

"files": [
"src/**/*"
"src/**/*",
"build/**/*"
],
"dependencies": {
"ts-json-schema-generator": "^1.3.0"
"@cloudcannon/snippet-types": "^1.1.11",
"ts-json-schema-generator": "^2.2.0"
},
"devDependencies": {
"@types/node": "^20.13.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"rimraf": "^5.0.5"
"prettier": "^3.2.5",
"prettier-plugin-jsdoc": "^1.3.0",
"rimraf": "^5.0.7"
}
}

96

README.md
# Configuration types
Contains types and generates JSON Schemas for the [CloudCannon](https://cloudcannon.com/) configuration file.
Contains TypeScript declarations and generates JSONSchema files for the [CloudCannon](https://cloudcannon.com/) configuration file.
[<img src="https://img.shields.io/npm/v/@cloudcannon%2Fconfiguration-types?logo=npm" alt="version badge">](https://www.npmjs.com/package/@cloudcannon%2Fconfiguration-types)
## Run
---
- [Installation](#installation)
- [Usage](#usage)
- [YAML and JSON](#yaml-and-json)
- [JavaScript](#javascript)
- [Development](#development)
- [License](#license)
---
## Installation
```sh
npm i -D @cloudcannon/configuration-types
```
## Usage
The primary use of this package is to validate your configuration file. You can also use it to autocomplete and read inline documention while editing. Here are some suggested workflows below.
### YAML and JSON
We plan to add the configuration schema to [JSON Schema Store](https://www.schemastore.org/json/), which would automatically enable in-editor validation, autocomplete and tooltips with the YAML or JSON LSP enabled.
Alternatively, you can add a comment to the top of your file to use a specific schema for YAML files:
```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/CloudCannon/configuration-types/main/build/cloudcannon-config.json
collections_config:
posts:
name: Blog
icon: event
```
Or the top-level `$schema` entry for JSON files:
```json
{
"$schema": "https://raw.githubusercontent.com/CloudCannon/configuration-types/main/build/cloudcannon-config.json",
"collections_config": {
"posts": {
"name": "Blog",
"icon": "event"
}
}
}
```
You could also/alternatively validate the file on the command line with something like [ajv-cli](https://github.com/ajv-validator/ajv-cli):
```sh
npm i @cloudcannon/configuration-types ajv-cli
npm run ajv validate -s node_modules/@cloudcannon/configuration-types/cloudcannon-config.json -d cloudcannon.config.yml
```
### JavaScript
For a CommonJS formatted configuration file (e.g. `/cloudcannon.config.cjs`), you can use a JSDoc comment to indicate the type of the module export:
```javascript
/** @type {import("@cloudcannon/configuration-types").DefaultConfiguration} */
const config = {
collections_config: {
posts: {
name: 'Blog',
icon: 'event',
},
},
};
module.exports = config;
```
Then use the TypeScript LSP in your supported editor, ensuring it is set up to check JavaScript files. This would provide in-editor validation, autocomplete and tooltips as you modify the file.
You could also/alternatively run `tsc` over your file to validate there are no issues outside of your editor:
```sh
npx tsc test/cloudcannon.config.js --allowJs --checkJs --noEmit
```
***
## Development
Install dependencies:

@@ -15,3 +101,3 @@

Build JSON schema files:
Build JSONSchema files:

@@ -22,8 +108,4 @@ ```sh

## Test
Not yet set up.
## License
MIT

@@ -0,1 +1,3 @@

import Scrapbooker from '@cloudcannon/snippet-types';
import type { Icon } from './icon';

@@ -8,16 +10,124 @@ import type { Timezone } from './timezone';

export type { Icon, Timezone, MimeType, Theme, Syntax };
export type InstanceValue = 'UUID' | 'NOW';
export type EditorKey = 'visual' | 'content' | 'data';
export type SortOrder = 'ascending' | 'descending' | 'asc' | 'desc';
// TODO: use SnippetConfig from @cloudcannon/scrap-booker when ParserConfig issue resolved.
interface SnippetConfig extends ReducedCascade, Previewable, PickerPreviewable {
/**
* Name of the snippet.
*/
snippet?: string;
/**
* The template that this snippet should inherit, out of the available Shortcode Templates.
*/
template?: string;
/**
* Whether this snippet can appear inline (within a sentence). Defaults to false, which will treat
* this snippet as a block-level element in the content editor.
*/
inline?: boolean;
/**
* Whether this snippet treats whitespace as-is or not.
*/
strict_whitespace?: boolean;
/**
* The variables required for the selected template.
*/
definitions?: Record<string, any>;
/**
* Alternate configurations for this snippet.
*/
alternate_formats?: SnippetConfig[];
/**
* The parameters of this snippet.
*/
params?: Record<string, any>; // TODO: use ParserConfig from @cloudcannon/scrap-booker.
}
type SnippetImportKey = keyof typeof Scrapbooker.defaults;
interface SnippetsImport<T> {
/**
* The list of excluded snippets. If unset, all snippets are excluded unless defined in `include`.
*/
exclude?: Array<T>;
/**
* The list of included snippets. If unset, all snippets are included unless defined in `exclude`.
*/
include?: Array<T>;
}
export interface SnippetsImports {
/**
* Default snippets for Hugo SSG.
*/
hugo?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.hugo.snippets>;
/**
* Default snippets for Jekyll SSG.
*/
jekyll?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.jekyll.snippets>;
/**
* Default snippets for MDX-based content.
*/
mdx?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.mdx.snippets>;
/**
* Default snippets for Eleventy SSG Liquid files.
*/
eleventy_liquid?:
| boolean
| SnippetsImport<keyof typeof Scrapbooker.defaults.eleventy_liquid.snippets>;
/**
* Default snippets for Eleventy SSG Nunjucks files.
*/
eleventy_nunjucks?:
| boolean
| SnippetsImport<keyof typeof Scrapbooker.defaults.eleventy_nunjucks.snippets>;
/**
* Default snippets for Markdoc-based content.
*/
markdoc?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.markdoc.snippets>;
/**
* Default snippets for content using Python markdown extensions.
*/
python_markdown_extensions?:
| boolean
| SnippetsImport<keyof typeof Scrapbooker.defaults.python_markdown_extensions.snippets>;
/**
* Default snippets for Docusaurus SSG.
*/
docusaurus_mdx?:
| boolean
| SnippetsImport<keyof typeof Scrapbooker.defaults.docusaurus_mdx.snippets>;
}
interface WithSnippets {
/**
* Configuration for custom snippets.
*/
_snippets?: Record<string, SnippetConfig>;
/**
* Provides control over which snippets are available to use and/or extend within `_snippets`.
*/
_snippets_imports?: SnippetsImports;
/**
* Extended option used when creating more complex custom snippets.
*/
_snippets_templates?: Record<string, SnippetConfig>;
/**
* Extended option used when creating more complex custom snippets.
*/
_snippets_definitions?: Record<string, SnippetConfig>;
}
interface ImageResizeable {
/**
* Sets the format images are converted to prior to upload. The extension of the file is updated to match. Defaults to keeping the mime type of the uploaded file.
* Sets the format images are converted to prior to upload. The extension of the file is updated
* to match. Defaults to keeping the mime type of the uploaded file.
*/
mime_type?: 'image/jpeg' | 'image/png';
/**
* Controls whether or not the JPEG headers defining how an image should be rotated before being displayed is baked into images prior to upload.
* Controls whether or not the JPEG headers defining how an image should be rotated before being
* displayed is baked into images prior to upload.
*
* @default true

@@ -27,16 +137,22 @@ */

/**
* Sets how uploaded image files are resized with a bounding box defined by width and height prior to upload. Has no effect when selecting existing images, or if width and height are unset.
* Sets how uploaded image files are resized with a bounding box defined by width and height prior
* to upload. Has no effect when selecting existing images, or if width and height are unset.
*
* @default 'contain'
*/
resize_style?: 'cover' | 'contain' | 'stretch';
resize_style?: 'cover' | 'contain' | 'stretch' | 'crop';
/**
* Defines the width of the bounding box used in the image resizing process defined with resize_style.
* Defines the width of the bounding box used in the image resizing process defined with
* resize_style.
*/
width?: number;
/**
* Defines the height of the bounding box used in the image resizing process defined with resize_style.
* Defines the height of the bounding box used in the image resizing process defined with
* resize_style.
*/
height?: number;
/**
* Controls whether or not images can be upscaled to fit the bounding box during resize prior to upload. Has no effect if files are not resized.
* Controls whether or not images can be upscaled to fit the bounding box during resize prior to
* upload. Has no effect if files are not resized.
*
* @default false

@@ -46,6 +162,35 @@ */

/**
* Instructs the editor to save `width` and `height` attributes on the image elements. This can prevent pop-in as a page loads.
* Instructs the editor to save `width` and `height` attributes on the image elements. This can
* prevent pop-in as a page loads.
*
* @default true
*/
image_size_attributes?: boolean;
/**
* If you have one or more DAMs connected to your site, you can use this key to list which asset
* sources can be uploaded to and selected from.
*/
allowed_sources?: string[];
/**
* Enable to skip the image resizing process configured for this input when selecting existing
* images.
*
* @default false
*/
prevent_resize_existing_files?: boolean;
/**
* Definitions for creating additional images of different sizes when uploading or selecting
* existing files.
*/
sizes?: {
/**
* A number suffixed with "x" (relative size) or "w" (fixed width) for setting the dimensions of
* the image (e.g. 2x, 3x, 100w, 360w).
*/
size: 'string';
/**
* A reference to another input that is given the path to this additional image file.
*/
target?: 'string';
};
}

@@ -82,19 +227,26 @@

/**
* Enables a control to insert an unordered list, or to convert selected blocks of text into a unordered list.
* Enables a control to insert an unordered list, or to convert selected blocks of text into a
* unordered list.
*/
bulletedlist?: boolean;
/**
* Enables a control to center align text by toggling a class name for a block of text. The value is the class name the editor should add to align the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
* Enables a control to center align text by toggling a class name for a block of text. The value
* is the class name the editor should add to align the text. The styles for this class need to be
* listed in the `styles` file to take effect outside of the input.
*/
center?: string;
/**
* Enables a control to set selected text to inline code, and unselected blocks of text to code blocks.
* Enables a control to set selected text to inline code, and unselected blocks of text to code
* blocks.
*/
code?: boolean;
/**
* Enables a control to insert a region of raw HTML, including YouTube, Vimeo, Tweets, and other media. Embedded content is sanitized to mitigate XSS risks, which includes removing style tags. Embeds containing script tags are not loaded in the editor.
* Enables a control to insert a region of raw HTML, including YouTube, Vimeo, Tweets, and other
* media. Embedded content is sanitized to mitigate XSS risks, which includes removing style tags.
* Embeds containing script tags are not loaded in the editor.
*/
embed?: boolean;
/**
* Enables a drop down menu for structured text. Has options for "p", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "address", and "div". Set as space separated options (e.g. "p h1 h2").
* Enables a drop down menu for structured text. Has options for "p", "h1", "h2", "h3", "h4",
* "h5", "h6". Set as space separated options (e.g. "p h1 h2").
*/

@@ -115,11 +267,16 @@ format?: string;

/**
* Enables a control to justify text by toggling a class name for a block of text. The value is the class name the editor should add to justify the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
* Enables a control to justify text by toggling a class name for a block of text. The value is
* the class name the editor should add to justify the text. The styles for this class need to be
* listed in the `styles` file to take effect outside of the input.
*/
justify?: string;
/**
* Enables a control to left align text by toggling a class name for a block of text. The value is the class name the editor should add to align the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
* Enables a control to left align text by toggling a class name for a block of text. The value is
* the class name the editor should add to align the text. The styles for this class need to be
* listed in the `styles` file to take effect outside of the input.
*/
left?: string;
/**
* Enables a control to insert a numbered list, or to convert selected blocks of text into a numbered list.
* Enables a control to insert a numbered list, or to convert selected blocks of text into a
* numbered list.
*/

@@ -132,3 +289,5 @@ numberedlist?: boolean;

/**
* Enables a control to right align text by toggling a class name for a block of text. The value is the class name the editor should add to align the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
* Enables a control to right align text by toggling a class name for a block of text. The value
* is the class name the editor should add to align the text. The styles for this class need to be
* listed in the `styles` file to take effect outside of the input.
*/

@@ -141,7 +300,10 @@ right?: string;

/**
* Enables a drop down menu for editors to style selected text or blocks or text. Styles are the combination of an element and class name. The value for this option is the path (either source or build output) to the CSS file containing the styles.
* Enables a drop down menu for editors to style selected text or blocks or text. Styles are the
* combination of an element and class name. The value for this option is the path (either source
* or build output) to the CSS file containing the styles.
*/
styles?: string;
/**
* Enables a control to insert a table. Further options for table cells are available in the context menu for cells within the editor.
* Enables a control to insert a table. Further options for table cells are available in the
* context menu for cells within the editor.
*/

@@ -153,3 +315,5 @@ table?: boolean;

/**
* Paths to where new asset files are uploaded to. They also set the default path when choosing existing images, and linking to existing files. Each path is relative to global `source`. Defaults to the global `paths`.
* Paths to where new asset files are uploaded to. They also set the default path when choosing
* existing images, and linking to existing files. Each path is relative to global `source`.
* Defaults to the global `paths`.
*/

@@ -169,3 +333,5 @@ paths?: ReducedPaths;

/**
* Enables a control to copy formatting from text to other text. Only applies to formatting from `bold`, `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not copy other styles or formatting.
* Enables a control to copy formatting from text to other text. Only applies to formatting from
* `bold`, `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not copy other
* styles or formatting.
*/

@@ -182,7 +348,10 @@ copyformatting?: boolean;

/**
* Enables a control to redo recent edits undone with undo. Redo is always enabled through standard OS-specific keyboard shortcuts.
* Enables a control to redo recent edits undone with undo. Redo is always enabled through
* standard OS-specific keyboard shortcuts.
*/
redo?: boolean;
/**
* Enables the control to remove formatting from text. Applies to formatting from `bold`, `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not remove other styles or formatting.
* Enables the control to remove formatting from text. Applies to formatting from `bold`,
* `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not remove other styles
* or formatting.
*/

@@ -207,5 +376,17 @@ removeformat?: boolean;

/**
* Enables a control to undo recent edits. Undo is always enabled through standard OS-specific keyboard shortcuts.
* Enables a control to undo recent edits. Undo is always enabled through standard OS-specific
* keyboard shortcuts.
*/
undo?: boolean;
/**
* Defines if the content should be stripped of "custom markup". It is recommended to have this
* option turned on once you have all of your rich text options configured. Having
* `allow_custom_markup` turned on disables this option. Defaults to false.
*/
remove_custom_markup?: boolean;
/**
* Defines if the content can contain "custom markup". It is not recommended to have this option
* turned on. Defaults to true for non-content editable regions, false otherwise.
*/
allow_custom_markup?: boolean;
}

@@ -219,7 +400,9 @@

/**
* Fixed datasets that can be referenced by the *Values* configuration for *Select* and *Multiselect* inputs.
* Fixed datasets that can be referenced by the _Values_ configuration for _Select_ and
* _Multiselect_ inputs.
*/
_select_data?: Record<string, SelectValues>;
/**
* Structured values for editors adding new items to arrays and objects. Entries here can be referenced in the configuration for `array` or `object` inputs.
* Structured values for editors adding new items to arrays and objects. Entries here can be
* referenced in the configuration for `array` or `object` inputs.
*/

@@ -231,3 +414,4 @@ _structures?: Record<string, Structure>;

/**
* Set a preferred editor and/or disable the others. The first value sets which editor opens by default, and the following values specify which editors are accessible.
* Set a preferred editor and/or disable the others. The first value sets which editor opens by
* default, and the following values specify which editors are accessible.
*/

@@ -239,6 +423,14 @@ _enabled_editors?: Array<EditorKey>;

_editables?: Editables;
_array_structures?: Record<string, unknown>; // Legacy
_comments?: Record<string, string>; // Legacy
_options?: Record<string, Record<string, unknown>>; // Legacy
/**
* [DEPRECATED] Now known as _structures.
*/
_array_structures?: Record<string, unknown>;
/**
* [DEPRECATED] Now part of _inputs.*.comment.
*/
_comments?: Record<string, string>;
/**
* [DEPRECATED] Now part of _inputs.*.options.
*/
_options?: Record<string, Record<string, unknown>>;
}

@@ -296,6 +488,32 @@

/**
* Changes the subtext below the *Label*. Has no default. Supports a limited set of Markdown: links, bold, italic, subscript, superscript, and inline code elements are allowed.
* Changes the subtext below the _Label_. Has no default. Supports a limited set of Markdown:
* links, bold, italic, subscript, superscript, and inline code elements are allowed.
*/
comment?: string;
/**
* Adds an expandable section of rich text below the input.
*/
context?: {
/**
* The rich text content shown when opened. Supports a limited set of Markdown.
*/
content?: string;
/**
* Makes the content visible initially.
*/
open?: boolean;
/**
* The text shown when not open. Defaults to "Context" if unset.
*/
title?: string;
/**
* The icon shown when not open.
*/
icon?: Icon;
};
/**
* Provides a custom link for documentation for editors shown above input.
*/
documentation?: Documentation;
/**
* Optionally changes the text above this input.

@@ -306,2 +524,3 @@ */

* Toggles the visibility of this input.
*
* @default false

@@ -311,7 +530,10 @@ */

/**
* Controls if and how the value of this input is instantiated when created. This occurs when creating files, or adding array items containing the configured input.
* Controls if and how the value of this input is instantiated when created. This occurs when
* creating files, or adding array items containing the configured input.
*/
instance_value?: InstanceValue;
/**
* Specifies whether or not this input configuration should be merged with any matching, less specific configuration.
* Specifies whether or not this input configuration should be merged with any matching, less
* specific configuration.
*
* @default true

@@ -336,3 +558,2 @@ */

| 'text'
| 'textarea'
| 'email'

@@ -347,5 +568,18 @@ | 'disabled'

export interface TextareaInputOptions extends TextInputOptions {
/**
* Shows a character counter below the input if enabled.
*/
show_count?: boolean;
}
export interface TextareaInput extends BaseInput<TextareaInputOptions> {
type: 'textarea';
}
export interface CodeInputOptions extends BaseInputOptions, SourceEditor {
/**
* Sets the maximum number of visible lines for this input, effectively controlling maximum height. When the containing text exceeds this number, the input becomes a scroll area.
* Sets the maximum number of visible lines for this input, effectively controlling maximum
* height. When the containing text exceeds this number, the input becomes a scroll area.
*
* @default 30

@@ -355,3 +589,6 @@ */

/**
* Sets the minimum number of visible lines for this input, effectively controlling initial height. When the containing text exceeds this number, the input grows line by line to the lines defined by `max_visible_lines`.
* Sets the minimum number of visible lines for this input, effectively controlling initial
* height. When the containing text exceeds this number, the input grows line by line to the lines
* defined by `max_visible_lines`.
*
* @default 10

@@ -361,3 +598,4 @@ */

/**
* Changes how the editor parses your content for syntax highlighting. Should be set to the language of the code going into the input.
* Changes how the editor parses your content for syntax highlighting. Should be set to the
* language of the code going into the input.
*/

@@ -373,7 +611,9 @@ syntax?: Syntax;

/**
* Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that is unset.
* Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that
* is unset.
*/
format?: 'rgb' | 'hex' | 'hsl' | 'hsv';
/**
* Toggles showing a control for adjusting the transparency of the selected color. Defaults to using the naming convention, enabled if the input key ends with "a".
* Toggles showing a control for adjusting the transparency of the selected color. Defaults to
* using the naming convention, enabled if the input key ends with "a".
*/

@@ -397,3 +637,4 @@ alpha?: boolean;

/**
* A number that specifies the granularity that the value must adhere to, or the special value any, which allows any decimal value between `max` and `min`.
* A number that specifies the granularity that the value must adhere to, or the special value
* any, which allows any decimal value between `max` and `min`.
*/

@@ -429,6 +670,2 @@ step?: number;

/**
* If you have one or more DAMs connected to your site, you can use this key to list which asset sources can be uploaded to and selected from.
*/
allowed_sources?: string[];
/**
* Defines the initial height of this input in pixels (px).

@@ -445,3 +682,4 @@ */

/**
* Specifies the time zone that dates are displayed and edited in. Also changes the suffix the date is persisted to the file with. Defaults to the global `timezone`.
* Specifies the time zone that dates are displayed and edited in. Also changes the suffix the
* date is persisted to the file with. Defaults to the global `timezone`.
*/

@@ -475,2 +713,3 @@ timezone?: Timezone;

* Allows new text values to be created at edit time.
*
* @default false

@@ -481,2 +720,3 @@ */

* Provides an empty option alongside the options provided by values.
*
* @default true

@@ -486,9 +726,13 @@ */

/**
* Defines the values available to choose from. Optional, defaults to fetching values from the naming convention (e.g. colors or my_colors for data set colors).
* Defines the values available to choose from. Optional, defaults to fetching values from the
* naming convention (e.g. colors or my_colors for data set colors).
*/
values: SelectValues;
values?: SelectValues;
/**
* Defines the key used for mapping between saved values and objects in values. This changes how the input saves selected values to match. Defaults to checking for "id", "uuid", "path", "title", then "name". Has no effect unless values is an array of objects, the key is used instead for objects, and the value itself is used for primitive types.
* Defines the key used for mapping between saved values and objects in values. This changes how
* the input saves selected values to match. Defaults to checking for "id", "uuid", "path",
* "title", then "name". Has no effect unless values is an array of objects, the key is used
* instead for objects, and the value itself is used for primitive types.
*/
value_key: string;
value_key?: string;
}

@@ -511,3 +755,3 @@

*/
preview: SelectPreview;
preview?: SelectPreview;
}

@@ -535,3 +779,5 @@

/**
* Defines a limited set of keys that can exist on the data within an object input. This set is used when entries are added and renamed with `allow_create` enabled. Has no effect if `allow_create` is not enabled.
* Defines a limited set of keys that can exist on the data within an object input. This set is
* used when entries are added and renamed with `allow_create` enabled. Has no effect if
* `allow_create` is not enabled.
*/

@@ -544,3 +790,6 @@ allowed_keys?: string[];

/**
* Provides data formats when adding entries to the data within this object input. When adding an entry, team members are prompted to choose from a number of values you have defined. Has no effect if `allow_create` is false. `entries.structures` applies to the entries within the object.
* Provides data formats when adding entries to the data within this object input. When adding
* an entry, team members are prompted to choose from a number of values you have defined. Has
* no effect if `allow_create` is false. `entries.structures` applies to the entries within the
* object.
*/

@@ -550,7 +799,11 @@ structures?: string | Structure;

/**
* The preview definition for changing the way data within an object input is previewed before being expanded. If the input has `structures`, the preview from the structure value is used instead.
* The preview definition for changing the way data within an object input is previewed before
* being expanded. If the input has `structures`, the preview from the structure value is used
* instead.
*/
preview?: ObjectPreview;
/**
* Provides data formats for value of this object. When choosing an item, team members are prompted to choose from a number of values you have defined. `structures` applies to the object itself.
* Provides data formats for value of this object. When choosing an item, team members are
* prompted to choose from a number of values you have defined. `structures` applies to the object
* itself.
*/

@@ -566,7 +819,10 @@ structures?: string | Structure;

/**
* The preview definition for changing the way data within an array input's items are previewed before being expanded. If the input has structures, the preview from the structure value is used instead.
* The preview definition for changing the way data within an array input's items are previewed
* before being expanded. If the input has structures, the preview from the structure value is
* used instead.
*/
preview?: ObjectPreview;
/**
* Provides data formats for value of this object. When choosing an item, team members are prompted to choose from a number of values you have defined.
* Provides data formats for value of this object. When choosing an item, team members are
* prompted to choose from a number of values you have defined.
*/

@@ -601,3 +857,9 @@ structures?: string | Structure;

/**
* Location of assets that are statically copied to the output site. This prefix will be removed
* from the _Uploads_ path when CloudCannon outputs the URL of an asset.
*/
static?: string;
/**
* Default location of newly uploaded site files.
*
* @default 'uploads'

@@ -612,2 +874,3 @@ */

* Default location of newly uploaded DAM files.
*
* @default ''

@@ -621,3 +884,5 @@ */

/**
* Location of statically copied assets for DAM files. This prefix will be removed from the *DAM Uploads* path when CloudCannon outputs the URL of an asset.
* Location of statically copied assets for DAM files. This prefix will be removed from the _DAM
* Uploads_ path when CloudCannon outputs the URL of an asset.
*
* @default ''

@@ -630,7 +895,4 @@ */

/**
* Location of assets that are statically copied to the output site. This prefix will be removed from the *Uploads* path when CloudCannon outputs the URL of an asset.
*/
static?: string;
/**
* Parent folder of all collections.
*
* @default ''

@@ -644,7 +906,8 @@ */

/**
* Parent folder of all site layout files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
* Parent folder of all site layout files. _Only applies to Jekyll, Hugo, and Eleventy sites_.
*/
layouts?: string;
/**
* Parent folder of all includes, partials, or shortcode files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
* Parent folder of all includes, partials, or shortcode files. _Only applies to Jekyll, Hugo, and
* Eleventy sites_.
*/

@@ -658,11 +921,14 @@ includes?: string;

/**
* Defines the initial set of visible files in the collection file list. Defaults to "all", or "strict" for the auto-discovered `pages` collection in Jekyll, Hugo, and Eleventy.
* Defines the initial set of visible files in the collection file list. Defaults to "all", or
* "strict" for the auto-discovered `pages` collection in Jekyll, Hugo, and Eleventy.
*/
base?: FilterBase;
/**
* Add to the visible files set with `base`. Paths must be relative to the containing collection `path`.
* Add to the visible files set with `base`. Paths must be relative to the containing collection
* `path`.
*/
include?: string[];
/**
* Remove from the visible files set with `base`. Paths must be relative to the containing collection `path`.
* Remove from the visible files set with `base`. Paths must be relative to the containing
* collection `path`.
*/

@@ -778,25 +1044,39 @@ exclude?: string[];

/**
* The icon next to the text in the menu item. Defaults to using icon from the matching schema if set, then falls back to add.
* The icon next to the text in the menu item. Defaults to using icon from the matching schema if
* set, then falls back to add.
*/
icon?: Icon;
/**
* The editor to open the new file in. Defaults to an appropriate editor for new file's type if possible. If no default editor can be calculated, or the editor does not support the new file type, a warning is shown in place of the editor.
* The editor to open the new file in. Defaults to an appropriate editor for new file's type if
* possible. If no default editor can be calculated, or the editor does not support the new file
* type, a warning is shown in place of the editor.
*/
editor?: EditorKey;
/**
* Enforces a path for new files to be created in, regardless of path the user is currently navigated to within the collection file list. Relative to the path of the collection defined in collection. Defaults to the path within the collection the user is currently navigated to.
* Enforces a path for new files to be created in, regardless of path the user is currently
* navigated to within the collection file list. Relative to the path of the collection defined in
* collection. Defaults to the path within the collection the user is currently navigated to.
*/
base_path?: string;
/**
* Sets which collection this action is creating a file in. This is used when matching the value for schema. Defaults to the containing collection these `add_options` are configured in.
* Sets which collection this action is creating a file in. This is used when matching the value
* for schema. Defaults to the containing collection these `add_options` are configured in.
*/
collection?: string;
/**
* The schema that new files are created from with this action. This schema is not restricted to the containing collection, and is instead relative to the collection specified with collection. Defaults to default if schemas are configured for the collection.
* The schema that new files are created from with this action. This schema is not restricted to
* the containing collection, and is instead relative to the collection specified with collection.
* Defaults to default if schemas are configured for the collection.
*/
schema?: string;
/**
* The path to a file used to populate the initial contents of a new file if no schemas are configured. We recommend using schemas, and this is ignored if a schema is available.
* The path to a file used to populate the initial contents of a new file if no schemas are
* configured. We recommend using schemas, and this is ignored if a schema is available.
*/
default_content_file?: string;
/**
* The link that opens when the option is clicked. Can either be an external or internal link. If
* internal, the link is relative to the current site.
*/
href?: string;
}

@@ -811,2 +1091,9 @@

interface PickerPreviewable {
/**
* Changes the way items are previewed in the CMS while being chosen.
*/
picker_preview?: Preview;
}
export interface Schema extends Cascade, Previewable, Schemalike {

@@ -822,4 +1109,6 @@ /**

/**
* Displayed in the add menu when creating new files; also used as the icon for collection files if no other preview is found.
* @default "notes"
* Displayed in the add menu when creating new files; also used as the icon for collection files
* if no other preview is found.
*
* @default 'notes'
*/

@@ -832,3 +1121,5 @@ icon?: Icon;

/**
* Preview your unbuilt pages (e.g. drafts) to another page's output URL. The Visual Editor will load that URL, where Data Bindings and Previews are available to render your new page without saving.
* Preview your unbuilt pages (e.g. drafts) to another page's output URL. The Visual Editor will
* load that URL, where Data Bindings and Previews are available to render your new page without
* saving.
*/

@@ -839,3 +1130,11 @@ new_preview_url?: string;

export interface Sort {
/**
* Defines what field contains the value to sort on inside each collection item's data.
*/
key: string;
/**
* Controls which sort values come first.
*
* @default ascending
*/
order?: SortOrder;

@@ -845,2 +1144,5 @@ }

export interface SortOption extends Sort {
/**
* The text to display in the sort option list. Defaults to a generated label from key and order.
*/
label?: string;

@@ -850,4 +1152,17 @@ }

export interface Create extends ReducedCascade {
/**
* The raw template to be processed when creating files. Relative to the containing collection's
* path.
*/
path: string;
/**
* Adds to the available data placeholders coming from the file. Entry values follow the same
* format as path, and are processed sequentially before path. These values are not saved back to
* your file.
*/
extra_data?: Record<string, string>;
/**
* Defines a target collection when publishing. When a file is published (currently only relevant
* to Jekyll), the target collection's create definition is used instead.
*/
publish_to?: string;

@@ -857,24 +1172,118 @@ }

export interface CollectionConfig extends Cascade, Previewable {
/**
* The top-most folder where the files in this collection are stored. It is relative to source.
* Each collection must have a unique path.
*/
path?: string;
/**
* Whether or not files in this collection produce files in the build output.
*/
output?: boolean;
/**
* Overrides how each file in the collection is read. Detected automatically from file extension
* if unset.
*/
parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml';
/**
* Used to build the url field for items in the collection. Similar to permalink in many SSGs.
* Defaults to ''
*/
url?: string;
/**
* Controls which files are displayed in the collection list. Does not change which files are
* assigned to this collection.
*/
filter?: Filter | FilterBase;
/**
* The display name of this collection. Used in headings and in the context menu for items in the
* collection. This is optional as CloudCannon auto-generates this from the collection key.
*/
name?: string;
/**
* Text or Markdown to show above the collection file list.
*/
description?: string;
/**
* Sets an icon to use alongside references to this collection.
*/
icon?: Icon;
/**
* Provides a custom link for documentation for editors shown above the collection file list.
*/
documentation?: Documentation;
/**
* Sets the default sorting for the collection file list. Defaults to the first option in
* sort_options, then falls back descending path. As an exception, defaults to descending date for
* blog-like collections.
*/
sort?: Sort;
/**
* Controls the available options in the sort menu. Defaults to generating the options from the
* first item in the collection, falling back to ascending path and descending path.
*/
sort_options?: SortOption[];
/**
* Overrides the default singular display name of the collection. This is displayed in the
* collection add menu and file context menu.
*/
singular_name?: string;
/**
* Overrides the default singular input key of the collection. This is used for naming conventions
* for select and multiselect inputs.
*/
singular_key?: string;
/**
* Changes the options presented in the add menu in the collection file list. Defaults to an automatically generated list from *Schemas*, or uses the first file in the collection if no schemas are configured.
* Changes the options presented in the add menu in the collection file list. Defaults to an
* automatically generated list from _Schemas_, or uses the first file in the collection if no
* schemas are configured.
*/
add_options?: AddOption[];
/**
* The create path definition to control where new files are saved to inside this collection.
* Defaults to [relative_base_path]/{title|slugify}.md.
*/
create?: Create;
/**
* Prevents users from adding new files in the collection file list if true.
*
* Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
* (data sub-folders act as non-output collections). Otherwise, defaults to false.
*/
disable_add?: boolean;
/**
* Prevents users from adding new folders in the collection file list if true.
*
* Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
* (data sub-folders act as non-output collections). Otherwise, defaults to false.
*/
disable_add_folder?: boolean;
/**
* Prevents users from renaming, moving and deleting files in the collection file list if true.
*
* Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
* (data sub-folders act as non-output collections). Otherwise, defaults to false.
*/
disable_file_actions?: boolean;
/**
* Preview your unbuilt pages (e.g. drafts) to another page’s output URL. The Visual Editor will
* load that set preview URL and use the Data Bindings and Previews to render your new page
* without saving.
*
* For example new_preview_url: /about/ will load the /about/ URL on new or unbuilt pages in the
* Visual Editor.
*/
new_preview_url?: string;
/**
* The set of schemas for this collection. Schemas are used when creating and editing files in
* this collection. Each entry corresponds to a schema that describes a data structure for this
* collection.
*
* The keys in this object should match the values used for schema_key inside each of this
* collection's files. default is a special entry and is used when a file has no schema.
*/
schemas?: Record<string, Schema>;
/**
* The key used in each file to identify the schema that file uses. The value this key represents
* in each of this collection's files should match the keys in schemas. Defaults to _schema.
*/
schema_key?: string;

@@ -884,3 +1293,10 @@ }

export interface CollectionGroup {
/**
* Short, descriptive label for this group of collections.
*/
heading: string;
/**
* The collections shown in the sidebar for this group. Collections here are referenced by their
* key within `collections_config`.
*/
collections: string[];

@@ -891,3 +1307,5 @@ }

/**
* If true, inputs are sorted to match when editing. Extra inputs are ordered after expected inputs, unless `remove_extra_inputs` is true.
* If true, inputs are sorted to match when editing. Extra inputs are ordered after expected
* inputs, unless `remove_extra_inputs` is true.
*
* @default true

@@ -898,2 +1316,3 @@ */

* Hides unexpected inputs when editing. Has no effect if `remove_extra_inputs` is true.
*
* @default false

@@ -903,3 +1322,5 @@ */

/**
* If checked, empty inputs are removed from the source file on save. Removed inputs will be available for editing again, provided they are in the matching schema/structure.
* If checked, empty inputs are removed from the source file on save. Removed inputs will be
* available for editing again, provided they are in the matching schema/structure.
*
* @default false

@@ -910,2 +1331,3 @@ */

* If checked, extra inputs are removed when editing.
*
* @default true

@@ -917,16 +1339,52 @@ */

export interface Structure extends Schemalike {
/**
* Defines what values are available to add when using this structure.
*/
values: Array<StructureValue>;
/**
* Defines what key should be used to detect which structure an item is. If this key is not found
* in the existing structure, a comparison of key names is used. Defaults to "_type".
*/
id_key?: string;
/**
* Defines whether options are shown to your editors in a select menu (select, default) or a modal
* pop up window (modal) when adding a new item.
*/
style?: 'select' | 'modal';
}
export interface StructureValue extends Previewable, Schemalike {
export interface StructureValue extends Previewable, PickerPreviewable, Schemalike {
/**
* A unique reference value used when referring to this structure value from the Object input's
* assigned_structures option.
*/
id?: string;
/**
* If set to true, this item will be considered the default type for this structure. If the type
* of a value within a structure cannot be inferred based on its id_key or matching fields, then
* it will fall back to this item. If multiple items have default set to true, only the first item
* will be used.
*/
default?: boolean;
description?: string;
/**
* An icon used when displaying the structure (defaults to either format_list_bulleted for items
* in arrays, or notes otherwise).
*/
icon?: Icon;
/**
* Path to an image in your source files used when displaying the structure. Can be either a
* source (has priority) or output path.
*/
image?: string;
/**
* Used as the main text in the interface for this value.
*/
label?: string;
picker_preview?: Preview;
/**
* Used to group and filter items when selecting from a modal.
*/
tags?: string[];
/**
* The actual value used when items are added after selection.
*/
value: any;

@@ -936,2 +1394,3 @@ }

export type SelectValues =
| string
| Array<string>

@@ -942,3 +1401,10 @@ | Record<string, string>

export interface DataConfigEntry {
/**
* The path to a file or folder of files containing data.
*/
path: string;
/**
* Overrides how each file in the dataset is read. Detected automatically from file extension if
* unset.
*/
parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml';

@@ -948,2 +1414,8 @@ }

export interface Editor {
/**
* The URL used for the dashboard screenshot, and where the editor opens to when clicking the
* dashboard "Edit Home" button.
*
* @default /
*/
default_path: string;

@@ -955,2 +1427,3 @@ }

* Defines how many spaces lines are auto indented by, and/or how many spaces tabs are shown as.
*
* @default 2

@@ -961,2 +1434,3 @@ */

* Changes the color scheme for syntax highlighting in the editor.
*
* @default monokai

@@ -967,2 +1441,3 @@ */

* Toggles displaying line numbers and code folding controls in the editor.
*
* @default true

@@ -973,13 +1448,125 @@ */

export interface DefaultConfiguration extends Cascade {
export interface CommitTemplate {
/**
* Used to identify a commit template when multiple commit templates are available.
*/
label?: string;
/**
* Set the string for the commit template. This will only be used if template_path is not set.
*/
template_string?: string;
/**
* Sets the path for a file containing your commit template. The file path should be relative to
* the root directory.
*/
template_path?: string;
/**
* Define inputs used to populate data placeholders in the commit template.
*/
_inputs?: Record<string, Input>;
/**
* Define additional template strings, for building nested templates.
*/
extra_data?: Record<string, string>;
}
export type SsgKey =
| 'hugo'
| 'jekyll'
| 'eleventy'
| 'astro'
| 'lume'
| 'mkdocs'
| 'nextjs'
| 'sveltekit'
| 'bridgetown'
| 'docusaurus'
| 'gatsby'
| 'hexo'
| 'nuxtjs'
| 'sphinx'
| 'static'
| 'unknown';
export interface DefaultConfiguration extends Cascade, WithSnippets {
ssg?: SsgKey;
/**
* Base path to your site source files, relative to the root folder.
*/
source?: string;
/**
* Generates the integration file in another folder. Not applicable to Jekyll, Hugo, and Eleventy.
* Defaults to the root folder.
*/
output?: string;
/**
* Global paths to common folders.
*/
paths?: Paths;
/**
* Definitions for your collections, which are the sets of content files for your site grouped by
* folder. Entries are keyed by a chosen collection key, and contain configuration specific to
* that collection.
*/
collections_config?: Record<string, CollectionConfig>;
/**
* Defines which collections are shown in the site navigation and how those collections are
* grouped.
*/
collection_groups?: Array<CollectionGroup>;
/**
* The subpath where your output files are hosted.
*/
base_url?: string;
/**
* Controls what data sets are available to populate select and multiselect inputs.
*/
data_config?: Record<string, DataConfigEntry>;
/**
* Contains settings for the default editor actions on your site.
*/
editor?: Editor;
/**
* Settings for the behavior and appearance of the Source Editor.
*/
source_editor?: SourceEditor;
commit_templates?: Array<CommitTemplate>;
/**
* Contains settings for various Markdown engines.
*/
generator?: {
/**
* Settings for various Markdown engines.
*/
metadata?: {
/**
* The Markdown engine used on your site.
*/
markdown: 'kramdown' | 'commonmark' | 'commonmarkghpages' | 'goldmark' | 'markdown-it';
/**
* Markdown options specific used when markdown is set to "kramdown".
*/
kramdown?: Record<string, any>;
/**
* Markdown options specific used when markdown is set to "commonmark".
*/
commonmark?: Record<string, any>;
/**
* Markdown options specific used when markdown is set to "commonmarkghpages".
*/
commonmarkghpages?: Record<string, any>;
/**
* Markdown options specific used when markdown is set to "goldmark".
*/
goldmark?: Record<string, any>;
/**
* Markdown options specific used when markdown is set to "markdown-it".
*/
'markdown-it'?: Record<string, any>;
};
};
/**
* Specifies the time zone that dates are displayed and edited in. Also changes the suffix the
* date is persisted to the file with.
*
* @default Etc/UTC

@@ -990,3 +1577,7 @@ */

export interface HugoCollectionConfig extends CollectionConfig {
export interface HugoCollectionConfig extends Omit<CollectionConfig, 'url' | 'parser'> {
/**
* Controls whether branch index files (e.g. _index.md) are assigned to this collection or not.
* The "pages" collection defaults this to true, and false otherwise.
*/
parse_branch_index?: boolean;

@@ -996,4 +1587,13 @@ }

export interface HugoConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
ssg?: 'hugo';
collections_config?: Record<string, HugoCollectionConfig>;
/**
* Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
* Defaults to false.
*/
collections_config_override?: boolean;
collections_config?: Record<string, HugoCollectionConfig>;
/**
* Controls what data sets are available to populate select and multiselect inputs.
*/
data_config?: Record<string, boolean>;

@@ -1003,3 +1603,13 @@ }

export interface JekyllConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
ssg?: 'jekyll';
collections_config?: Record<string, Omit<CollectionConfig, 'url' | 'parser'>>;
/**
* Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
* Defaults to false.
*/
collections_config_override?: boolean;
/**
* Controls what data sets are available to populate select and multiselect inputs.
*/
data_config?: Record<string, boolean>;

@@ -1010,3 +1620,13 @@ }

extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
ssg?: 'eleventy';
collections_config?: Record<string, Omit<CollectionConfig, 'url' | 'parser'>>;
/**
* Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
* Defaults to false.
*/
collections_config_override?: boolean;
/**
* Controls what data sets are available to populate select and multiselect inputs.
*/
data_config?: Record<string, boolean>;

@@ -1020,1 +1640,74 @@ }

| EleventyConfiguration;
export type ParsedDataset =
| string[]
| Record<string, string>
| Record<string, Record<string, any>>
| Record<string, any>[];
interface ParsedCollectionItem {
[index: string]: any;
/**
* The path to the file this was parsed from.
*/
path: 'string';
/**
* The collection key this is assigned to. Matches keys in `collections_config`.
*/
collection: 'string';
/**
* The URL this file is served at once built.
*/
url?: 'string';
}
interface WithIntegrationOutput {
/**
* The error code encountered when attempting to create the integration output file.
*/
error?: 'NO_CONTENT' | string;
/**
* The time this file was generated.
*/
time?: string;
/**
* [DEPRECATED] The schema version of the integration output file.
*/
version?: string; // This refers to an old schema, replaced by the IntegrationOutput type.
/**
* Details about the integration tool used to generate the integration output file.
*/
cloudcannon?: {
/**
* Name of the integration tool used to generate the integration output file.
*/
name: string;
/**
* Version of the integration tool used to generate the integration output file.
*/
version: string;
};
/**
* Map of data keys to parsed datasets. Keys match keys in `data_config`.
*/
data?: Record<string, ParsedDataset>;
/**
* Map of collection keys to parsed collection files. Keys match keys in `collections_config`.
*/
collections?: Record<string, ParsedCollectionItem>;
/**
* Map of build file paths to MD5s.
*/
files?: Record<string, string>;
}
export interface DefaultIntegrationOutput extends DefaultConfiguration, WithIntegrationOutput {}
export interface HugoIntegrationOutput extends HugoConfiguration, WithIntegrationOutput {}
export interface JekyllIntegrationOutput extends JekyllConfiguration, WithIntegrationOutput {}
export interface EleventyIntegrationOutput extends EleventyConfiguration, WithIntegrationOutput {}
export type IntegrationOutput =
| DefaultIntegrationOutput
| HugoIntegrationOutput
| JekyllIntegrationOutput
| EleventyIntegrationOutput;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc