datocms-plugin-sdk 0.3.24 → 0.3.32

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, PluginAttributes, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
2
2
  export declare type Icon = string | {
3
3
  type: 'svg';
4
4
  viewBox: string;
@@ -142,7 +142,7 @@ export declare type ManualFieldExtension = {
142
142
  startOpen: boolean;
143
143
  };
144
144
  /** The type of fields that the field extension in compatible with */
145
- fieldTypes: NonNullable<PluginAttributes['field_types']>;
145
+ fieldTypes: NonNullable<PluginAttributes['field_types']> | 'all';
146
146
  /**
147
147
  * Whether this field extension needs some configuration options before being
148
148
  * installed in a field or not. Will trigger the
@@ -419,6 +419,14 @@ export declare type RenderAdditionalProperties = {
419
419
  * to load them.
420
420
  */
421
421
  fields: Partial<Record<string, Field>>;
422
+ /**
423
+ * All the fieldsets currently loaded for the current DatoCMS project, indexed
424
+ * by ID. It will always contain the current model fields and all the fields
425
+ * of the blocks it might contain via Modular Content/Structured Text fields.
426
+ * If some fields you need are not present, use the `loadItemTypeFieldsets`
427
+ * function to load them.
428
+ */
429
+ fieldsets: Partial<Record<string, Fieldset>>;
422
430
  /** An object containing the theme colors for the current DatoCMS project */
423
431
  theme: Theme;
424
432
  /**
@@ -559,6 +567,25 @@ export declare type LoadDataMethods = {
559
567
  * ```
560
568
  */
561
569
  loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
570
+ /**
571
+ * Loads all the fieldsets for a specific model (or block). Fieldsets will be
572
+ * returned and will also be available in the the `fieldsets` property.
573
+ *
574
+ * @example
575
+ *
576
+ * ```js
577
+ * const itemTypeId = prompt('Please insert a model ID:');
578
+ *
579
+ * const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
580
+ *
581
+ * ctx.notice(
582
+ * `Success! ${fieldsets
583
+ * .map((fieldset) => fieldset.attributes.title)
584
+ * .join(', ')}`,
585
+ * );
586
+ * ```
587
+ */
588
+ loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
562
589
  /**
563
590
  * Loads all the fields in the project that are currently using the plugin for
564
591
  * one of its manual field extensions.
@@ -896,7 +923,7 @@ export declare type IframeMethods = {
896
923
  /** Sets the height for the iframe */
897
924
  setHeight: (number: number) => Promise<void>;
898
925
  };
899
- export declare type RenderMethods = LoadDataMethods & UpdateParametersMethods & ToastMethods & CustomDialogMethods & NavigateMethods;
926
+ export declare type RenderMethods = LoadDataMethods & UpdateParametersMethods & ToastMethods & ItemDialogMethods & UploadDialogMethods & CustomDialogMethods & NavigateMethods;
900
927
  /**
901
928
  * These information describe the current state of the form that's being shown
902
929
  * to the end-user to edit a record
@@ -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, PluginAttributes, Role, Site, SsoUser, Upload, User } from './SiteApiSchema';
2
2
  export declare type Icon = string | {
3
3
  type: 'svg';
4
4
  viewBox: string;
@@ -142,7 +142,7 @@ export declare type ManualFieldExtension = {
142
142
  startOpen: boolean;
143
143
  };
144
144
  /** The type of fields that the field extension in compatible with */
145
- fieldTypes: NonNullable<PluginAttributes['field_types']>;
145
+ fieldTypes: NonNullable<PluginAttributes['field_types']> | 'all';
146
146
  /**
147
147
  * Whether this field extension needs some configuration options before being
148
148
  * installed in a field or not. Will trigger the
@@ -419,6 +419,14 @@ export declare type RenderAdditionalProperties = {
419
419
  * to load them.
420
420
  */
421
421
  fields: Partial<Record<string, Field>>;
422
+ /**
423
+ * All the fieldsets currently loaded for the current DatoCMS project, indexed
424
+ * by ID. It will always contain the current model fields and all the fields
425
+ * of the blocks it might contain via Modular Content/Structured Text fields.
426
+ * If some fields you need are not present, use the `loadItemTypeFieldsets`
427
+ * function to load them.
428
+ */
429
+ fieldsets: Partial<Record<string, Fieldset>>;
422
430
  /** An object containing the theme colors for the current DatoCMS project */
423
431
  theme: Theme;
424
432
  /**
@@ -559,6 +567,25 @@ export declare type LoadDataMethods = {
559
567
  * ```
560
568
  */
561
569
  loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
570
+ /**
571
+ * Loads all the fieldsets for a specific model (or block). Fieldsets will be
572
+ * returned and will also be available in the the `fieldsets` property.
573
+ *
574
+ * @example
575
+ *
576
+ * ```js
577
+ * const itemTypeId = prompt('Please insert a model ID:');
578
+ *
579
+ * const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
580
+ *
581
+ * ctx.notice(
582
+ * `Success! ${fieldsets
583
+ * .map((fieldset) => fieldset.attributes.title)
584
+ * .join(', ')}`,
585
+ * );
586
+ * ```
587
+ */
588
+ loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
562
589
  /**
563
590
  * Loads all the fields in the project that are currently using the plugin for
564
591
  * one of its manual field extensions.
@@ -896,7 +923,7 @@ export declare type IframeMethods = {
896
923
  /** Sets the height for the iframe */
897
924
  setHeight: (number: number) => Promise<void>;
898
925
  };
899
- export declare type RenderMethods = LoadDataMethods & UpdateParametersMethods & ToastMethods & CustomDialogMethods & NavigateMethods;
926
+ export declare type RenderMethods = LoadDataMethods & UpdateParametersMethods & ToastMethods & ItemDialogMethods & UploadDialogMethods & CustomDialogMethods & NavigateMethods;
900
927
  /**
901
928
  * These information describe the current state of the form that's being shown
902
929
  * to the end-user to edit a record
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datocms-plugin-sdk",
3
- "version": "0.3.24",
3
+ "version": "0.3.32",
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": "8de7e2cbfcb4514cd07ca0978be12c9e8c4996aa"
44
+ "gitHead": "db31347c59fa5ef6bfc050f36ff89f59846a7952"
45
45
  }