datocms-plugin-sdk 0.7.3-alpha.0 → 0.7.4
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 +1 -0
- package/dist/cjs/connect.js.map +1 -1
- package/dist/esm/connect.d.ts +15 -1
- package/dist/esm/connect.js +1 -0
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/types.d.ts +35 -1
- package/dist/types/connect.d.ts +15 -1
- package/dist/types/types.d.ts +35 -1
- package/package.json +2 -2
- package/src/connect.ts +51 -23
- package/src/types.ts +47 -3
- package/types.json +3145 -2428
package/dist/cjs/connect.js
CHANGED
|
@@ -169,6 +169,7 @@ function connect(configuration) {
|
|
|
169
169
|
if (!(methodName in configuration)) {
|
|
170
170
|
return undefined;
|
|
171
171
|
}
|
|
172
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
172
173
|
return (_a = configuration)[methodName].apply(_a, __spreadArray(__spreadArray([], methodArgs, false), [__assign(__assign(__assign({}, parent), currentSettings_1), extraCtx)], false));
|
|
173
174
|
};
|
|
174
175
|
if (configuration.onBoot) {
|
package/dist/cjs/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;AAoCzD,mCAWkB;AA2SlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAAe,EACf,GAA6B;QAE7B,IAAI,CAAC,EAAE,EAAE;YACP,OAAO,EAAE,CAAC;SACX;QAED,IA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E;wBAKnD,gBAAc,gBAAgB,CAAC,MAAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;gCACvC,OAAO;6BACR;4BAED,aAAa,CAAC,oBAAoB,CAAC,QAAQ,CAAC,gBAAgB,iCACvD,MAAM,GACN,QAAQ,GACR,aAAW,EACd,CAAC;wBACL,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;oBAED,IAAI,IAAA,uDAA8C,EAAC,MAAM,EAAE,eAAe,CAAC,EAAE;wBAKrE,gBAAc,gBAAgB,CAAC,MAAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,sCAAsC,EAAE;gCACzD,OAAO;6BACR;4BAED,aAAa,CAAC,sCAAsC,CAClD,QAAQ,CAAC,gBAAgB,iCAEpB,MAAM,GACN,QAAQ,GACR,aAAW,EAEjB,CAAC;wBACJ,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF;AA1RD,0BA0RC"}
|
package/dist/esm/connect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field, Item, ItemCreateSchema, ItemType, ItemUpdateSchema } from './SiteApiSchema';
|
|
2
|
-
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
2
|
+
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitialLocationQueryForItemSelector, InitPropertiesAndMethods, ItemFormSidebarPanel, ItemPresentationInfo, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
3
|
import { ItemFormOutlet, RenderItemFormOutletPropertiesAndMethods, StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
4
4
|
export declare type SizingUtilities = {
|
|
5
5
|
/**
|
|
@@ -69,6 +69,20 @@ export declare type FullConnectParameters = {
|
|
|
69
69
|
* @tag beforeHooks
|
|
70
70
|
*/
|
|
71
71
|
onBeforeItemUpsert: (createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema, ctx: OnBootCtx) => MaybePromise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Use this function to customize the presentation of a record action by
|
|
74
|
+
* returning `false`
|
|
75
|
+
*
|
|
76
|
+
* @tag customizeHooks
|
|
77
|
+
*/
|
|
78
|
+
buildItemPresentationInfo: (item: Item, ctx: OnBootCtx) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* Use this function to customize the initial filters when opening an record
|
|
81
|
+
* selector via a "Single link" or "Multiple links" field
|
|
82
|
+
*
|
|
83
|
+
* @tag customizeHooks
|
|
84
|
+
*/
|
|
85
|
+
initialLocationQueryForItemSelector: (openerfield: Item, itemType: ItemType, ctx: OnBootCtx) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
72
86
|
/**
|
|
73
87
|
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
74
88
|
* UI
|
package/dist/esm/connect.js
CHANGED
|
@@ -163,6 +163,7 @@ export function connect(configuration) {
|
|
|
163
163
|
if (!(methodName in configuration)) {
|
|
164
164
|
return undefined;
|
|
165
165
|
}
|
|
166
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
166
167
|
return (_a = configuration)[methodName].apply(_a, __spreadArray(__spreadArray([], methodArgs, false), [__assign(__assign(__assign({}, parent), currentSettings_1), extraCtx)], false));
|
|
167
168
|
};
|
|
168
169
|
if (configuration.onBoot) {
|
package/dist/esm/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe,MAAM,4BAA4B,CAAC;AAoCzD,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC5B,8CAA8C,EAC9C,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,GAE3B,MAAM,UAAU,CAAC;AA2SlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAAe,EACf,GAA6B;QAE7B,IAAI,CAAC,EAAE,EAAE;YACP,OAAO,EAAE,CAAC;SACX;QAED,IAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAoB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,EAAE;YAAvB,IAAM,KAAK,eAAA;YACd,IAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAC5B,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAC1B,CAAC;YACd,M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M,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;oBAED,IAAI,8CAA8C,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE;wBAKrE,gBAAc,gBAAgB,CAAC,MAAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,sCAAsC,EAAE;gCACzD,OAAO;6BACR;4BAED,aAAa,CAAC,sCAAsC,CAClD,QAAQ,CAAC,gBAAgB,iCAEpB,MAAM,GACN,QAAQ,GACR,aAAW,EAEjB,CAAC;wBACJ,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -6,6 +6,38 @@ export declare type Icon = string | {
|
|
|
6
6
|
viewBox: string;
|
|
7
7
|
content: string;
|
|
8
8
|
};
|
|
9
|
+
export declare type ItemListLocationQuery = {
|
|
10
|
+
locale?: string;
|
|
11
|
+
filter?: {
|
|
12
|
+
query?: string;
|
|
13
|
+
fields?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type ItemPresentationInfo = {
|
|
17
|
+
/** The title to present the record */
|
|
18
|
+
title: string;
|
|
19
|
+
/** An image representative of the record */
|
|
20
|
+
imageUrl?: string;
|
|
21
|
+
/**
|
|
22
|
+
* If different plugins implement the `buildItemPresentationInfo` hook, the
|
|
23
|
+
* one with the lowest `rank` will be used. If you want to specify an explicit
|
|
24
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
25
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
26
|
+
* might clash with the one of another plugin!
|
|
27
|
+
*/
|
|
28
|
+
rank?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare type InitialLocationQueryForItemSelector = {
|
|
31
|
+
locationQuery: ItemListLocationQuery;
|
|
32
|
+
/**
|
|
33
|
+
* If different plugins implement the `initialLocationQueryForItemSelector`
|
|
34
|
+
* hook, the one with the lowest `rank` will be used. If you want to specify
|
|
35
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
36
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
37
|
+
* value you choose might clash with the one of another plugin!
|
|
38
|
+
*/
|
|
39
|
+
rank?: number;
|
|
40
|
+
};
|
|
9
41
|
/** A tab to be displayed in the top-bar of the UI */
|
|
10
42
|
export declare type MainNavigationTab = {
|
|
11
43
|
/** Label to be shown. Must be unique. */
|
|
@@ -241,7 +273,7 @@ export declare type EditorOverride = {
|
|
|
241
273
|
*/
|
|
242
274
|
parameters?: Record<string, unknown>;
|
|
243
275
|
/**
|
|
244
|
-
* If multiple plugins override a field, the one with the
|
|
276
|
+
* If multiple plugins override a field, the one with the lowest `rank` will
|
|
245
277
|
* win. If you want to specify an explicit value for `rank`, make sure to
|
|
246
278
|
* offer a way for final users to customize it inside the plugin's settings
|
|
247
279
|
* form, otherwise the hardcoded value you choose might clash with the one of
|
|
@@ -788,9 +820,11 @@ export declare type ItemDialogMethods = {
|
|
|
788
820
|
selectItem: {
|
|
789
821
|
(itemTypeId: string, options: {
|
|
790
822
|
multiple: true;
|
|
823
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
791
824
|
}): Promise<Item[] | null>;
|
|
792
825
|
(itemTypeId: string, options?: {
|
|
793
826
|
multiple: false;
|
|
827
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
794
828
|
}): Promise<Item | null>;
|
|
795
829
|
};
|
|
796
830
|
/**
|
package/dist/types/connect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field, Item, ItemCreateSchema, ItemType, ItemUpdateSchema } from './SiteApiSchema';
|
|
2
|
-
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
2
|
+
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitialLocationQueryForItemSelector, InitPropertiesAndMethods, ItemFormSidebarPanel, ItemPresentationInfo, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
3
|
import { ItemFormOutlet, RenderItemFormOutletPropertiesAndMethods, StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
4
4
|
export declare type SizingUtilities = {
|
|
5
5
|
/**
|
|
@@ -69,6 +69,20 @@ export declare type FullConnectParameters = {
|
|
|
69
69
|
* @tag beforeHooks
|
|
70
70
|
*/
|
|
71
71
|
onBeforeItemUpsert: (createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema, ctx: OnBootCtx) => MaybePromise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Use this function to customize the presentation of a record action by
|
|
74
|
+
* returning `false`
|
|
75
|
+
*
|
|
76
|
+
* @tag customizeHooks
|
|
77
|
+
*/
|
|
78
|
+
buildItemPresentationInfo: (item: Item, ctx: OnBootCtx) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* Use this function to customize the initial filters when opening an record
|
|
81
|
+
* selector via a "Single link" or "Multiple links" field
|
|
82
|
+
*
|
|
83
|
+
* @tag customizeHooks
|
|
84
|
+
*/
|
|
85
|
+
initialLocationQueryForItemSelector: (openerfield: Item, itemType: ItemType, ctx: OnBootCtx) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
72
86
|
/**
|
|
73
87
|
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
74
88
|
* UI
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,6 +6,38 @@ export declare type Icon = string | {
|
|
|
6
6
|
viewBox: string;
|
|
7
7
|
content: string;
|
|
8
8
|
};
|
|
9
|
+
export declare type ItemListLocationQuery = {
|
|
10
|
+
locale?: string;
|
|
11
|
+
filter?: {
|
|
12
|
+
query?: string;
|
|
13
|
+
fields?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type ItemPresentationInfo = {
|
|
17
|
+
/** The title to present the record */
|
|
18
|
+
title: string;
|
|
19
|
+
/** An image representative of the record */
|
|
20
|
+
imageUrl?: string;
|
|
21
|
+
/**
|
|
22
|
+
* If different plugins implement the `buildItemPresentationInfo` hook, the
|
|
23
|
+
* one with the lowest `rank` will be used. If you want to specify an explicit
|
|
24
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
25
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
26
|
+
* might clash with the one of another plugin!
|
|
27
|
+
*/
|
|
28
|
+
rank?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare type InitialLocationQueryForItemSelector = {
|
|
31
|
+
locationQuery: ItemListLocationQuery;
|
|
32
|
+
/**
|
|
33
|
+
* If different plugins implement the `initialLocationQueryForItemSelector`
|
|
34
|
+
* hook, the one with the lowest `rank` will be used. If you want to specify
|
|
35
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
36
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
37
|
+
* value you choose might clash with the one of another plugin!
|
|
38
|
+
*/
|
|
39
|
+
rank?: number;
|
|
40
|
+
};
|
|
9
41
|
/** A tab to be displayed in the top-bar of the UI */
|
|
10
42
|
export declare type MainNavigationTab = {
|
|
11
43
|
/** Label to be shown. Must be unique. */
|
|
@@ -241,7 +273,7 @@ export declare type EditorOverride = {
|
|
|
241
273
|
*/
|
|
242
274
|
parameters?: Record<string, unknown>;
|
|
243
275
|
/**
|
|
244
|
-
* If multiple plugins override a field, the one with the
|
|
276
|
+
* If multiple plugins override a field, the one with the lowest `rank` will
|
|
245
277
|
* win. If you want to specify an explicit value for `rank`, make sure to
|
|
246
278
|
* offer a way for final users to customize it inside the plugin's settings
|
|
247
279
|
* form, otherwise the hardcoded value you choose might clash with the one of
|
|
@@ -788,9 +820,11 @@ export declare type ItemDialogMethods = {
|
|
|
788
820
|
selectItem: {
|
|
789
821
|
(itemTypeId: string, options: {
|
|
790
822
|
multiple: true;
|
|
823
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
791
824
|
}): Promise<Item[] | null>;
|
|
792
825
|
(itemTypeId: string, options?: {
|
|
793
826
|
multiple: false;
|
|
827
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
794
828
|
}): Promise<Item | null>;
|
|
795
829
|
};
|
|
796
830
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typedoc": "^0.23.20"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "45d760725f520a94e50123681ff1616e0aa35312"
|
|
47
47
|
}
|
package/src/connect.ts
CHANGED
|
@@ -10,8 +10,10 @@ import {
|
|
|
10
10
|
AssetSource,
|
|
11
11
|
ContentAreaSidebarItem,
|
|
12
12
|
FieldExtensionOverride,
|
|
13
|
+
InitialLocationQueryForItemSelector,
|
|
13
14
|
InitPropertiesAndMethods,
|
|
14
15
|
ItemFormSidebarPanel,
|
|
16
|
+
ItemPresentationInfo,
|
|
15
17
|
MainNavigationTab,
|
|
16
18
|
ManualFieldExtension,
|
|
17
19
|
OnBootMethods,
|
|
@@ -147,6 +149,29 @@ export type FullConnectParameters = {
|
|
|
147
149
|
ctx: OnBootCtx,
|
|
148
150
|
) => MaybePromise<boolean>;
|
|
149
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Use this function to customize the presentation of a record action by
|
|
154
|
+
* returning `false`
|
|
155
|
+
*
|
|
156
|
+
* @tag customizeHooks
|
|
157
|
+
*/
|
|
158
|
+
buildItemPresentationInfo: (
|
|
159
|
+
item: Item,
|
|
160
|
+
ctx: OnBootCtx,
|
|
161
|
+
) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Use this function to customize the initial filters when opening an record
|
|
165
|
+
* selector via a "Single link" or "Multiple links" field
|
|
166
|
+
*
|
|
167
|
+
* @tag customizeHooks
|
|
168
|
+
*/
|
|
169
|
+
initialLocationQueryForItemSelector: (
|
|
170
|
+
openerfield: Item,
|
|
171
|
+
itemType: ItemType,
|
|
172
|
+
ctx: OnBootCtx,
|
|
173
|
+
) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
174
|
+
|
|
150
175
|
/**
|
|
151
176
|
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
152
177
|
* UI
|
|
@@ -343,13 +368,10 @@ function toMultifield<Result>(
|
|
|
343
368
|
};
|
|
344
369
|
}
|
|
345
370
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
: T extends (...args: any) => infer U
|
|
351
|
-
? U
|
|
352
|
-
: any;
|
|
371
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
372
|
+
type AwaitedReturnType<T extends (...args: any) => any> = Awaited<
|
|
373
|
+
ReturnType<T>
|
|
374
|
+
>;
|
|
353
375
|
|
|
354
376
|
const buildRenderUtils = (parent: { setHeight: (number: number) => void }) => {
|
|
355
377
|
let oldHeight: null | number = null;
|
|
@@ -413,12 +435,13 @@ export async function connect(
|
|
|
413
435
|
itemFormSidebarPanels,
|
|
414
436
|
itemFormOutlets,
|
|
415
437
|
} = configuration;
|
|
438
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
416
439
|
let listener: ((newSettings: any) => void) | null = null;
|
|
417
440
|
let callMethodMergingBootCtxExecutor:
|
|
418
441
|
| ((
|
|
419
442
|
methodName: string,
|
|
420
|
-
methodArgs:
|
|
421
|
-
extraCtx: Record<string,
|
|
443
|
+
methodArgs: unknown[],
|
|
444
|
+
extraCtx: Record<string, unknown>,
|
|
422
445
|
) => void)
|
|
423
446
|
| null = null;
|
|
424
447
|
|
|
@@ -451,15 +474,15 @@ export async function connect(
|
|
|
451
474
|
customBlockStylesForStructuredTextField: toMultifield(
|
|
452
475
|
configuration.customBlockStylesForStructuredTextField,
|
|
453
476
|
),
|
|
454
|
-
onChange(newSettings:
|
|
477
|
+
onChange(newSettings: unknown) {
|
|
455
478
|
if (listener) {
|
|
456
479
|
listener(newSettings);
|
|
457
480
|
}
|
|
458
481
|
},
|
|
459
482
|
callMethodMergingBootCtx(
|
|
460
483
|
methodName: string,
|
|
461
|
-
methodArgs:
|
|
462
|
-
extraCtx: Record<string,
|
|
484
|
+
methodArgs: unknown[],
|
|
485
|
+
extraCtx: Record<string, unknown>,
|
|
463
486
|
) {
|
|
464
487
|
if (!callMethodMergingBootCtxExecutor) {
|
|
465
488
|
return null;
|
|
@@ -477,7 +500,7 @@ export async function connect(
|
|
|
477
500
|
const initialSettings = await parent.getSettings();
|
|
478
501
|
|
|
479
502
|
if (isOnBootParent(parent, initialSettings)) {
|
|
480
|
-
type Settings =
|
|
503
|
+
type Settings = AwaitedReturnType<OnBootMethods['getSettings']>;
|
|
481
504
|
let currentSettings = initialSettings as Settings;
|
|
482
505
|
|
|
483
506
|
listener = (newSettings: Settings) => {
|
|
@@ -486,13 +509,14 @@ export async function connect(
|
|
|
486
509
|
|
|
487
510
|
callMethodMergingBootCtxExecutor = (
|
|
488
511
|
methodName: string,
|
|
489
|
-
methodArgs:
|
|
490
|
-
extraCtx: Record<string,
|
|
512
|
+
methodArgs: unknown[],
|
|
513
|
+
extraCtx: Record<string, unknown>,
|
|
491
514
|
) => {
|
|
492
515
|
if (!(methodName in configuration)) {
|
|
493
516
|
return undefined;
|
|
494
517
|
}
|
|
495
518
|
|
|
519
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
496
520
|
return (configuration as any)[methodName](...methodArgs, {
|
|
497
521
|
...parent,
|
|
498
522
|
...currentSettings,
|
|
@@ -509,7 +533,7 @@ export async function connect(
|
|
|
509
533
|
}
|
|
510
534
|
|
|
511
535
|
if (isRenderPageParent(parent, initialSettings)) {
|
|
512
|
-
type Settings =
|
|
536
|
+
type Settings = AwaitedReturnType<RenderPageMethods['getSettings']>;
|
|
513
537
|
|
|
514
538
|
const render = (settings: Settings) => {
|
|
515
539
|
if (!configuration.renderPage) {
|
|
@@ -527,7 +551,7 @@ export async function connect(
|
|
|
527
551
|
}
|
|
528
552
|
|
|
529
553
|
if (isRenderConfigScreenParent(parent, initialSettings)) {
|
|
530
|
-
type Settings =
|
|
554
|
+
type Settings = AwaitedReturnType<RenderConfigScreenMethods['getSettings']>;
|
|
531
555
|
|
|
532
556
|
const renderUtils = buildRenderUtils(parent);
|
|
533
557
|
|
|
@@ -548,7 +572,7 @@ export async function connect(
|
|
|
548
572
|
}
|
|
549
573
|
|
|
550
574
|
if (isRenderModalParent(parent, initialSettings)) {
|
|
551
|
-
type Settings =
|
|
575
|
+
type Settings = AwaitedReturnType<RenderModalMethods['getSettings']>;
|
|
552
576
|
|
|
553
577
|
const renderUtils = buildRenderUtils(parent);
|
|
554
578
|
|
|
@@ -569,7 +593,7 @@ export async function connect(
|
|
|
569
593
|
}
|
|
570
594
|
|
|
571
595
|
if (isRenderAssetSourceParent(parent, initialSettings)) {
|
|
572
|
-
type Settings =
|
|
596
|
+
type Settings = AwaitedReturnType<RenderAssetSourceMethods['getSettings']>;
|
|
573
597
|
|
|
574
598
|
const renderUtils = buildRenderUtils(parent);
|
|
575
599
|
|
|
@@ -590,7 +614,7 @@ export async function connect(
|
|
|
590
614
|
}
|
|
591
615
|
|
|
592
616
|
if (isRenderSidebarPanelParent(parent, initialSettings)) {
|
|
593
|
-
type Settings =
|
|
617
|
+
type Settings = AwaitedReturnType<RenderSidebarPanelMethods['getSettings']>;
|
|
594
618
|
|
|
595
619
|
const renderUtils = buildRenderUtils(parent);
|
|
596
620
|
|
|
@@ -611,7 +635,9 @@ export async function connect(
|
|
|
611
635
|
}
|
|
612
636
|
|
|
613
637
|
if (isRenderItemFormOutletParent(parent, initialSettings)) {
|
|
614
|
-
type Settings =
|
|
638
|
+
type Settings = AwaitedReturnType<
|
|
639
|
+
RenderItemFormOutletMethods['getSettings']
|
|
640
|
+
>;
|
|
615
641
|
|
|
616
642
|
const renderUtils = buildRenderUtils(parent);
|
|
617
643
|
|
|
@@ -632,7 +658,9 @@ export async function connect(
|
|
|
632
658
|
}
|
|
633
659
|
|
|
634
660
|
if (isRenderFieldExtensionParent(parent, initialSettings)) {
|
|
635
|
-
type Settings =
|
|
661
|
+
type Settings = AwaitedReturnType<
|
|
662
|
+
RenderFieldExtensionMethods['getSettings']
|
|
663
|
+
>;
|
|
636
664
|
|
|
637
665
|
const renderUtils = buildRenderUtils(parent);
|
|
638
666
|
|
|
@@ -653,7 +681,7 @@ export async function connect(
|
|
|
653
681
|
}
|
|
654
682
|
|
|
655
683
|
if (isRenderManualFieldExtensionConfigScreenParent(parent, initialSettings)) {
|
|
656
|
-
type Settings =
|
|
684
|
+
type Settings = AwaitedReturnType<
|
|
657
685
|
RenderManualFieldExtensionConfigScreenMethods['getSettings']
|
|
658
686
|
>;
|
|
659
687
|
|
package/src/types.ts
CHANGED
|
@@ -17,6 +17,41 @@ import {
|
|
|
17
17
|
|
|
18
18
|
export type Icon = string | { type: 'svg'; viewBox: string; content: string };
|
|
19
19
|
|
|
20
|
+
export type ItemListLocationQuery = {
|
|
21
|
+
locale?: string;
|
|
22
|
+
filter?: {
|
|
23
|
+
query?: string;
|
|
24
|
+
fields?: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ItemPresentationInfo = {
|
|
29
|
+
/** The title to present the record */
|
|
30
|
+
title: string;
|
|
31
|
+
/** An image representative of the record */
|
|
32
|
+
imageUrl?: string;
|
|
33
|
+
/**
|
|
34
|
+
* If different plugins implement the `buildItemPresentationInfo` hook, the
|
|
35
|
+
* one with the lowest `rank` will be used. If you want to specify an explicit
|
|
36
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
37
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
38
|
+
* might clash with the one of another plugin!
|
|
39
|
+
*/
|
|
40
|
+
rank?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type InitialLocationQueryForItemSelector = {
|
|
44
|
+
locationQuery: ItemListLocationQuery;
|
|
45
|
+
/**
|
|
46
|
+
* If different plugins implement the `initialLocationQueryForItemSelector`
|
|
47
|
+
* hook, the one with the lowest `rank` will be used. If you want to specify
|
|
48
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
49
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
50
|
+
* value you choose might clash with the one of another plugin!
|
|
51
|
+
*/
|
|
52
|
+
rank?: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
20
55
|
/** A tab to be displayed in the top-bar of the UI */
|
|
21
56
|
export type MainNavigationTab = {
|
|
22
57
|
/** Label to be shown. Must be unique. */
|
|
@@ -285,7 +320,7 @@ export type EditorOverride = {
|
|
|
285
320
|
*/
|
|
286
321
|
parameters?: Record<string, unknown>;
|
|
287
322
|
/**
|
|
288
|
-
* If multiple plugins override a field, the one with the
|
|
323
|
+
* If multiple plugins override a field, the one with the lowest `rank` will
|
|
289
324
|
* win. If you want to specify an explicit value for `rank`, make sure to
|
|
290
325
|
* offer a way for final users to customize it inside the plugin's settings
|
|
291
326
|
* form, otherwise the hardcoded value you choose might clash with the one of
|
|
@@ -866,8 +901,17 @@ export type ItemDialogMethods = {
|
|
|
866
901
|
* ```
|
|
867
902
|
*/
|
|
868
903
|
selectItem: {
|
|
869
|
-
(
|
|
870
|
-
|
|
904
|
+
(
|
|
905
|
+
itemTypeId: string,
|
|
906
|
+
options: { multiple: true; initialLocationQuery?: ItemListLocationQuery },
|
|
907
|
+
): Promise<Item[] | null>;
|
|
908
|
+
(
|
|
909
|
+
itemTypeId: string,
|
|
910
|
+
options?: {
|
|
911
|
+
multiple: false;
|
|
912
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
913
|
+
},
|
|
914
|
+
): Promise<Item | null>;
|
|
871
915
|
};
|
|
872
916
|
/**
|
|
873
917
|
* Opens a dialog for editing an existing record. It returns a promise
|