@pronto-tools-and-more/pronto 12.26.0 → 12.27.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/pronto",
3
- "version": "12.26.0",
3
+ "version": "12.27.0",
4
4
  "description": "",
5
5
  "main": "src/main.js",
6
6
  "type": "module",
@@ -17,16 +17,16 @@
17
17
  "@lvce-editor/ipc": "^13.7.0",
18
18
  "@lvce-editor/json-rpc": "^5.4.0",
19
19
  "@lvce-editor/verror": "^1.6.0",
20
- "@pronto-tools-and-more/file-watcher": "12.26.0",
21
- "@pronto-tools-and-more/files": "12.26.0",
22
- "@pronto-tools-and-more/network-process": "12.26.0",
23
- "@pronto-tools-and-more/sass-compiler": "12.26.0",
24
- "@pronto-tools-and-more/components-renderer": "12.26.0",
25
- "@pronto-tools-and-more/components": "12.26.0",
26
- "@pronto-tools-and-more/schema-process": "12.26.0",
27
- "@pronto-tools-and-more/diff-process": "12.26.0",
28
- "@pronto-tools-and-more/type-checker": "12.26.0",
29
- "@pronto-tools-and-more/custom-js-functions": "12.26.0",
20
+ "@pronto-tools-and-more/file-watcher": "12.27.0",
21
+ "@pronto-tools-and-more/files": "12.27.0",
22
+ "@pronto-tools-and-more/network-process": "12.27.0",
23
+ "@pronto-tools-and-more/sass-compiler": "12.27.0",
24
+ "@pronto-tools-and-more/components-renderer": "12.27.0",
25
+ "@pronto-tools-and-more/components": "12.27.0",
26
+ "@pronto-tools-and-more/schema-process": "12.27.0",
27
+ "@pronto-tools-and-more/diff-process": "12.27.0",
28
+ "@pronto-tools-and-more/type-checker": "12.27.0",
29
+ "@pronto-tools-and-more/custom-js-functions": "12.27.0",
30
30
  "execa": "^9.5.2",
31
31
  "express": "^4.21.2"
32
32
  },
@@ -0,0 +1,77 @@
1
+ export const top = `query MenuQuery($appInfo: AppInfo!, $deviceInfo: DeviceInfo!, $authorization: Authorization!, $filter: MenuFilter, $first: Int, $after: String, $includeItems: Boolean!) {
2
+ catalog(
3
+ appInfo: $appInfo
4
+ deviceInfo: $deviceInfo
5
+ authorization: $authorization
6
+ ) {
7
+ menusConnection(filter: $filter, first: $first, after: $after) {
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ properties {
13
+ key
14
+ value
15
+ type
16
+ }
17
+ items @include(if: $includeItems) {
18
+ id
19
+ sortIndex
20
+ parentId
21
+ url
22
+ name
23
+ title
24
+ description
25
+ target
26
+ cssClasses
27
+ properties {
28
+ key
29
+ value
30
+ type
31
+ }
32
+ thumbnails {
33
+ kind
34
+ url
35
+ properties {
36
+ key
37
+ value
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ pageInfo {
44
+ hasNextPage
45
+ endCursor
46
+ }
47
+ }
48
+ }
49
+ }`;
50
+
51
+ export const bottom = {
52
+ filter: {
53
+ name: {
54
+ value: "",
55
+ },
56
+ },
57
+ first: 24,
58
+ includeItems: true,
59
+ appInfo: {
60
+ appId: "",
61
+ appVersion: "1.0-SNAPSHOT",
62
+ preview: true,
63
+ },
64
+ deviceInfo: {
65
+ deviceId: "editor-preview",
66
+ deviceModel: "web",
67
+ locale: "de_DE",
68
+ smallestScreenWidthDp: 0,
69
+ deviceOs: "web",
70
+ platform: "WEB",
71
+ },
72
+ authorization: {
73
+ subscriptionCodes: [],
74
+ },
75
+ };
76
+
77
+ export const queryName = "MenuQuery";
@@ -2,11 +2,12 @@ import * as HandleApiArticle from "../HandleApiArticle/HandleApiArticle.js";
2
2
  import * as HandleApiAuthors from "../HandleApiAuthors/HandleApiAuthors.js";
3
3
  import * as HandleCategories from "../HandleApiCategories/HandleApiCategories.js";
4
4
  import * as HandleApiCollection from "../HandleApiCollection/HandleApiCollection.js";
5
+ import * as HandleApiCollections from "../HandleApiCollections/HandleApiCollections.js";
5
6
  import * as HandleApiDossier from "../HandleApiDossier/HandleApiDossier.js";
6
7
  import * as HandleDossiers from "../HandleApiDossiers/HandleApiDossiers.js";
7
8
  import * as HandleApiIndex from "../HandleApiIndex/HandleApiIndex.js";
8
9
  import * as HandleApiIssues from "../HandleApiIssues/HandleApiIssues.js";
9
- import * as HandleApiCollections from "../HandleApiCollections/HandleApiCollections.js";
10
+ import * as HandleApiMenus from "../HandleApiMenus/HandleApiMenus.js";
10
11
 
11
12
  export const handleApi =
12
13
  ({ appId, apiUrl }) =>
@@ -44,6 +45,9 @@ export const handleApi =
44
45
  res
45
46
  );
46
47
  }
48
+ if (req.url === "/menus" || req.url === "/menus/") {
49
+ return HandleApiMenus.handleMenus({ apiUrl, appId })(req, res);
50
+ }
47
51
  res.statusCode = 404;
48
52
  return res.end("not found");
49
53
  };
@@ -14,6 +14,7 @@ export const handleIndex = async (req, res, next) => {
14
14
  <li><a href="/api/articles">Articles</a></li>
15
15
  <li><a href="/api/authors">Authors</a></li>
16
16
  <li><a href="/api/collections">Collections</a></li>
17
+ <li><a href="/api/menus">Menus</a></li>
17
18
  </ul>
18
19
  </body>
19
20
  </html>
@@ -0,0 +1,36 @@
1
+ import * as GraphQlQueryMenus from "../GraphQlQueryMenus/GraphQlQueryMenus.js";
2
+
3
+ export const handleMenus =
4
+ ({ appId, apiUrl }) =>
5
+ async (req, res, next) => {
6
+ const realBottom = {
7
+ ...GraphQlQueryMenus.bottom,
8
+ filter: {},
9
+ appInfo: {
10
+ ...GraphQlQueryMenus.bottom.appInfo,
11
+ appId,
12
+ },
13
+ };
14
+ const response = await fetch(apiUrl, {
15
+ method: "POST",
16
+ headers: {
17
+ Accept: "application/json",
18
+ "Content-Type": "application/json",
19
+ },
20
+ body: JSON.stringify({
21
+ operationName: GraphQlQueryMenus.queryName,
22
+ query: GraphQlQueryMenus.top,
23
+ variables: realBottom,
24
+ }),
25
+ });
26
+ const result = await response.json();
27
+ // @ts-ignore
28
+ const realData = result.data.catalog.menusConnection.edges
29
+ .map((edge) => edge.content)
30
+ .map((node) => {
31
+ const { __typename, ...rest } = node;
32
+ return rest;
33
+ });
34
+ res.setHeader("content-type", "application/json");
35
+ res.send(JSON.stringify(realData, null, 2));
36
+ };
@@ -1 +1 @@
1
- export const version = '12.26.0'
1
+ export const version = '12.27.0'