datocms-plugin-sdk 0.5.3 → 0.6.0

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.
package/src/connect.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import connectToParent from 'penpal/lib/connectToParent';
2
- import { Field, ModelBlock } from './SiteApiSchema';
2
+ import { Field, ItemType } from './SiteApiSchema';
3
3
  import {
4
4
  AssetSource,
5
5
  ContentAreaSidebarItem,
@@ -64,12 +64,12 @@ export type SizingUtilities = {
64
64
  updateHeight: (newHeight?: number) => void;
65
65
  };
66
66
 
67
- export type { Field, ModelBlock };
67
+ export type { Field, ItemType };
68
68
 
69
69
  export type IntentCtx = InitPropertiesAndMethods;
70
70
  export type OnBootCtx = OnBootPropertiesAndMethods;
71
71
  export type FieldIntentCtx = InitPropertiesAndMethods & {
72
- itemType: ModelBlock;
72
+ itemType: ItemType;
73
73
  };
74
74
  export type RenderPageCtx = RenderPagePropertiesAndMethods;
75
75
  export type RenderModalCtx = RenderModalPropertiesAndMethods & SizingUtilities;
@@ -136,7 +136,7 @@ export type FullConnectParameters = {
136
136
  * @group sidebarPanels
137
137
  */
138
138
  itemFormSidebarPanels: (
139
- itemType: ModelBlock,
139
+ itemType: ItemType,
140
140
  ctx: IntentCtx,
141
141
  ) => ItemFormSidebarPanel[];
142
142
 
@@ -146,7 +146,7 @@ export type FullConnectParameters = {
146
146
  *
147
147
  * @group itemFormOutlets
148
148
  */
149
- itemFormOutlets: (itemType: ModelBlock, ctx: IntentCtx) => ItemFormOutlet[];
149
+ itemFormOutlets: (itemType: ItemType, ctx: IntentCtx) => ItemFormOutlet[];
150
150
 
151
151
  /**
152
152
  * Use this function to automatically force one or more field extensions to a
@@ -278,7 +278,7 @@ function toMultifield<Result>(
278
278
  for (const field of fields) {
279
279
  const itemType = ctx.itemTypes[
280
280
  field.relationships.item_type.data.id
281
- ] as ModelBlock;
281
+ ] as ItemType;
282
282
  result[field.id] = fn(field, { ...ctx, itemType });
283
283
  }
284
284
 
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  Account,
3
3
  Field,
4
4
  Item,
5
- ModelBlock,
5
+ ItemType,
6
6
  Plugin,
7
7
  Site,
8
8
  SsoUser,
@@ -15,7 +15,7 @@ export type {
15
15
  Account,
16
16
  Field,
17
17
  Item,
18
- ModelBlock,
18
+ ItemType,
19
19
  Plugin,
20
20
  Site,
21
21
  SsoUser,
package/src/types.ts CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  Field,
6
6
  Fieldset,
7
7
  Item,
8
- ModelBlock,
8
+ ItemType,
9
9
  Plugin,
10
10
  Role,
11
11
  Site,
@@ -514,7 +514,7 @@ export type CommonProperties = {
514
514
  /** The ID of the current environment */
515
515
  environment: string;
516
516
  /** All the models of the current DatoCMS project, indexed by ID */
517
- itemTypes: Partial<Record<string, ModelBlock>>;
517
+ itemTypes: Partial<Record<string, ItemType>>;
518
518
  /**
519
519
  * The current DatoCMS user. It can either be the owner or one of the
520
520
  * collaborators (regular or SSO).
@@ -1099,7 +1099,7 @@ export type ItemFormAdditionalProperties = {
1099
1099
  /** If an already persisted record is being edited, returns the full record entity */
1100
1100
  item: Item | null;
1101
1101
  /** The model for the record being edited */
1102
- itemType: ModelBlock;
1102
+ itemType: ItemType;
1103
1103
  /** The complete internal form state */
1104
1104
  formValues: Record<string, unknown>;
1105
1105
  /** The current status of the record being edited */
@@ -1481,7 +1481,7 @@ export type RenderManualFieldExtensionConfigScreenAdditionalProperties = {
1481
1481
  pendingField: PendingField;
1482
1482
 
1483
1483
  /** The model for the field being edited */
1484
- itemType: ModelBlock;
1484
+ itemType: ItemType;
1485
1485
  };
1486
1486
 
1487
1487
  export type RenderManualFieldExtensionConfigScreenProperties = RenderProperties &