datocms-plugin-sdk 0.3.30 → 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.
- package/dist/esm/types.d.ts +28 -1
- package/dist/types/types.d.ts +28 -1
- package/package.json +2 -2
- package/src/types.ts +28 -0
- package/types.json +1028 -931
package/dist/esm/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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.
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"typedoc": "^0.22.8"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "db31347c59fa5ef6bfc050f36ff89f59846a7952"
|
|
45
45
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Account,
|
|
3
3
|
Field,
|
|
4
|
+
Fieldset,
|
|
4
5
|
Item,
|
|
5
6
|
ModelBlock,
|
|
6
7
|
Plugin,
|
|
@@ -460,6 +461,14 @@ export type RenderAdditionalProperties = {
|
|
|
460
461
|
* to load them.
|
|
461
462
|
*/
|
|
462
463
|
fields: Partial<Record<string, Field>>;
|
|
464
|
+
/**
|
|
465
|
+
* All the fieldsets currently loaded for the current DatoCMS project, indexed
|
|
466
|
+
* by ID. It will always contain the current model fields and all the fields
|
|
467
|
+
* of the blocks it might contain via Modular Content/Structured Text fields.
|
|
468
|
+
* If some fields you need are not present, use the `loadItemTypeFieldsets`
|
|
469
|
+
* function to load them.
|
|
470
|
+
*/
|
|
471
|
+
fieldsets: Partial<Record<string, Fieldset>>;
|
|
463
472
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
464
473
|
theme: Theme;
|
|
465
474
|
/**
|
|
@@ -613,6 +622,25 @@ export type LoadDataMethods = {
|
|
|
613
622
|
* ```
|
|
614
623
|
*/
|
|
615
624
|
loadItemTypeFields: (itemTypeId: string) => Promise<Field[]>;
|
|
625
|
+
/**
|
|
626
|
+
* Loads all the fieldsets for a specific model (or block). Fieldsets will be
|
|
627
|
+
* returned and will also be available in the the `fieldsets` property.
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
*
|
|
631
|
+
* ```js
|
|
632
|
+
* const itemTypeId = prompt('Please insert a model ID:');
|
|
633
|
+
*
|
|
634
|
+
* const fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);
|
|
635
|
+
*
|
|
636
|
+
* ctx.notice(
|
|
637
|
+
* `Success! ${fieldsets
|
|
638
|
+
* .map((fieldset) => fieldset.attributes.title)
|
|
639
|
+
* .join(', ')}`,
|
|
640
|
+
* );
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
loadItemTypeFieldsets: (itemTypeId: string) => Promise<Fieldset[]>;
|
|
616
644
|
/**
|
|
617
645
|
* Loads all the fields in the project that are currently using the plugin for
|
|
618
646
|
* one of its manual field extensions.
|