datocms-plugin-sdk 0.3.26 → 0.3.33

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.
@@ -1,4 +1,4 @@
1
- import { Account, Field, Item, ModelBlock, Plugin, PluginAttributes, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
1
+ import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
2
2
  export declare type Icon = string | {
3
3
  type: 'svg';
4
4
  viewBox: string;
@@ -114,6 +114,7 @@ export declare type ContentAreaSidebarItem = {
114
114
  rank?: number;
115
115
  };
116
116
  export declare type FieldExtensionType = 'editor' | 'addon';
117
+ export declare type FieldType = 'boolean' | 'color' | 'date_time' | 'date' | 'file' | 'float' | 'gallery' | 'integer' | 'json' | 'lat_lon' | 'link' | 'links' | 'rich_text' | 'seo' | 'slug' | 'string' | 'structured_text' | 'text' | 'video';
117
118
  /**
118
119
  * Field extensions extend the basic functionality of DatoCMS when it comes to
119
120
  * presenting record's fields to the final user. Depending on the extension type
@@ -141,8 +142,11 @@ export declare type ManualFieldExtension = {
141
142
  asSidebarPanel?: boolean | {
142
143
  startOpen: boolean;
143
144
  };
144
- /** The type of fields that the field extension in compatible with */
145
- fieldTypes: NonNullable<PluginAttributes['field_types']>;
145
+ /**
146
+ * The type of fields that the field extension in compatible with. You can use
147
+ * the shortcut `all` to target all types of fields
148
+ */
149
+ fieldTypes: 'all' | FieldType[];
146
150
  /**
147
151
  * Whether this field extension needs some configuration options before being
148
152
  * installed in a field or not. Will trigger the
@@ -419,6 +423,14 @@ export declare type RenderAdditionalProperties = {
419
423
  * to load them.
420
424
  */
421
425
  fields: Partial<Record<string, Field>>;
426
+ /**
427
+ * All the fieldsets currently loaded for the current DatoCMS project, indexed
428
+ * by ID. It will always contain the current model fields and all the fields
429
+ * of the blocks it might contain via Modular Content/Structured Text fields.
430
+ * If some fields you need are not present, use the `loadItemTypeFieldsets`
431
+ * function to load them.
432
+ */
433
+ fieldsets: Partial<Record<string, Fieldset>>;
422
434
  /** An object containing the theme colors for the current DatoCMS project */
423
435
  theme: Theme;
424
436
  /**
@@ -559,6 +571,25 @@ export declare type LoadDataMethods = {
559
571
  * ```
560
572
  */
561
573
  loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
574
+ /**
575
+ * Loads all the fieldsets for a specific model (or block). Fieldsets will be
576
+ * returned and will also be available in the the `fieldsets` property.
577
+ *
578
+ * @example
579
+ *
580
+ * ```js
581
+ * const itemTypeId = prompt('Please insert a model ID:');
582
+ *
583
+ * const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
584
+ *
585
+ * ctx.notice(
586
+ * `Success! ${fieldsets
587
+ * .map((fieldset) => fieldset.attributes.title)
588
+ * .join(', ')}`,
589
+ * );
590
+ * ```
591
+ */
592
+ loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
562
593
  /**
563
594
  * Loads all the fields in the project that are currently using the plugin for
564
595
  * one of its manual field extensions.
@@ -1,4 +1,4 @@
1
- import { Account, Field, Item, ModelBlock, Plugin, PluginAttributes, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
1
+ import { Account, Field, Fieldset, Item, ModelBlock, Plugin, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
2
2
  export declare type Icon = string | {
3
3
  type: 'svg';
4
4
  viewBox: string;
@@ -114,6 +114,7 @@ export declare type ContentAreaSidebarItem = {
114
114
  rank?: number;
115
115
  };
116
116
  export declare type FieldExtensionType = 'editor' | 'addon';
117
+ export declare type FieldType = 'boolean' | 'color' | 'date_time' | 'date' | 'file' | 'float' | 'gallery' | 'integer' | 'json' | 'lat_lon' | 'link' | 'links' | 'rich_text' | 'seo' | 'slug' | 'string' | 'structured_text' | 'text' | 'video';
117
118
  /**
118
119
  * Field extensions extend the basic functionality of DatoCMS when it comes to
119
120
  * presenting record's fields to the final user. Depending on the extension type
@@ -141,8 +142,11 @@ export declare type ManualFieldExtension = {
141
142
  asSidebarPanel?: boolean | {
142
143
  startOpen: boolean;
143
144
  };
144
- /** The type of fields that the field extension in compatible with */
145
- fieldTypes: NonNullable<PluginAttributes['field_types']>;
145
+ /**
146
+ * The type of fields that the field extension in compatible with. You can use
147
+ * the shortcut `all` to target all types of fields
148
+ */
149
+ fieldTypes: 'all' | FieldType[];
146
150
  /**
147
151
  * Whether this field extension needs some configuration options before being
148
152
  * installed in a field or not. Will trigger the
@@ -419,6 +423,14 @@ export declare type RenderAdditionalProperties = {
419
423
  * to load them.
420
424
  */
421
425
  fields: Partial<Record<string, Field>>;
426
+ /**
427
+ * All the fieldsets currently loaded for the current DatoCMS project, indexed
428
+ * by ID. It will always contain the current model fields and all the fields
429
+ * of the blocks it might contain via Modular Content/Structured Text fields.
430
+ * If some fields you need are not present, use the `loadItemTypeFieldsets`
431
+ * function to load them.
432
+ */
433
+ fieldsets: Partial<Record<string, Fieldset>>;
422
434
  /** An object containing the theme colors for the current DatoCMS project */
423
435
  theme: Theme;
424
436
  /**
@@ -559,6 +571,25 @@ export declare type LoadDataMethods = {
559
571
  * ```
560
572
  */
561
573
  loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
574
+ /**
575
+ * Loads all the fieldsets for a specific model (or block). Fieldsets will be
576
+ * returned and will also be available in the the `fieldsets` property.
577
+ *
578
+ * @example
579
+ *
580
+ * ```js
581
+ * const itemTypeId = prompt('Please insert a model ID:');
582
+ *
583
+ * const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
584
+ *
585
+ * ctx.notice(
586
+ * `Success! ${fieldsets
587
+ * .map((fieldset) => fieldset.attributes.title)
588
+ * .join(', ')}`,
589
+ * );
590
+ * ```
591
+ */
592
+ loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
562
593
  /**
563
594
  * Loads all the fields in the project that are currently using the plugin for
564
595
  * one of its manual field extensions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datocms-plugin-sdk",
3
- "version": "0.3.26",
3
+ "version": "0.3.33",
4
4
  "description": "DatoCMS Plugin SDK",
5
5
  "keywords": [
6
6
  "datocms",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
- "sistema",
23
+ "src",
24
24
  "types.json"
25
25
  ],
26
26
  "repository": {
@@ -41,5 +41,5 @@
41
41
  "devDependencies": {
42
42
  "typedoc": "^0.22.8"
43
43
  },
44
- "gitHead": "d69a1acf1fd4bf58604559ffc74be584b51285db"
44
+ "gitHead": "d3b87c5972cffb40d248f09246211fa772c4244b"
45
45
  }