datocms-plugin-sdk 0.6.7 → 0.6.10

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
@@ -75,14 +75,14 @@ export type RenderPageCtx = RenderPagePropertiesAndMethods;
75
75
  export type RenderModalCtx = RenderModalPropertiesAndMethods & SizingUtilities;
76
76
  export type RenderAssetSourceCtx = RenderAssetSourcePropertiesAndMethods &
77
77
  SizingUtilities;
78
- export type RenderItemFormSidebarPanelCtx = RenderSidebarPanelPropertiesAndMethods &
79
- SizingUtilities;
78
+ export type RenderItemFormSidebarPanelCtx =
79
+ RenderSidebarPanelPropertiesAndMethods & SizingUtilities;
80
80
  export type RenderItemFormOutletCtx = RenderItemFormOutletPropertiesAndMethods &
81
81
  SizingUtilities;
82
82
  export type RenderFieldExtensionCtx = RenderFieldExtensionPropertiesAndMethods &
83
83
  SizingUtilities;
84
- export type RenderManualFieldExtensionConfigScreenCtx = RenderManualFieldExtensionConfigScreenPropertiesAndMethods &
85
- SizingUtilities;
84
+ export type RenderManualFieldExtensionConfigScreenCtx =
85
+ RenderManualFieldExtensionConfigScreenPropertiesAndMethods & SizingUtilities;
86
86
  export type RenderConfigScreenCtx = RenderConfigScreenPropertiesAndMethods &
87
87
  SizingUtilities;
88
88
 
