datocms-plugin-sdk 0.5.2 → 0.6.1-alpha.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/dist/cjs/connect.js.map +1 -1
- package/dist/esm/SiteApiSchema.d.ts +2424 -971
- package/dist/esm/connect.d.ts +5 -5
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/types.d.ts +13 -4
- package/dist/types/SiteApiSchema.d.ts +2424 -971
- package/dist/types/connect.d.ts +5 -5
- package/dist/types/index.d.ts +2 -2
- package/dist/types/types.d.ts +13 -4
- package/package.json +2 -2
- package/src/SiteApiSchema.ts +2819 -977
- package/src/connect.ts +6 -6
- package/src/index.ts +2 -2
- package/src/types.ts +13 -4
- package/types.json +1545 -1405
package/src/connect.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import connectToParent from 'penpal/lib/connectToParent';
|
|
2
|
-
import { Field,
|
|
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,
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
281
|
+
] as ItemType;
|
|
282
282
|
result[field.id] = fn(field, { ...ctx, itemType });
|
|
283
283
|
}
|
|
284
284
|
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Field,
|
|
6
6
|
Fieldset,
|
|
7
7
|
Item,
|
|
8
|
-
|
|
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,
|
|
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:
|
|
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 */
|
|
@@ -1108,6 +1108,15 @@ export type ItemFormAdditionalProperties = {
|
|
|
1108
1108
|
isSubmitting: boolean;
|
|
1109
1109
|
/** Whether the form has some non-persisted changes or not */
|
|
1110
1110
|
isFormDirty: boolean;
|
|
1111
|
+
/** Current number of blocks present in form state */
|
|
1112
|
+
blocksUsage: {
|
|
1113
|
+
/** Total number of blocks */
|
|
1114
|
+
total: number;
|
|
1115
|
+
/** Total number of blocks present in non-localized fields */
|
|
1116
|
+
nonLocalized: number;
|
|
1117
|
+
/** Total number of blocks present in localized fields, per locale */
|
|
1118
|
+
perLocale: Record<string, number>;
|
|
1119
|
+
};
|
|
1111
1120
|
};
|
|
1112
1121
|
|
|
1113
1122
|
export type ItemFormProperties = RenderProperties &
|
|
@@ -1481,7 +1490,7 @@ export type RenderManualFieldExtensionConfigScreenAdditionalProperties = {
|
|
|
1481
1490
|
pendingField: PendingField;
|
|
1482
1491
|
|
|
1483
1492
|
/** The model for the field being edited */
|
|
1484
|
-
itemType:
|
|
1493
|
+
itemType: ItemType;
|
|
1485
1494
|
};
|
|
1486
1495
|
|
|
1487
1496
|
export type RenderManualFieldExtensionConfigScreenProperties = RenderProperties &
|