@dotcms/client 0.0.1-alpha.29 → 0.0.1-alpha.30
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/package.json +4 -3
- package/src/lib/editor/models/client.model.d.ts +7 -0
- package/src/lib/editor/models/client.model.js +7 -0
- package/src/lib/editor/models/client.model.js.map +1 -1
- package/src/lib/editor/models/editor.model.d.ts +33 -2
- package/src/lib/utils/graphql/transforms.d.ts +2 -3
- package/src/lib/utils/graphql/transforms.js +7 -2
- package/src/lib/utils/graphql/transforms.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/client",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official JavaScript library for interacting with DotCMS REST APIs.",
|
|
6
6
|
"repository": {
|
|
@@ -24,5 +24,6 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/client/README.md",
|
|
26
26
|
"module": "./src/index.js",
|
|
27
|
-
"main": "./src/index.js"
|
|
28
|
-
|
|
27
|
+
"main": "./src/index.js",
|
|
28
|
+
"types": "./src/index.d.ts"
|
|
29
|
+
}
|
|
@@ -50,6 +50,13 @@ export declare enum CUSTOMER_ACTIONS {
|
|
|
50
50
|
* Tell the editor to send the page info to iframe
|
|
51
51
|
*/
|
|
52
52
|
GET_PAGE_DATA = "get-page-data",
|
|
53
|
+
/**
|
|
54
|
+
* Tell the editor an user send a graphql query
|
|
55
|
+
*/
|
|
56
|
+
CLIENT_READY = "client-ready",
|
|
57
|
+
/**
|
|
58
|
+
* Tell the editor to do nothing
|
|
59
|
+
*/
|
|
53
60
|
NOOP = "noop"
|
|
54
61
|
}
|
|
55
62
|
/**
|
|
@@ -51,6 +51,13 @@ export var CUSTOMER_ACTIONS;
|
|
|
51
51
|
* Tell the editor to send the page info to iframe
|
|
52
52
|
*/
|
|
53
53
|
CUSTOMER_ACTIONS["GET_PAGE_DATA"] = "get-page-data";
|
|
54
|
+
/**
|
|
55
|
+
* Tell the editor an user send a graphql query
|
|
56
|
+
*/
|
|
57
|
+
CUSTOMER_ACTIONS["CLIENT_READY"] = "client-ready";
|
|
58
|
+
/**
|
|
59
|
+
* Tell the editor to do nothing
|
|
60
|
+
*/
|
|
54
61
|
CUSTOMER_ACTIONS["NOOP"] = "noop";
|
|
55
62
|
})(CUSTOMER_ACTIONS || (CUSTOMER_ACTIONS = {}));
|
|
56
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/client.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"client.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/client.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAsDX;AAtDD,WAAY,gBAAgB;IACxB;;OAEG;IACH,iDAA6B,CAAA;IAC7B;;OAEG;IACH,6CAAyB,CAAA;IACzB;;OAEG;IACH,qDAAiC,CAAA;IACjC;;OAEG;IACH,4CAAwB,CAAA;IACxB;;OAEG;IACH,oDAAgC,CAAA;IAChC;;OAEG;IACH,+CAA2B,CAAA;IAC3B;;OAEG;IACH,+DAA2C,CAAA;IAC3C;;;OAGG;IACH,qFAAiE,CAAA;IACjE;;OAEG;IACH,yFAAqE,CAAA;IACrE;;OAEG;IACH,iDAA6B,CAAA;IAC7B;;OAEG;IACH,mDAA+B,CAAA;IAC/B;;OAEG;IACH,iDAA6B,CAAA;IAC7B;;OAEG;IACH,iCAAa,CAAA;AACjB,CAAC,EAtDW,gBAAgB,KAAhB,gBAAgB,QAsD3B;AAcD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAc,OAA4B;IACzE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @description Custom client parameters for fetching data.
|
|
3
|
+
*/
|
|
4
|
+
export type CustomClientParams = {
|
|
5
|
+
depth: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @description Union type for fetch configurations.
|
|
9
|
+
* @typedef {GraphQLFetchConfig | PageAPIFetchConfig} DotCMSFetchConfig
|
|
10
|
+
*/
|
|
11
|
+
export type EditorConfig = {
|
|
12
|
+
params: CustomClientParams;
|
|
13
|
+
} | {
|
|
14
|
+
query: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
3
17
|
* Represents the configuration options for the DotCMS page editor.
|
|
4
18
|
* @export
|
|
5
19
|
* @interface DotCMSPageEditorConfig
|
|
@@ -7,12 +21,29 @@
|
|
|
7
21
|
export interface DotCMSPageEditorConfig {
|
|
8
22
|
/**
|
|
9
23
|
* The pathname of the page being edited. Optional.
|
|
24
|
+
* @type {string}
|
|
10
25
|
*/
|
|
11
26
|
pathname: string;
|
|
12
27
|
/**
|
|
13
|
-
* The reload function to call when the page is reloaded.
|
|
14
28
|
*
|
|
29
|
+
* @type {DotCMSFetchConfig}
|
|
30
|
+
* @memberof DotCMSPageEditorConfig
|
|
31
|
+
* @description The configuration custom params for data fetching on Edit Mode.
|
|
32
|
+
* @example <caption>Example with Custom GraphQL query</caption>
|
|
33
|
+
* const config: DotCMSPageEditorConfig = {
|
|
34
|
+
* editor: { query: 'query { ... }' }
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* @example <caption>Example usage with Custom Page API parameters</caption>
|
|
38
|
+
* const config: DotCMSPageEditorConfig = {
|
|
39
|
+
* editor: { params: { depth: '2' } }
|
|
40
|
+
* };
|
|
41
|
+
*/
|
|
42
|
+
editor?: EditorConfig;
|
|
43
|
+
/**
|
|
44
|
+
* The reload function to call when the page is reloaded.
|
|
15
45
|
* @deprecated In future implementation we will be listening for the changes from the editor to update the page state so reload will not be needed.
|
|
46
|
+
* @type {Function}
|
|
16
47
|
*/
|
|
17
48
|
onReload?: () => void;
|
|
18
49
|
}
|
|
@@ -5,13 +5,18 @@ export const graphqlToPageEntity = ({ page }) => {
|
|
|
5
5
|
if (!page) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
|
-
const { layout, template, containers, urlContentMap, viewAs, ...pageAsset } = page;
|
|
8
|
+
const { layout, template, containers, urlContentMap, viewAs, site, _map, ...pageAsset } = page;
|
|
9
|
+
const data = _map || {};
|
|
9
10
|
return {
|
|
10
11
|
layout,
|
|
11
12
|
template,
|
|
12
13
|
viewAs,
|
|
13
14
|
urlContentMap,
|
|
14
|
-
|
|
15
|
+
site,
|
|
16
|
+
page: {
|
|
17
|
+
...data,
|
|
18
|
+
...pageAsset
|
|
19
|
+
},
|
|
15
20
|
containers: parseContainers(containers)
|
|
16
21
|
};
|
|
17
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/utils/graphql/transforms.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAE,IAAI,EAAqC,EAAE,EAAE;IAC/E,mCAAmC;IACnC,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/utils/graphql/transforms.ts"],"names":[],"mappings":"AAAA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