@@ -96,13 +96,15 @@ export type FullConnectParameters = {
96
96
  */
97
97
  onBoot: (ctx: OnBootCtx) => void;
98
98
  /**
99
- * Use this function to declare new tabs you want to add in the top-bar of the UI
99
+ * Use this function to declare new tabs you want to add in the top-bar of the
100
+ * UI
100
101
  *
101
102
  * @group pages
102
103
  */
103
104
  mainNavigationTabs: (ctx: IntentCtx) => MainNavigationTab[];
104
105
  /**
105
- * Use this function to declare new navigation sections in the Settings Area sidebar
106
+ * Use this function to declare new navigation sections in the Settings Area
107
+ * sidebar
106
108
  *
107
109
  * @group pages
108
110
  */
@@ -110,7 +112,8 @@ export type FullConnectParameters = {
110
112
  ctx: IntentCtx,
111
113
  ) => SettingsAreaSidebarItemGroup[];
112
114
  /**
113
- * Use this function to declare new navigation items in the Content Area sidebar
115
+ * Use this function to declare new navigation items in the Content Area
116
+ * sidebar
114
117
  *
115
118
  * @group pages
116
119
  */
@@ -232,7 +235,8 @@ export type FullConnectParameters = {
232
235
  renderAssetSource: (assetSourceId: string, ctx: RenderAssetSourceCtx) => void;
233
236
  /**
234
237
  * This function will be called when the plugin needs to render a field
235
- * extension (see the `manualFieldExtensions` and `overrideFieldExtensions` functions)
238
+ * extension (see the `manualFieldExtensions` and `overrideFieldExtensions`
239
+ * functions)
236
240
  *
237
241
  * @group forcedFieldExtensions
238
242
  */
@@ -242,7 +246,8 @@ export type FullConnectParameters = {
242
246
  ) => void;
243
247
  /**
244
248
  * This function will be called when the plugin needs to render the
245
- * configuration form for installing a field extension inside a particular field
249
+ * configuration form for installing a field extension inside a particular
250
+ * field
246
251
  *
247
252
  * @group manualFieldExtensions
248
253
  */
package/src/guards.ts CHANGED
@@ -24,30 +24,26 @@ export const isOnBootParent = buildGuard<OnBootMethods>('onBoot');
24
24
 
25
25
  export const isRenderPageParent = buildGuard<RenderPageMethods>('renderPage');
26
26
 
27
- export const isRenderConfigScreenParent = buildGuard<RenderConfigScreenMethods>(
28
- 'renderConfigScreen',
29
- );
27
+ export const isRenderConfigScreenParent =
28
+ buildGuard<RenderConfigScreenMethods>('renderConfigScreen');
30
29
 
31
- export const isRenderModalParent = buildGuard<RenderModalMethods>(
32
- 'renderModal',
33
- );
30
+ export const isRenderModalParent =
31
+ buildGuard<RenderModalMethods>('renderModal');
34
32
 
35
33
  export const isRenderSidebarPanelParent = buildGuard<RenderSidebarPanelMethods>(
36
34
  'renderItemFormSidebarPanel',
37
35
  );
38
36
 
39
- export const isRenderItemFormOutletParent = buildGuard<RenderItemFormOutletMethods>(
40
- 'renderItemFormOutlet',
41
- );
37
+ export const isRenderItemFormOutletParent =
38
+ buildGuard<RenderItemFormOutletMethods>('renderItemFormOutlet');
42
39
 
43
- export const isRenderFieldExtensionParent = buildGuard<RenderFieldExtensionMethods>(
44
- 'renderFieldExtension',
45
- );
40
+ export const isRenderFieldExtensionParent =
41
+ buildGuard<RenderFieldExtensionMethods>('renderFieldExtension');
46
42
 
47
- export const isRenderManualFieldExtensionConfigScreenParent = buildGuard<RenderManualFieldExtensionConfigScreenMethods>(
48
- 'renderManualFieldExtensionConfigScreen',
49
- );
43
+ export const isRenderManualFieldExtensionConfigScreenParent =
44
+ buildGuard<RenderManualFieldExtensionConfigScreenMethods>(
45
+ 'renderManualFieldExtensionConfigScreen',
46
+ );
50
47
 
51
- export const isRenderAssetSourceParent = buildGuard<RenderAssetSourceMethods>(
52
- 'renderAssetSource',
53
- );
48
+ export const isRenderAssetSourceParent =
49
+ buildGuard<RenderAssetSourceMethods>('renderAssetSource');
package/src/types.ts CHANGED
@@ -164,7 +164,8 @@ export type FieldType =
164
164
  /**
165
165
  * Field extensions extend the basic functionality of DatoCMS when it comes to
166
166
  * presenting record's fields to the final user. Depending on the extension type
167
- * (`editor` or `addon`) they will be shown in different places of the interface.
167
+ * (`editor` or `addon`) they will be shown in different places of the
168
+ * interface.
168
169
  */
169
170
  export type ManualFieldExtension = {
170
171
  /**
@@ -198,7 +199,10 @@ export type ManualFieldExtension = {
198
199
  * `validateManualFieldExtensionParameters` methods
199
200
  */
200
201
  configurable?: boolean | { initialHeight: number };
201
- /** The initial height to set for the iframe that will render the field extension */
202
+ /**
203
+ * The initial height to set for the iframe that will render the field
204
+ * extension
205
+ */
202
206
  initialHeight?: number;
203
207
  };
204
208
 
@@ -218,7 +222,8 @@ export type ItemFormSidebarPanel = {
218
222
  label: string;
219
223
  /**
220
224
  * An arbitrary configuration object that will be passed as the `parameters`
221
- * property of the second argument of the `renderItemFormSidebarPanel` function
225
+ * property of the second argument of the `renderItemFormSidebarPanel`
226
+ * function
222
227
  */
223
228
  parameters?: Record<string, unknown>;
224
229
  /** Whether the sidebar panel will start open or collapsed */
@@ -243,7 +248,10 @@ export type ItemFormSidebarPanel = {
243
248
 
244
249
  /** An outlet to be shown at the top of a record's editing page */
245
250
  export type ItemFormOutlet = {
246
- /** ID of the outlet. Will be the first argument for the `renderItemFormOutlet` function */
251
+ /**
252
+ * ID of the outlet. Will be the first argument for the `renderItemFormOutlet`
253
+ * function
254
+ */
247
255
  id: string;
248
256
  /**
249
257
  * Multiple outlets will be sorted by ascending `rank`. If you want to specify
@@ -263,7 +271,10 @@ export type EditorOverride = {
263
271
  * `renderFieldExtension` function
264
272
  */
265
273
  id: string;
266
- /** Moves the field to the sidebar of the record editing page, mimicking a sidebar panel */
274
+ /**
275
+ * Moves the field to the sidebar of the record editing page, mimicking a
276
+ * sidebar panel
277
+ */
267
278
  asSidebarPanel?:
268
279
  | boolean
269
280
  | { startOpen?: boolean; placement?: ItemFormSidebarPanelPlacement };
@@ -280,7 +291,10 @@ export type EditorOverride = {
280
291
  * another plugin!
281
292
  */
282
293
  rank?: number;
283
- /** The initial height to set for the iframe that will render the field extension */
294
+ /**
295
+ * The initial height to set for the iframe that will render the field
296
+ * extension
297
+ */
284
298
  initialHeight?: number;
285
299
  };
286
300
 
@@ -304,7 +318,10 @@ export type AddonOverride = {
304
318
  * the one of another plugin!
305
319
  */
306
320
  rank?: number;
307
- /** The initial height to set for the iframe that will render the field extension */
321
+ /**
322
+ * The initial height to set for the iframe that will render the field
323
+ * extension
324
+ */
308
325
  initialHeight?: number;
309
326
  };
310
327
 
@@ -368,7 +385,10 @@ export type StructuredTextCustomBlockStyle = {
368
385
  rank?: number;
369
386
  };
370
387
 
371
- /** An object expressing some field extensions you want to force on a particular field */
388
+ /**
389
+ * An object expressing some field extensions you want to force on a particular
390
+ * field
391
+ */
372
392
  export type FieldExtensionOverride = {
373
393
  /** Force a field editor/sidebar extension on a field */
374
394
  editor?: EditorOverride;
@@ -452,7 +472,10 @@ export type AssetSource = {
452
472
  modal?: {
453
473
  /** Width of the modal. Can be a number, or one of the predefined sizes */
454
474
  width?: 's' | 'm' | 'l' | 'xl' | number;
455
- /** The initial height to set for the iframe that will render the modal content */
475
+ /**
476
+ * The initial height to set for the iframe that will render the modal
477
+ * content
478
+ */
456
479
  initialHeight?: number;
457
480
  };
458
481
  };
@@ -491,7 +514,10 @@ export type ConfirmChoice = {
491
514
  * clicked by the user
492
515
  */
493
516
  value: unknown;
494
- /** The intent of the button. Will present the button in a different color accent. */
517
+ /**
518
+ * The intent of the button. Will present the button in a different color
519
+ * accent.
520
+ */
495
521
  intent?: 'positive' | 'negative';
496
522
  };
497
523
 
@@ -786,7 +812,10 @@ export type LoadDataMethods = {
786
812
  loadSsoUsers: () => Promise<SsoUser[]>;
787
813
  };
788
814
 
789
- /** These methods let you open the standard DatoCMS dialogs needed to interact with records */
815
+ /**
816
+ * These methods let you open the standard DatoCMS dialogs needed to interact
817
+ * with records
818
+ */
790
819
  export type ItemDialogMethods = {
791
820
  /**
792
821
  * Opens a dialog for creating a new record. It returns a promise resolved
@@ -854,7 +883,10 @@ export type ItemDialogMethods = {
854
883
  editItem: (itemId: string) => Promise<Item | null>;
855
884
  };
856
885
 
857
- /** These methods can be used to show UI-consistent toast notifications to the end-user */
886
+ /**
887
+ * These methods can be used to show UI-consistent toast notifications to the
888
+ * end-user
889
+ */
858
890
  export type ToastMethods = {
859
891
  /**
860
892
  * Triggers an "error" toast displaying the selected message
@@ -887,7 +919,8 @@ export type ToastMethods = {
887
919
  */
888
920
  notice: (message: string) => Promise<void>;
889
921
  /**
890
- * Triggers a custom toast displaying the selected message (and optionally a CTA)
922
+ * Triggers a custom toast displaying the selected message (and optionally a
923
+ * CTA)
891
924
  *
892
925
  * @example
893
926
  *
@@ -941,7 +974,8 @@ export type UploadDialogMethods = {
941
974
  };
942
975
 
943
976
  /**
944
- * Opens a dialog for editing a Media Area asset. It returns a promise resolved with:
977
+ * Opens a dialog for editing a Media Area asset. It returns a promise
978
+ * resolved with:
945
979
  *
946
980
  * - The updated asset, if the user persists some changes to the asset itself
947
981
  * - `null`, if the user closes the dialog without persisting any change
@@ -1096,7 +1130,10 @@ export type RenderMethods = LoadDataMethods &
1096
1130
  export type ItemFormAdditionalProperties = {
1097
1131
  /** The currently active locale for the record */
1098
1132
  locale: string;
1099
- /** If an already persisted record is being edited, returns the full record entity */
1133
+ /**
1134
+ * If an already persisted record is being edited, returns the full record
1135
+ * entity
1136
+ */
1100
1137
  item: Item | null;
1101
1138
  /** The model for the record being edited */
1102
1139
  itemType: ItemType;
@@ -1163,7 +1200,8 @@ export type ItemFormAdditionalMethods = {
1163
1200
  disableField: (path: string, disable: boolean) => Promise<void>;
1164
1201
  /**
1165
1202
  * Smoothly navigates to a specific field in the form. If the field is
1166
- * localized it will switch language tab and then navigate to the chosen field.
1203
+ * localized it will switch language tab and then navigate to the chosen
1204
+ * field.
1167
1205
  *
1168
1206
  * @example
1169
1207
  *
@@ -1250,8 +1288,8 @@ export type RenderItemFormOutletAdditionalMethods = {
1250
1288
  export type RenderItemFormOutletMethods = ItemFormMethods &
1251
1289
  RenderItemFormOutletAdditionalMethods;
1252
1290
 
1253
- export type RenderItemFormOutletPropertiesAndMethods = RenderItemFormOutletMethods &
1254
- RenderItemFormOutletProperties;
1291
+ export type RenderItemFormOutletPropertiesAndMethods =
1292
+ RenderItemFormOutletMethods & RenderItemFormOutletProperties;
1255
1293
 
1256
1294
  /**
1257
1295
  * Information regarding the state of a specific field where you need to render
@@ -1267,7 +1305,10 @@ export type RenderFieldExtensionAdditionalProperties = {
1267
1305
  placeholder: string;
1268
1306
  /** Whether the field is currently disabled or not */
1269
1307
  disabled: boolean;
1270
- /** The path in the `formValues` object where to find the current value for the field */
1308
+ /**
1309
+ * The path in the `formValues` object where to find the current value for the
1310
+ * field
1311
+ */
1271
1312
  fieldPath: string;
1272
1313
  /** The field where the field extension is installed to */
1273
1314
  field: Field;
@@ -1294,15 +1335,18 @@ export type RenderFieldExtensionAdditionalMethods = {
1294
1335
  export type RenderFieldExtensionMethods = ItemFormMethods &
1295
1336
  RenderFieldExtensionAdditionalMethods;
1296
1337
 
1297
- export type RenderFieldExtensionPropertiesAndMethods = RenderFieldExtensionMethods &
1298
- RenderFieldExtensionProperties;
1338
+ export type RenderFieldExtensionPropertiesAndMethods =
1339
+ RenderFieldExtensionMethods & RenderFieldExtensionProperties;
1299
1340
 
1300
1341
  /** Information regarding the specific custom modal that you need to render */
1301
1342
  export type RenderModalAdditionalProperties = {
1302
1343
  mode: 'renderModal';
1303
1344
  /** The ID of the modal that needs to be rendered */
1304
1345
  modalId: string;
1305
- /** The arbitrary `parameters` of the modal declared in the `openModal` function */
1346
+ /**
1347
+ * The arbitrary `parameters` of the modal declared in the `openModal`
1348
+ * function
1349
+ */
1306
1350
  parameters: Record<string, unknown>;
1307
1351
  };
1308
1352
 
@@ -1337,7 +1381,10 @@ export type RenderModalMethods = RenderMethods &
1337
1381
  export type RenderModalPropertiesAndMethods = RenderModalMethods &
1338
1382
  RenderModalProperties;
1339
1383
 
1340
- /** Information regarding the specific asset source browser that you need to render */
1384
+ /**
1385
+ * Information regarding the specific asset source browser that you need to
1386
+ * render
1387
+ */
1341
1388
  export type RenderAssetSourceAdditionalProperties = {
1342
1389
  mode: 'renderAssetSource';
1343
1390
  /** The ID of the assetSource that needs to be rendered */
@@ -1422,8 +1469,7 @@ export type RenderAssetSourceAdditionalMethods = {
1422
1469
  * ```js
1423
1470
  * await ctx.select({
1424
1471
  * resource: {
1425
- * url:
1426
- * 'https://images.unsplash.com/photo-1416339306562-f3d12fefd36f',
1472
+ * url: 'https://images.unsplash.com/photo-1416339306562-f3d12fefd36f',
1427
1473
  * filename: 'man-drinking-coffee.jpg',
1428
1474
  * },
1429
1475
  * copyright: 'Royalty free (Unsplash)',
@@ -1483,7 +1529,10 @@ export type PendingField = {
1483
1529
  */
1484
1530
  export type RenderManualFieldExtensionConfigScreenAdditionalProperties = {
1485
1531
  mode: 'renderManualFieldExtensionConfigScreen';
1486
- /** The ID of the field extension for which we need to render the parameters form */
1532
+ /**
1533
+ * The ID of the field extension for which we need to render the parameters
1534
+ * form
1535
+ */
1487
1536
  fieldExtensionId: string;
1488
1537
  /**
1489
1538
  * The current value of the parameters (you can change the value with the
@@ -1503,8 +1552,8 @@ export type RenderManualFieldExtensionConfigScreenAdditionalProperties = {
1503
1552
  itemType: ItemType;
1504
1553
  };
1505
1554
 
1506
- export type RenderManualFieldExtensionConfigScreenProperties = RenderProperties &
1507
- RenderManualFieldExtensionConfigScreenAdditionalProperties;
1555
+ export type RenderManualFieldExtensionConfigScreenProperties =
1556
+ RenderProperties & RenderManualFieldExtensionConfigScreenAdditionalProperties;
1508
1557
 
1509
1558
  /**
1510
1559
  * These methods can be used to update the configuration object of a specific
@@ -1528,8 +1577,9 @@ export type RenderManualFieldExtensionConfigScreenMethods = RenderMethods &
1528
1577
  IframeMethods &
1529
1578
  RenderManualFieldExtensionConfigScreenAdditionalMethods;
1530
1579
 
1531
- export type RenderManualFieldExtensionConfigScreenPropertiesAndMethods = RenderManualFieldExtensionConfigScreenMethods &
1532
- RenderManualFieldExtensionConfigScreenProperties;
1580
+ export type RenderManualFieldExtensionConfigScreenPropertiesAndMethods =
1581
+ RenderManualFieldExtensionConfigScreenMethods &
1582
+ RenderManualFieldExtensionConfigScreenProperties;
1533
1583
 
1534
1584
  export type RenderConfigScreenAdditionalProperties = {
1535
1585
  mode: 'renderConfigScreen';