@cloudcannon/configuration-types 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,63 +4,45 @@
4
4
  "additionalProperties": false,
5
5
  "definitions": {
6
6
  "AddOption": {
7
- "anyOf": [
8
- {
9
- "additionalProperties": false,
10
- "properties": {
11
- "base_path": {
12
- "description": "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.",
13
- "markdownDescription": "Enforces a path for new files to be created in, regardless of path the user is currently\nnavigated to within the collection file list. Relative to the path of the collection\ndefined in collection. Defaults to the path within the collection the user is currently\nnavigated to.",
14
- "type": "string"
15
- },
16
- "collection": {
17
- "description": "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.",
18
- "markdownDescription": "Sets which collection this action is creating a file in. This is used when matching the\nvalue for schema. Defaults to the containing collection these `add_options` are configured\nin.",
19
- "type": "string"
20
- },
21
- "default_content_file": {
22
- "description": "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.",
23
- "markdownDescription": "The path to a file used to populate the initial contents of a new file if no schemas are\nconfigured. We recommend using schemas, and this is ignored if a schema is available.",
24
- "type": "string"
25
- },
26
- "editor": {
27
- "$ref": "#/definitions/EditorKey",
28
- "description": "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.",
29
- "markdownDescription": "The editor to open the new file in. Defaults to an appropriate editor for new file's type\nif possible. If no default editor can be calculated, or the editor does not support the new\nfile type, a warning is shown in place of the editor."
30
- },
31
- "icon": {
32
- "$ref": "#/definitions/Icon",
33
- "description": "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.",
34
- "markdownDescription": "The icon next to the text in the menu item. Defaults to using icon from the matching schema\nif set, then falls back to add."
35
- },
36
- "name": {
37
- "description": "The text displayed for the menu item. Defaults to using name from the matching schema if set.",
38
- "markdownDescription": "The text displayed for the menu item. Defaults to using name from the matching schema if\nset.",
39
- "type": "string"
40
- },
41
- "schema": {
42
- "description": "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.",
43
- "markdownDescription": "The schema that new files are created from with this action. This schema is not restricted\nto the containing collection, and is instead relative to the collection specified with\ncollection. Defaults to default if schemas are configured for the collection.",
44
- "type": "string"
45
- }
46
- },
47
- "type": "object"
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "base_path": {
10
+ "description": "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.",
11
+ "markdownDescription": "Enforces a path for new files to be created in, regardless of path the user is currently\nnavigated to within the collection file list. Relative to the path of the collection defined in\ncollection. Defaults to the path within the collection the user is currently navigated to.",
12
+ "type": "string"
48
13
  },
49
- {
50
- "additionalProperties": false,
51
- "properties": {
52
- "href": {
53
- "description": "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.",
54
- "markdownDescription": "The link that opens when the option is clicked. Can either be an external or internal link.\nIf internal, the link is relative to the current site.",
55
- "type": "string"
56
- }
57
- },
58
- "required": [
59
- "href"
60
- ],
61
- "type": "object"
14
+ "collection": {
15
+ "description": "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.",
16
+ "markdownDescription": "Sets which collection this action is creating a file in. This is used when matching the value\nfor schema. Defaults to the containing collection these `add_options` are configured in.",
17
+ "type": "string"
18
+ },
19
+ "default_content_file": {
20
+ "description": "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.",
21
+ "markdownDescription": "The path to a file used to populate the initial contents of a new file if no schemas are\nconfigured. We recommend using schemas, and this is ignored if a schema is available.",
22
+ "type": "string"
23
+ },
24
+ "editor": {
25
+ "$ref": "#/definitions/EditorKey",
26
+ "description": "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.",
27
+ "markdownDescription": "The editor to open the new file in. Defaults to an appropriate editor for new file's type if\npossible. If no default editor can be calculated, or the editor does not support the new file\ntype, a warning is shown in place of the editor."
28
+ },
29
+ "icon": {
30
+ "$ref": "#/definitions/Icon",
31
+ "description": "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.",
32
+ "markdownDescription": "The icon next to the text in the menu item. Defaults to using icon from the matching schema if\nset, then falls back to add."
33
+ },
34
+ "name": {
35
+ "description": "The text displayed for the menu item. Defaults to using name from the matching schema if set.",
36
+ "markdownDescription": "The text displayed for the menu item. Defaults to using name from the matching schema if set.",
37
+ "type": "string"
38
+ },
39
+ "schema": {
40
+ "description": "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.",
41
+ "markdownDescription": "The schema that new files are created from with this action. This schema is not restricted to\nthe containing collection, and is instead relative to the collection specified with collection.\nDefaults to default if schemas are configured for the collection.",
42
+ "type": "string"
62
43
  }
63
- ]
44
+ },
45
+ "type": "object"
64
46
  },
65
47
  "ArrayInput": {
66
48
  "additionalProperties": false,
@@ -876,7 +858,14 @@
876
858
  "add_options": {
877
859
  "description": "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.",
878
860
  "items": {
879
- "$ref": "#/definitions/AddOption"
861
+ "anyOf": [
862
+ {
863
+ "$ref": "#/definitions/AddOption"
864
+ },
865
+ {
866
+ "$ref": "#/definitions/HrefAddOption"
867
+ }
868
+ ]
880
869
  },
881
870
  "markdownDescription": "Changes the options presented in the add menu in the collection file list. Defaults to an\nautomatically generated list from _Schemas_, or uses the first file in the collection if no\nschemas are configured.",
882
871
  "type": "array"
@@ -1614,6 +1603,31 @@
1614
1603
  },
1615
1604
  "type": "object"
1616
1605
  },
1606
+ "HrefAddOption": {
1607
+ "additionalProperties": false,
1608
+ "properties": {
1609
+ "href": {
1610
+ "description": "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.",
1611
+ "markdownDescription": "The link that opens when the option is clicked. Can either be an external or internal link. If\ninternal, the link is relative to the current site.",
1612
+ "type": "string"
1613
+ },
1614
+ "icon": {
1615
+ "$ref": "#/definitions/Icon",
1616
+ "default": "add",
1617
+ "description": "The icon next to the text in the menu item.",
1618
+ "markdownDescription": "The icon next to the text in the menu item."
1619
+ },
1620
+ "name": {
1621
+ "description": "The text displayed for the menu item.",
1622
+ "markdownDescription": "The text displayed for the menu item.",
1623
+ "type": "string"
1624
+ }
1625
+ },
1626
+ "required": [
1627
+ "href"
1628
+ ],
1629
+ "type": "object"
1630
+ },
1617
1631
  "Icon": {
1618
1632
  "enum": [
1619
1633
  "10k",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcannon/configuration-types",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "Contains TypeScript declarations and generates JSONSchema files for the CloudCannon configuration file.",
5
5
  "author": "CloudCannon <support@cloudcannon.com>",
6
6
  "license": "MIT",
@@ -88,18 +88,25 @@ export interface ReaderConfiguration extends Configuration {
88
88
  output?: string;
89
89
  }
90
90
 
91
- export interface BuildCoupledCollectionConfig extends Omit<CollectionConfig, 'url'>, Filterable {
91
+ export interface BuildCoupledCollectionConfig
92
+ extends Omit<CollectionConfig, 'url' | 'path'>,
93
+ Filterable {
92
94
  /**
93
95
  * Overrides the default singular input key of the collection. This is used for naming conventions
94
96
  * for select and multiselect inputs.
95
97
  */
96
98
  singular_key?: string;
99
+ /**
100
+ * The top-most folder where the files in this collection are stored. It is relative to `source`.
101
+ */
102
+ path?: string;
97
103
  }
98
104
 
99
105
  interface BuildCoupledConfiguration
100
- extends Omit<Configuration, 'data_config'>,
106
+ extends Omit<Configuration, 'data_config' | 'collections_config'>,
101
107
  WithCollectionsConfigOverride {
102
108
  paths?: BuildCoupledPaths;
109
+ collections_config?: BuildCoupledCollectionConfig;
103
110
  }
104
111
 
105
112
  /**
@@ -1269,56 +1269,63 @@ export interface Preview
1269
1269
  gallery?: PreviewGallery;
1270
1270
  }
1271
1271
 
1272
- export type AddOption =
1273
- | {
1274
- /**
1275
- * The text displayed for the menu item. Defaults to using name from the matching schema if
1276
- * set.
1277
- */
1278
- name?: string;
1279
- /**
1280
- * The icon next to the text in the menu item. Defaults to using icon from the matching schema
1281
- * if set, then falls back to add.
1282
- */
1283
- icon?: Icon;
1284
- /**
1285
- * The editor to open the new file in. Defaults to an appropriate editor for new file's type
1286
- * if possible. If no default editor can be calculated, or the editor does not support the new
1287
- * file type, a warning is shown in place of the editor.
1288
- */
1289
- editor?: EditorKey;
1290
- /**
1291
- * Enforces a path for new files to be created in, regardless of path the user is currently
1292
- * navigated to within the collection file list. Relative to the path of the collection
1293
- * defined in collection. Defaults to the path within the collection the user is currently
1294
- * navigated to.
1295
- */
1296
- base_path?: string;
1297
- /**
1298
- * Sets which collection this action is creating a file in. This is used when matching the
1299
- * value for schema. Defaults to the containing collection these `add_options` are configured
1300
- * in.
1301
- */
1302
- collection?: string;
1303
- /**
1304
- * The schema that new files are created from with this action. This schema is not restricted
1305
- * to the containing collection, and is instead relative to the collection specified with
1306
- * collection. Defaults to default if schemas are configured for the collection.
1307
- */
1308
- schema?: string;
1309
- /**
1310
- * The path to a file used to populate the initial contents of a new file if no schemas are
1311
- * configured. We recommend using schemas, and this is ignored if a schema is available.
1312
- */
1313
- default_content_file?: string;
1314
- }
1315
- | {
1316
- /**
1317
- * The link that opens when the option is clicked. Can either be an external or internal link.
1318
- * If internal, the link is relative to the current site.
1319
- */
1320
- href: string;
1321
- };
1272
+ export type HrefAddOption = {
1273
+ /**
1274
+ * The text displayed for the menu item.
1275
+ */
1276
+ name?: string;
1277
+ /**
1278
+ * The icon next to the text in the menu item.
1279
+ *
1280
+ * @default add
1281
+ */
1282
+ icon?: Icon;
1283
+ /**
1284
+ * The link that opens when the option is clicked. Can either be an external or internal link. If
1285
+ * internal, the link is relative to the current site.
1286
+ */
1287
+ href: string;
1288
+ };
1289
+
1290
+ export type AddOption = {
1291
+ /**
1292
+ * The text displayed for the menu item. Defaults to using name from the matching schema if set.
1293
+ */
1294
+ name?: string;
1295
+ /**
1296
+ * The icon next to the text in the menu item. Defaults to using icon from the matching schema if
1297
+ * set, then falls back to add.
1298
+ */
1299
+ icon?: Icon;
1300
+ /**
1301
+ * The editor to open the new file in. Defaults to an appropriate editor for new file's type if
1302
+ * possible. If no default editor can be calculated, or the editor does not support the new file
1303
+ * type, a warning is shown in place of the editor.
1304
+ */
1305
+ editor?: EditorKey;
1306
+ /**
1307
+ * Enforces a path for new files to be created in, regardless of path the user is currently
1308
+ * navigated to within the collection file list. Relative to the path of the collection defined in
1309
+ * collection. Defaults to the path within the collection the user is currently navigated to.
1310
+ */
1311
+ base_path?: string;
1312
+ /**
1313
+ * Sets which collection this action is creating a file in. This is used when matching the value
1314
+ * for schema. Defaults to the containing collection these `add_options` are configured in.
1315
+ */
1316
+ collection?: string;
1317
+ /**
1318
+ * The schema that new files are created from with this action. This schema is not restricted to
1319
+ * the containing collection, and is instead relative to the collection specified with collection.
1320
+ * Defaults to default if schemas are configured for the collection.
1321
+ */
1322
+ schema?: string;
1323
+ /**
1324
+ * The path to a file used to populate the initial contents of a new file if no schemas are
1325
+ * configured. We recommend using schemas, and this is ignored if a schema is available.
1326
+ */
1327
+ default_content_file?: string;
1328
+ };
1322
1329
 
1323
1330
  interface WithPreview {
1324
1331
  /**
@@ -1488,7 +1495,7 @@ export interface CollectionConfig extends Cascade, WithPreview {
1488
1495
  * automatically generated list from _Schemas_, or uses the first file in the collection if no
1489
1496
  * schemas are configured.
1490
1497
  */
1491
- add_options?: AddOption[];
1498
+ add_options?: (AddOption | HrefAddOption)[];
1492
1499
  /**
1493
1500
  * The create path definition to control where new files are saved to inside this collection.
1494
1501
  * Defaults to [relative_base_path]/{title|slugify}.md.