datocms-plugin-sdk 2.0.5 → 2.0.6
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/hooks/assetSources.js +4 -5
- package/dist/cjs/hooks/assetSources.js.map +1 -1
- package/dist/cjs/hooks/buildItemPresentationInfo.js +4 -5
- package/dist/cjs/hooks/buildItemPresentationInfo.js.map +1 -1
- package/dist/cjs/hooks/contentAreaSidebarItems.js +4 -5
- package/dist/cjs/hooks/contentAreaSidebarItems.js.map +1 -1
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js +4 -5
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js.map +1 -1
- package/dist/cjs/hooks/customMarksForStructuredTextField.js +4 -5
- package/dist/cjs/hooks/customMarksForStructuredTextField.js.map +1 -1
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js +4 -5
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js.map +1 -1
- package/dist/cjs/hooks/itemCollectionOutlets.js +4 -5
- package/dist/cjs/hooks/itemCollectionOutlets.js.map +1 -1
- package/dist/cjs/hooks/itemFormOutlets.js +4 -5
- package/dist/cjs/hooks/itemFormOutlets.js.map +1 -1
- package/dist/cjs/hooks/itemFormSidebarPanels.js +4 -5
- package/dist/cjs/hooks/itemFormSidebarPanels.js.map +1 -1
- package/dist/cjs/hooks/itemFormSidebars.js +4 -5
- package/dist/cjs/hooks/itemFormSidebars.js.map +1 -1
- package/dist/cjs/hooks/mainNavigationTabs.js +4 -5
- package/dist/cjs/hooks/mainNavigationTabs.js.map +1 -1
- package/dist/cjs/hooks/manualFieldExtensions.js +4 -5
- package/dist/cjs/hooks/manualFieldExtensions.js.map +1 -1
- package/dist/cjs/hooks/overrideFieldExtensions.js +4 -15
- package/dist/cjs/hooks/overrideFieldExtensions.js.map +1 -1
- package/dist/cjs/hooks/uploadSidebarPanels.js +4 -5
- package/dist/cjs/hooks/uploadSidebarPanels.js.map +1 -1
- package/dist/cjs/hooks/uploadSidebars.js +4 -5
- package/dist/cjs/hooks/uploadSidebars.js.map +1 -1
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js +5 -0
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js.map +1 -1
- package/dist/cjs/manifest.js +14 -14
- package/dist/cjs/manifest.js.map +1 -1
- package/dist/cjs/shared.js +6 -0
- package/dist/cjs/shared.js.map +1 -1
- package/dist/esm/hooks/assetSources.d.ts +1 -5
- package/dist/esm/hooks/assetSources.js +4 -6
- package/dist/esm/hooks/assetSources.js.map +1 -1
- package/dist/esm/hooks/buildItemPresentationInfo.d.ts +1 -5
- package/dist/esm/hooks/buildItemPresentationInfo.js +3 -5
- package/dist/esm/hooks/buildItemPresentationInfo.js.map +1 -1
- package/dist/esm/hooks/contentAreaSidebarItems.d.ts +1 -5
- package/dist/esm/hooks/contentAreaSidebarItems.js +4 -6
- package/dist/esm/hooks/contentAreaSidebarItems.js.map +1 -1
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.d.ts +1 -5
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js +4 -6
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js.map +1 -1
- package/dist/esm/hooks/customMarksForStructuredTextField.d.ts +1 -5
- package/dist/esm/hooks/customMarksForStructuredTextField.js +4 -6
- package/dist/esm/hooks/customMarksForStructuredTextField.js.map +1 -1
- package/dist/esm/hooks/initialLocationQueryForItemSelector.d.ts +1 -5
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js +3 -5
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js.map +1 -1
- package/dist/esm/hooks/itemCollectionOutlets.d.ts +1 -5
- package/dist/esm/hooks/itemCollectionOutlets.js +4 -6
- package/dist/esm/hooks/itemCollectionOutlets.js.map +1 -1
- package/dist/esm/hooks/itemFormOutlets.d.ts +1 -5
- package/dist/esm/hooks/itemFormOutlets.js +4 -6
- package/dist/esm/hooks/itemFormOutlets.js.map +1 -1
- package/dist/esm/hooks/itemFormSidebarPanels.d.ts +1 -5
- package/dist/esm/hooks/itemFormSidebarPanels.js +4 -6
- package/dist/esm/hooks/itemFormSidebarPanels.js.map +1 -1
- package/dist/esm/hooks/itemFormSidebars.d.ts +1 -5
- package/dist/esm/hooks/itemFormSidebars.js +4 -6
- package/dist/esm/hooks/itemFormSidebars.js.map +1 -1
- package/dist/esm/hooks/mainNavigationTabs.d.ts +1 -5
- package/dist/esm/hooks/mainNavigationTabs.js +4 -6
- package/dist/esm/hooks/mainNavigationTabs.js.map +1 -1
- package/dist/esm/hooks/manualFieldExtensions.d.ts +1 -5
- package/dist/esm/hooks/manualFieldExtensions.js +3 -5
- package/dist/esm/hooks/manualFieldExtensions.js.map +1 -1
- package/dist/esm/hooks/overrideFieldExtensions.d.ts +1 -15
- package/dist/esm/hooks/overrideFieldExtensions.js +3 -15
- package/dist/esm/hooks/overrideFieldExtensions.js.map +1 -1
- package/dist/esm/hooks/uploadSidebarPanels.d.ts +1 -5
- package/dist/esm/hooks/uploadSidebarPanels.js +4 -6
- package/dist/esm/hooks/uploadSidebarPanels.js.map +1 -1
- package/dist/esm/hooks/uploadSidebars.d.ts +1 -5
- package/dist/esm/hooks/uploadSidebars.js +4 -6
- package/dist/esm/hooks/uploadSidebars.js.map +1 -1
- package/dist/esm/hooks/validateManualFieldExtensionParameters.d.ts +1 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js +4 -1
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js.map +1 -1
- package/dist/esm/manifest.js +14 -14
- package/dist/esm/manifest.js.map +1 -1
- package/dist/esm/shared.d.ts +1 -0
- package/dist/esm/shared.js +5 -0
- package/dist/esm/shared.js.map +1 -1
- package/dist/types/hooks/assetSources.d.ts +1 -5
- package/dist/types/hooks/buildItemPresentationInfo.d.ts +1 -5
- package/dist/types/hooks/contentAreaSidebarItems.d.ts +1 -5
- package/dist/types/hooks/customBlockStylesForStructuredTextField.d.ts +1 -5
- package/dist/types/hooks/customMarksForStructuredTextField.d.ts +1 -5
- package/dist/types/hooks/initialLocationQueryForItemSelector.d.ts +1 -5
- package/dist/types/hooks/itemCollectionOutlets.d.ts +1 -5
- package/dist/types/hooks/itemFormOutlets.d.ts +1 -5
- package/dist/types/hooks/itemFormSidebarPanels.d.ts +1 -5
- package/dist/types/hooks/itemFormSidebars.d.ts +1 -5
- package/dist/types/hooks/mainNavigationTabs.d.ts +1 -5
- package/dist/types/hooks/manualFieldExtensions.d.ts +1 -5
- package/dist/types/hooks/overrideFieldExtensions.d.ts +1 -15
- package/dist/types/hooks/uploadSidebarPanels.d.ts +1 -5
- package/dist/types/hooks/uploadSidebars.d.ts +1 -5
- package/dist/types/hooks/validateManualFieldExtensionParameters.d.ts +1 -0
- package/dist/types/shared.d.ts +1 -0
- package/manifest.json +14 -14
- package/package.json +2 -2
- package/src/hooks/assetSources.ts +13 -6
- package/src/hooks/buildItemPresentationInfo.ts +6 -5
- package/src/hooks/contentAreaSidebarItems.ts +7 -5
- package/src/hooks/customBlockStylesForStructuredTextField.ts +13 -6
- package/src/hooks/customMarksForStructuredTextField.ts +7 -5
- package/src/hooks/initialLocationQueryForItemSelector.ts +6 -5
- package/src/hooks/itemCollectionOutlets.ts +13 -6
- package/src/hooks/itemFormOutlets.ts +13 -6
- package/src/hooks/itemFormSidebarPanels.ts +7 -5
- package/src/hooks/itemFormSidebars.ts +13 -6
- package/src/hooks/mainNavigationTabs.ts +7 -5
- package/src/hooks/manualFieldExtensions.ts +6 -5
- package/src/hooks/overrideFieldExtensions.ts +6 -15
- package/src/hooks/uploadSidebarPanels.ts +7 -5
- package/src/hooks/uploadSidebars.ts +13 -6
- package/src/hooks/validateManualFieldExtensionParameters.ts +8 -0
- package/src/manifest.ts +14 -14
- package/src/shared.ts +10 -0
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Ctx } from '../ctx/base';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isArray,
|
|
4
|
+
isNullish,
|
|
5
|
+
isNumber,
|
|
6
|
+
isRecord,
|
|
7
|
+
isString,
|
|
8
|
+
} from '../guardUtils.js';
|
|
3
9
|
import { Icon, isIcon } from '../icon';
|
|
4
10
|
|
|
5
11
|
export type AssetSourcesHook = {
|
|
@@ -49,11 +55,6 @@ export type AssetSource = {
|
|
|
49
55
|
};
|
|
50
56
|
};
|
|
51
57
|
|
|
52
|
-
/**
|
|
53
|
-
* Type guard for AssetSource.
|
|
54
|
-
* @param value - The value to check.
|
|
55
|
-
* @returns true if the value is an AssetSource, false otherwise.
|
|
56
|
-
*/
|
|
57
58
|
export function isAssetSource(value: unknown): value is AssetSource {
|
|
58
59
|
if (isNullish(value)) return false;
|
|
59
60
|
if (!isRecord(value)) return false;
|
|
@@ -73,3 +74,9 @@ export function isAssetSource(value: unknown): value is AssetSource {
|
|
|
73
74
|
(isNullish(modal.initialHeight) || isNumber(modal.initialHeight))))
|
|
74
75
|
);
|
|
75
76
|
}
|
|
77
|
+
|
|
78
|
+
export function isReturnTypeOfAssetSourcesHook(
|
|
79
|
+
value: unknown,
|
|
80
|
+
): value is AssetSource[] | undefined {
|
|
81
|
+
return isNullish(value) || isArray(value, isAssetSource);
|
|
82
|
+
}
|
|
@@ -40,11 +40,6 @@ export type ItemPresentationInfo = {
|
|
|
40
40
|
rank?: number;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* Checks if the value is an ItemPresentationInfo type.
|
|
45
|
-
* @param value The value to check.
|
|
46
|
-
* @returns True if the value is an ItemPresentationInfo, false otherwise.
|
|
47
|
-
*/
|
|
48
43
|
export function isItemPresentationInfo(
|
|
49
44
|
value: unknown,
|
|
50
45
|
): value is ItemPresentationInfo {
|
|
@@ -55,3 +50,9 @@ export function isItemPresentationInfo(
|
|
|
55
50
|
(isNullish(value.rank) || isNumber(value.rank))
|
|
56
51
|
);
|
|
57
52
|
}
|
|
53
|
+
|
|
54
|
+
export function isReturnTypeOfBuildItemPresentationInfoHook(
|
|
55
|
+
value: unknown,
|
|
56
|
+
): value is ItemPresentationInfo | undefined {
|
|
57
|
+
return isNullish(value) || isItemPresentationInfo(value);
|
|
58
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ctx } from '../ctx/base';
|
|
2
2
|
import {
|
|
3
|
+
isArray,
|
|
3
4
|
isNullish,
|
|
4
5
|
isNumber,
|
|
5
6
|
isPlacement,
|
|
@@ -56,11 +57,6 @@ export type ContentAreaSidebarItem = {
|
|
|
56
57
|
rank?: number;
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
/**
|
|
60
|
-
* Checks if the value is a ContentAreaSidebarItem.
|
|
61
|
-
* @param value - The value to check.
|
|
62
|
-
* @returns True if the value is a ContentAreaSidebarItem, false otherwise.
|
|
63
|
-
*/
|
|
64
60
|
export function isContentAreaSidebarItem(
|
|
65
61
|
value: unknown,
|
|
66
62
|
): value is ContentAreaSidebarItem {
|
|
@@ -74,3 +70,9 @@ export function isContentAreaSidebarItem(
|
|
|
74
70
|
(isNullish(value.rank) || isNumber(value.rank))
|
|
75
71
|
);
|
|
76
72
|
}
|
|
73
|
+
|
|
74
|
+
export function isReturnTypeOfContentAreaSidebarItemsHook(
|
|
75
|
+
value: unknown,
|
|
76
|
+
): value is ContentAreaSidebarItem[] {
|
|
77
|
+
return isArray(value, isContentAreaSidebarItem);
|
|
78
|
+
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
2
|
import { BlockNodeTypeWithCustomStyle } from 'datocms-structured-text-utils';
|
|
3
3
|
import { Ctx } from '../ctx/base';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isArray,
|
|
6
|
+
isNullish,
|
|
7
|
+
isNumber,
|
|
8
|
+
isRecord,
|
|
9
|
+
isString,
|
|
10
|
+
} from '../guardUtils.js';
|
|
5
11
|
|
|
6
12
|
type Field = SchemaTypes.Field;
|
|
7
13
|
type ItemType = SchemaTypes.ItemType;
|
|
@@ -46,11 +52,6 @@ export type StructuredTextCustomBlockStyle = {
|
|
|
46
52
|
rank?: number;
|
|
47
53
|
};
|
|
48
54
|
|
|
49
|
-
/**
|
|
50
|
-
* Checks if the given value is a StructuredTextCustomBlockStyle.
|
|
51
|
-
* @param value - The value to check.
|
|
52
|
-
* @returns True if the value is a StructuredTextCustomBlockStyle, otherwise false.
|
|
53
|
-
*/
|
|
54
55
|
export function isStructuredTextCustomBlockStyle(
|
|
55
56
|
value: unknown,
|
|
56
57
|
): value is StructuredTextCustomBlockStyle {
|
|
@@ -62,3 +63,9 @@ export function isStructuredTextCustomBlockStyle(
|
|
|
62
63
|
(isNullish(value.rank) || isNumber(value.rank))
|
|
63
64
|
);
|
|
64
65
|
}
|
|
66
|
+
|
|
67
|
+
export function isReturnTypeOfCustomBlockStylesForStructuredTextFieldHook(
|
|
68
|
+
value: unknown,
|
|
69
|
+
): value is StructuredTextCustomBlockStyle[] | undefined {
|
|
70
|
+
return isNullish(value) || isArray(value, isStructuredTextCustomBlockStyle);
|
|
71
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
2
|
import { Ctx } from '../ctx/base';
|
|
3
3
|
import {
|
|
4
|
+
isArray,
|
|
4
5
|
isNullish,
|
|
5
6
|
isNumber,
|
|
6
7
|
isPlacement,
|
|
@@ -74,11 +75,6 @@ export type StructuredTextCustomMarkPlacement = [
|
|
|
74
75
|
'strong' | 'emphasis' | 'underline' | 'code' | 'highlight' | 'strikethrough',
|
|
75
76
|
];
|
|
76
77
|
|
|
77
|
-
/**
|
|
78
|
-
* Checks if the given value is a StructuredTextCustomMark.
|
|
79
|
-
* @param value The value to check.
|
|
80
|
-
* @returns True if the value is a StructuredTextCustomMark, false otherwise.
|
|
81
|
-
*/
|
|
82
78
|
export function isStructuredTextCustomMark(
|
|
83
79
|
value: unknown,
|
|
84
80
|
): value is StructuredTextCustomMark {
|
|
@@ -93,3 +89,9 @@ export function isStructuredTextCustomMark(
|
|
|
93
89
|
isRecord(value.appliedStyle)
|
|
94
90
|
);
|
|
95
91
|
}
|
|
92
|
+
|
|
93
|
+
export function isReturnTypeOfCustomMarksForStructuredTextFieldHook(
|
|
94
|
+
value: unknown,
|
|
95
|
+
): value is StructuredTextCustomMark[] | undefined {
|
|
96
|
+
return isNullish(value) || isArray(value, isStructuredTextCustomMark);
|
|
97
|
+
}
|
|
@@ -39,11 +39,6 @@ export type InitialLocationQueryForItemSelector = {
|
|
|
39
39
|
rank?: number;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* Type guard for InitialLocationQueryForItemSelector
|
|
44
|
-
* @param value - The value to check
|
|
45
|
-
* @returns True if value is of type InitialLocationQueryForItemSelector, false otherwise
|
|
46
|
-
*/
|
|
47
42
|
export function isInitialLocationQueryForItemSelector(
|
|
48
43
|
value: unknown,
|
|
49
44
|
): value is InitialLocationQueryForItemSelector {
|
|
@@ -53,3 +48,9 @@ export function isInitialLocationQueryForItemSelector(
|
|
|
53
48
|
(isNullish(value.rank) || isNumber(value.rank))
|
|
54
49
|
);
|
|
55
50
|
}
|
|
51
|
+
|
|
52
|
+
export function isReturnTypeOfInitialLocationQueryForItemSelectorHook(
|
|
53
|
+
value: unknown,
|
|
54
|
+
): value is InitialLocationQueryForItemSelector | undefined {
|
|
55
|
+
return isNullish(value) || isInitialLocationQueryForItemSelector(value);
|
|
56
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
2
|
import { Ctx } from '../ctx/base';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isArray,
|
|
5
|
+
isNullish,
|
|
6
|
+
isNumber,
|
|
7
|
+
isRecord,
|
|
8
|
+
isString,
|
|
9
|
+
} from '../guardUtils.js';
|
|
4
10
|
|
|
5
11
|
type ItemType = SchemaTypes.ItemType;
|
|
6
12
|
|
|
@@ -41,11 +47,6 @@ export type ItemCollectionOutlet = {
|
|
|
41
47
|
initialHeight?: number;
|
|
42
48
|
};
|
|
43
49
|
|
|
44
|
-
/**
|
|
45
|
-
* Checks if the given value is an ItemCollectionOutlet.
|
|
46
|
-
* @param value - The value to check.
|
|
47
|
-
* @returns True if the value is an ItemCollectionOutlet, false otherwise.
|
|
48
|
-
*/
|
|
49
50
|
export function isItemCollectionOutlet(
|
|
50
51
|
value: unknown,
|
|
51
52
|
): value is ItemCollectionOutlet {
|
|
@@ -56,3 +57,9 @@ export function isItemCollectionOutlet(
|
|
|
56
57
|
(isNullish(value.initialHeight) || isNumber(value.initialHeight))
|
|
57
58
|
);
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
export function isReturnTypeOfItemCollectionOutletsHook(
|
|
62
|
+
value: unknown,
|
|
63
|
+
): value is ItemCollectionOutlet[] {
|
|
64
|
+
return isArray(value, isItemCollectionOutlet);
|
|
65
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
2
|
import { Ctx } from '../ctx/base';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isArray,
|
|
5
|
+
isNullish,
|
|
6
|
+
isNumber,
|
|
7
|
+
isRecord,
|
|
8
|
+
isString,
|
|
9
|
+
} from '../guardUtils.js';
|
|
4
10
|
|
|
5
11
|
type ItemType = SchemaTypes.ItemType;
|
|
6
12
|
|
|
@@ -41,11 +47,6 @@ export type ItemFormOutlet = {
|
|
|
41
47
|
initialHeight?: number;
|
|
42
48
|
};
|
|
43
49
|
|
|
44
|
-
/**
|
|
45
|
-
* Checks if the given value is an ItemFormOutlet.
|
|
46
|
-
* @param value - The value to check.
|
|
47
|
-
* @returns True if the value is an ItemFormOutlet, false otherwise.
|
|
48
|
-
*/
|
|
49
50
|
export function isItemFormOutlet(value: unknown): value is ItemFormOutlet {
|
|
50
51
|
return (
|
|
51
52
|
isRecord(value) &&
|
|
@@ -54,3 +55,9 @@ export function isItemFormOutlet(value: unknown): value is ItemFormOutlet {
|
|
|
54
55
|
(isNullish(value.initialHeight) || isNumber(value.initialHeight))
|
|
55
56
|
);
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
export function isReturnTypeOfItemFormOutletsHook(
|
|
60
|
+
value: unknown,
|
|
61
|
+
): value is ItemFormOutlet[] {
|
|
62
|
+
return isArray(value, isItemFormOutlet);
|
|
63
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
2
|
import { Ctx } from '../ctx/base';
|
|
3
3
|
import {
|
|
4
|
+
isArray,
|
|
4
5
|
isBoolean,
|
|
5
6
|
isNullish,
|
|
6
7
|
isNumber,
|
|
@@ -67,11 +68,6 @@ export type ItemFormSidebarPanel = {
|
|
|
67
68
|
initialHeight?: number;
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
/**
|
|
71
|
-
* Checks if the given value is an ItemFormSidebarPanel.
|
|
72
|
-
* @param value - The value to check.
|
|
73
|
-
* @returns True if the value is an ItemFormSidebarPanel, false otherwise.
|
|
74
|
-
*/
|
|
75
71
|
export function isItemFormSidebarPanel(
|
|
76
72
|
value: unknown,
|
|
77
73
|
): value is ItemFormSidebarPanel {
|
|
@@ -86,3 +82,9 @@ export function isItemFormSidebarPanel(
|
|
|
86
82
|
(isNullish(value.initialHeight) || isNumber(value.initialHeight))
|
|
87
83
|
);
|
|
88
84
|
}
|
|
85
|
+
|
|
86
|
+
export function isReturnTypeOfItemFormSidebarPanelsHook(
|
|
87
|
+
value: unknown,
|
|
88
|
+
): value is ItemFormSidebarPanel[] {
|
|
89
|
+
return isArray(value, isItemFormSidebarPanel);
|
|
90
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@datocms/cma-client';
|
|
2
2
|
import { Ctx } from '../ctx/base';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isArray,
|
|
5
|
+
isNullish,
|
|
6
|
+
isNumber,
|
|
7
|
+
isRecord,
|
|
8
|
+
isString,
|
|
9
|
+
} from '../guardUtils.js';
|
|
4
10
|
|
|
5
11
|
type ItemType = SchemaTypes.ItemType;
|
|
6
12
|
|
|
@@ -50,11 +56,6 @@ export type ItemFormSidebar = {
|
|
|
50
56
|
preferredWidth?: number;
|
|
51
57
|
};
|
|
52
58
|
|
|
53
|
-
/**
|
|
54
|
-
* Type guard to check if the value is an ItemFormSidebar.
|
|
55
|
-
* @param value - The value to check.
|
|
56
|
-
* @returns true if the value is an ItemFormSidebar, false otherwise.
|
|
57
|
-
*/
|
|
58
59
|
export function isItemFormSidebar(value: unknown): value is ItemFormSidebar {
|
|
59
60
|
return (
|
|
60
61
|
isRecord(value) &&
|
|
@@ -65,3 +66,9 @@ export function isItemFormSidebar(value: unknown): value is ItemFormSidebar {
|
|
|
65
66
|
(isNullish(value.preferredWidth) || isNumber(value.preferredWidth))
|
|
66
67
|
);
|
|
67
68
|
}
|
|
69
|
+
|
|
70
|
+
export function isReturnTypeOfItemFormSidebarsHook(
|
|
71
|
+
value: unknown,
|
|
72
|
+
): value is ItemFormSidebar[] {
|
|
73
|
+
return isArray(value, isItemFormSidebar);
|
|
74
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ctx } from '../ctx/base';
|
|
2
2
|
import {
|
|
3
|
+
isArray,
|
|
3
4
|
isNullish,
|
|
4
5
|
isNumber,
|
|
5
6
|
isPlacement,
|
|
@@ -57,11 +58,6 @@ export type MainNavigationTab = {
|
|
|
57
58
|
rank?: number;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
/**
|
|
61
|
-
* Checks if the given value is a MainNavigationTab.
|
|
62
|
-
* @param value The value to check.
|
|
63
|
-
* @returns True if the value is a MainNavigationTab, false otherwise.
|
|
64
|
-
*/
|
|
65
61
|
export function isMainNavigationTab(
|
|
66
62
|
value: unknown,
|
|
67
63
|
): value is MainNavigationTab {
|
|
@@ -75,3 +71,9 @@ export function isMainNavigationTab(
|
|
|
75
71
|
(isNullish(value.rank) || isNumber(value.rank))
|
|
76
72
|
);
|
|
77
73
|
}
|
|
74
|
+
|
|
75
|
+
export function isReturnTypeOfMainNavigationTabsHook(
|
|
76
|
+
value: unknown,
|
|
77
|
+
): value is MainNavigationTab[] {
|
|
78
|
+
return isArray(value, isMainNavigationTab);
|
|
79
|
+
}
|
|
@@ -95,11 +95,6 @@ export type FieldType =
|
|
|
95
95
|
| 'text'
|
|
96
96
|
| 'video';
|
|
97
97
|
|
|
98
|
-
/**
|
|
99
|
-
* Checks if the provided value is a ManualFieldExtension.
|
|
100
|
-
* @param value - The value to check.
|
|
101
|
-
* @returns True if the value is a ManualFieldExtension, otherwise false.
|
|
102
|
-
*/
|
|
103
98
|
export function isManualFieldExtension(
|
|
104
99
|
value: unknown,
|
|
105
100
|
): value is ManualFieldExtension {
|
|
@@ -122,3 +117,9 @@ export function isManualFieldExtension(
|
|
|
122
117
|
(isNullish(value.initialHeight) || isNumber(value.initialHeight))
|
|
123
118
|
);
|
|
124
119
|
}
|
|
120
|
+
|
|
121
|
+
export function isReturnTypeOfManualFieldExtensionsHook(
|
|
122
|
+
value: unknown,
|
|
123
|
+
): value is ManualFieldExtension[] {
|
|
124
|
+
return isArray(value, isManualFieldExtension);
|
|
125
|
+
}
|
|
@@ -105,11 +105,6 @@ export type AddonOverride = {
|
|
|
105
105
|
initialHeight?: number;
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
/**
|
|
109
|
-
* Checks if the value is a FieldExtensionOverride.
|
|
110
|
-
* @param value The value to check.
|
|
111
|
-
* @returns True if the value is a FieldExtensionOverride, false otherwise.
|
|
112
|
-
*/
|
|
113
108
|
export function isFieldExtensionOverride(
|
|
114
109
|
value: unknown,
|
|
115
110
|
): value is FieldExtensionOverride {
|
|
@@ -121,11 +116,6 @@ export function isFieldExtensionOverride(
|
|
|
121
116
|
);
|
|
122
117
|
}
|
|
123
118
|
|
|
124
|
-
/**
|
|
125
|
-
* Checks if the value is an EditorOverride.
|
|
126
|
-
* @param value The value to check.
|
|
127
|
-
* @returns True if the value is an EditorOverride, false otherwise.
|
|
128
|
-
*/
|
|
129
119
|
export function isEditorOverride(value: unknown): value is EditorOverride {
|
|
130
120
|
return (
|
|
131
121
|
isRecord(value) &&
|
|
@@ -143,11 +133,6 @@ export function isEditorOverride(value: unknown): value is EditorOverride {
|
|
|
143
133
|
);
|
|
144
134
|
}
|
|
145
135
|
|
|
146
|
-
/**
|
|
147
|
-
* Checks if the value is an AddonOverride.
|
|
148
|
-
* @param value The value to check.
|
|
149
|
-
* @returns True if the value is an AddonOverride, false otherwise.
|
|
150
|
-
*/
|
|
151
136
|
export function isAddonOverride(value: unknown): value is AddonOverride {
|
|
152
137
|
return (
|
|
153
138
|
isRecord(value) &&
|
|
@@ -157,3 +142,9 @@ export function isAddonOverride(value: unknown): value is AddonOverride {
|
|
|
157
142
|
(isNullish(value.initialHeight) || isNumber(value.initialHeight))
|
|
158
143
|
);
|
|
159
144
|
}
|
|
145
|
+
|
|
146
|
+
export function isReturnTypeOfOverrideFieldExtensionsHook(
|
|
147
|
+
value: unknown,
|
|
148
|
+
): value is FieldExtensionOverride | undefined {
|
|
149
|
+
return isNullish(value) || isFieldExtensionOverride(value);
|
|
150
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ctx } from '../ctx/base';
|
|
2
2
|
import {
|
|
3
|
+
isArray,
|
|
3
4
|
isBoolean,
|
|
4
5
|
isNullish,
|
|
5
6
|
isNumber,
|
|
@@ -72,11 +73,6 @@ export type UploadSidebarPanelPlacement = [
|
|
|
72
73
|
),
|
|
73
74
|
];
|
|
74
75
|
|
|
75
|
-
/**
|
|
76
|
-
* Type guard for UploadSidebarPanel
|
|
77
|
-
* @param value - The value to check
|
|
78
|
-
* @returns True if the value is an UploadSidebarPanel
|
|
79
|
-
*/
|
|
80
76
|
export function isUploadSidebarPanel(
|
|
81
77
|
value: unknown,
|
|
82
78
|
): value is UploadSidebarPanel {
|
|
@@ -91,3 +87,9 @@ export function isUploadSidebarPanel(
|
|
|
91
87
|
(isNullish(value.initialHeight) || isNumber(value.initialHeight))
|
|
92
88
|
);
|
|
93
89
|
}
|
|
90
|
+
|
|
91
|
+
export function isReturnTypeOfUploadSidebarPanelsHook(
|
|
92
|
+
value: unknown,
|
|
93
|
+
): value is UploadSidebarPanel[] {
|
|
94
|
+
return isArray(value, isUploadSidebarPanel);
|
|
95
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Ctx } from '../ctx/base';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isArray,
|
|
4
|
+
isNullish,
|
|
5
|
+
isNumber,
|
|
6
|
+
isRecord,
|
|
7
|
+
isString,
|
|
8
|
+
} from '../guardUtils.js';
|
|
3
9
|
|
|
4
10
|
export type UploadSidebarsHook = {
|
|
5
11
|
/**
|
|
@@ -44,11 +50,6 @@ export type UploadSidebar = {
|
|
|
44
50
|
preferredWidth?: number;
|
|
45
51
|
};
|
|
46
52
|
|
|
47
|
-
/**
|
|
48
|
-
* Checks if the provided value is an UploadSidebar.
|
|
49
|
-
* @param value - The value to check.
|
|
50
|
-
* @returns True if the value is an UploadSidebar, otherwise false.
|
|
51
|
-
*/
|
|
52
53
|
export function isUploadSidebar(value: unknown): value is UploadSidebar {
|
|
53
54
|
return (
|
|
54
55
|
isRecord(value) &&
|
|
@@ -59,3 +60,9 @@ export function isUploadSidebar(value: unknown): value is UploadSidebar {
|
|
|
59
60
|
(isNullish(value.preferredWidth) || isNumber(value.preferredWidth))
|
|
60
61
|
);
|
|
61
62
|
}
|
|
63
|
+
|
|
64
|
+
export function isReturnTypeOfUploadSidebarsHook(
|
|
65
|
+
value: unknown,
|
|
66
|
+
): value is UploadSidebar[] {
|
|
67
|
+
return isArray(value, isUploadSidebar);
|
|
68
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isRecord } from '../guardUtils';
|
|
2
|
+
|
|
1
3
|
export type ValidateManualFieldExtensionParametersHook = {
|
|
2
4
|
/**
|
|
3
5
|
* This function will be called each time the configuration object changes. It
|
|
@@ -10,3 +12,9 @@ export type ValidateManualFieldExtensionParametersHook = {
|
|
|
10
12
|
parameters: Record<string, unknown>,
|
|
11
13
|
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
12
14
|
};
|
|
15
|
+
|
|
16
|
+
export function isReturnTypeOfValidateManualFieldExtensionParametersHook(
|
|
17
|
+
value: unknown,
|
|
18
|
+
): value is Record<string, unknown> {
|
|
19
|
+
return isRecord(value);
|
|
20
|
+
}
|
package/src/manifest.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const manifest: Manifest = {
|
|
|
22
22
|
returnType: 'Record<string, unknown> | Promise<Record<string, unknown>>',
|
|
23
23
|
location: {
|
|
24
24
|
filePath: 'src/hooks/validateManualFieldExtensionParameters.ts',
|
|
25
|
-
lineNumber:
|
|
25
|
+
lineNumber: 10,
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
uploadsDropdownActions: {
|
|
@@ -60,7 +60,7 @@ export const manifest: Manifest = {
|
|
|
60
60
|
returnType: 'UploadSidebar[]',
|
|
61
61
|
location: {
|
|
62
62
|
filePath: 'src/hooks/uploadSidebars.ts',
|
|
63
|
-
lineNumber:
|
|
63
|
+
lineNumber: 17,
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
uploadSidebarPanels: {
|
|
@@ -79,7 +79,7 @@ export const manifest: Manifest = {
|
|
|
79
79
|
returnType: 'UploadSidebarPanel[]',
|
|
80
80
|
location: {
|
|
81
81
|
filePath: 'src/hooks/uploadSidebarPanels.ts',
|
|
82
|
-
lineNumber:
|
|
82
|
+
lineNumber: 19,
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
settingsAreaSidebarItemGroups: {
|
|
@@ -1766,7 +1766,7 @@ export const manifest: Manifest = {
|
|
|
1766
1766
|
returnType: 'MainNavigationTab[]',
|
|
1767
1767
|
location: {
|
|
1768
1768
|
filePath: 'src/hooks/mainNavigationTabs.ts',
|
|
1769
|
-
lineNumber:
|
|
1769
|
+
lineNumber: 19,
|
|
1770
1770
|
},
|
|
1771
1771
|
},
|
|
1772
1772
|
itemsDropdownActions: {
|
|
@@ -1826,7 +1826,7 @@ export const manifest: Manifest = {
|
|
|
1826
1826
|
returnType: 'ItemFormSidebar[]',
|
|
1827
1827
|
location: {
|
|
1828
1828
|
filePath: 'src/hooks/itemFormSidebars.ts',
|
|
1829
|
-
lineNumber:
|
|
1829
|
+
lineNumber: 20,
|
|
1830
1830
|
},
|
|
1831
1831
|
},
|
|
1832
1832
|
itemFormSidebarPanels: {
|
|
@@ -1850,7 +1850,7 @@ export const manifest: Manifest = {
|
|
|
1850
1850
|
returnType: 'ItemFormSidebarPanel[]',
|
|
1851
1851
|
location: {
|
|
1852
1852
|
filePath: 'src/hooks/itemFormSidebarPanels.ts',
|
|
1853
|
-
lineNumber:
|
|
1853
|
+
lineNumber: 23,
|
|
1854
1854
|
},
|
|
1855
1855
|
},
|
|
1856
1856
|
itemFormOutlets: {
|
|
@@ -1874,7 +1874,7 @@ export const manifest: Manifest = {
|
|
|
1874
1874
|
returnType: 'ItemFormOutlet[]',
|
|
1875
1875
|
location: {
|
|
1876
1876
|
filePath: 'src/hooks/itemFormOutlets.ts',
|
|
1877
|
-
lineNumber:
|
|
1877
|
+
lineNumber: 20,
|
|
1878
1878
|
},
|
|
1879
1879
|
},
|
|
1880
1880
|
itemFormDropdownActions: {
|
|
@@ -2017,7 +2017,7 @@ export const manifest: Manifest = {
|
|
|
2017
2017
|
returnType: 'ItemCollectionOutlet[]',
|
|
2018
2018
|
location: {
|
|
2019
2019
|
filePath: 'src/hooks/itemCollectionOutlets.ts',
|
|
2020
|
-
lineNumber:
|
|
2020
|
+
lineNumber: 20,
|
|
2021
2021
|
},
|
|
2022
2022
|
},
|
|
2023
2023
|
initialLocationQueryForItemSelector: {
|
|
@@ -2851,7 +2851,7 @@ export const manifest: Manifest = {
|
|
|
2851
2851
|
itemType: {
|
|
2852
2852
|
location: {
|
|
2853
2853
|
filePath: 'src/hooks/customMarksForStructuredTextField.ts',
|
|
2854
|
-
lineNumber:
|
|
2854
|
+
lineNumber: 30,
|
|
2855
2855
|
},
|
|
2856
2856
|
type: 'ItemType',
|
|
2857
2857
|
},
|
|
@@ -2863,7 +2863,7 @@ export const manifest: Manifest = {
|
|
|
2863
2863
|
returnType: 'StructuredTextCustomMark[] | undefined',
|
|
2864
2864
|
location: {
|
|
2865
2865
|
filePath: 'src/hooks/customMarksForStructuredTextField.ts',
|
|
2866
|
-
lineNumber:
|
|
2866
|
+
lineNumber: 23,
|
|
2867
2867
|
},
|
|
2868
2868
|
},
|
|
2869
2869
|
customBlockStylesForStructuredTextField: {
|
|
@@ -2888,7 +2888,7 @@ export const manifest: Manifest = {
|
|
|
2888
2888
|
location: {
|
|
2889
2889
|
filePath:
|
|
2890
2890
|
'src/hooks/customBlockStylesForStructuredTextField.ts',
|
|
2891
|
-
lineNumber:
|
|
2891
|
+
lineNumber: 29,
|
|
2892
2892
|
},
|
|
2893
2893
|
type: 'ItemType',
|
|
2894
2894
|
},
|
|
@@ -2900,7 +2900,7 @@ export const manifest: Manifest = {
|
|
|
2900
2900
|
returnType: 'StructuredTextCustomBlockStyle[] | undefined',
|
|
2901
2901
|
location: {
|
|
2902
2902
|
filePath: 'src/hooks/customBlockStylesForStructuredTextField.ts',
|
|
2903
|
-
lineNumber:
|
|
2903
|
+
lineNumber: 22,
|
|
2904
2904
|
},
|
|
2905
2905
|
},
|
|
2906
2906
|
contentAreaSidebarItems: {
|
|
@@ -2919,7 +2919,7 @@ export const manifest: Manifest = {
|
|
|
2919
2919
|
returnType: 'ContentAreaSidebarItem[]',
|
|
2920
2920
|
location: {
|
|
2921
2921
|
filePath: 'src/hooks/contentAreaSidebarItems.ts',
|
|
2922
|
-
lineNumber:
|
|
2922
|
+
lineNumber: 18,
|
|
2923
2923
|
},
|
|
2924
2924
|
},
|
|
2925
2925
|
buildItemPresentationInfo: {
|
|
@@ -2962,7 +2962,7 @@ export const manifest: Manifest = {
|
|
|
2962
2962
|
returnType: 'AssetSource[] | undefined',
|
|
2963
2963
|
location: {
|
|
2964
2964
|
filePath: 'src/hooks/assetSources.ts',
|
|
2965
|
-
lineNumber:
|
|
2965
|
+
lineNumber: 18,
|
|
2966
2966
|
},
|
|
2967
2967
|
},
|
|
2968
2968
|
},
|
package/src/shared.ts
CHANGED
|
@@ -112,3 +112,13 @@ export function isDropdownActionGroup(
|
|
|
112
112
|
(isNullish(value.rank) || isNumber(value.rank))
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
export function isDropdownActionOrGroupArray(
|
|
117
|
+
value: unknown,
|
|
118
|
+
): value is Array<DropdownAction | DropdownActionGroup> {
|
|
119
|
+
return isArray(
|
|
120
|
+
value,
|
|
121
|
+
(innerValue) =>
|
|
122
|
+
isDropdownAction(innerValue) || isDropdownActionGroup(innerValue),
|
|
123
|
+
);
|
|
124
|
+
}
|