@pronto-tools-and-more/pronto 12.8.0 → 12.10.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.8.0",
3
+ "version": "12.10.0",
4
4
  "description": "",
5
5
  "main": "src/main.js",
6
6
  "type": "module",
@@ -17,16 +17,16 @@
17
17
  "@lvce-editor/ipc": "^12.0.0",
18
18
  "@lvce-editor/json-rpc": "^5.3.0",
19
19
  "@lvce-editor/verror": "^1.6.0",
20
- "@pronto-tools-and-more/file-watcher": "12.8.0",
21
- "@pronto-tools-and-more/files": "12.8.0",
22
- "@pronto-tools-and-more/network-process": "12.8.0",
23
- "@pronto-tools-and-more/sass-compiler": "12.8.0",
24
- "@pronto-tools-and-more/components-renderer": "12.8.0",
25
- "@pronto-tools-and-more/components": "12.8.0",
26
- "@pronto-tools-and-more/schema-process": "12.8.0",
27
- "@pronto-tools-and-more/diff-process": "12.8.0",
28
- "@pronto-tools-and-more/type-checker": "12.8.0",
29
- "@pronto-tools-and-more/custom-js-functions": "12.8.0",
20
+ "@pronto-tools-and-more/file-watcher": "12.10.0",
21
+ "@pronto-tools-and-more/files": "12.10.0",
22
+ "@pronto-tools-and-more/network-process": "12.10.0",
23
+ "@pronto-tools-and-more/sass-compiler": "12.10.0",
24
+ "@pronto-tools-and-more/components-renderer": "12.10.0",
25
+ "@pronto-tools-and-more/components": "12.10.0",
26
+ "@pronto-tools-and-more/schema-process": "12.10.0",
27
+ "@pronto-tools-and-more/diff-process": "12.10.0",
28
+ "@pronto-tools-and-more/type-checker": "12.10.0",
29
+ "@pronto-tools-and-more/custom-js-functions": "12.10.0",
30
30
  "execa": "^9.5.2",
31
31
  "express": "^4.21.2"
32
32
  },
@@ -0,0 +1,66 @@
1
+ export const top = `query CatalogContentsQuery($appInfo: AppInfo!, $deviceInfo: DeviceInfo!, $authorization: Authorization!, $first: Int, $after: String, ) {
2
+ catalog(
3
+ appInfo: $appInfo
4
+ deviceInfo: $deviceInfo
5
+ authorization: $authorization
6
+ ) {
7
+ taxonomiesConnection(first: $first, after: $after, filter:{type:{
8
+ value:"author"
9
+ }}) {
10
+ pageInfo {
11
+ hasNextPage
12
+ __typename
13
+ }
14
+ totalCount
15
+ edges {
16
+ cursor
17
+ node {
18
+ name
19
+ properties {
20
+ key
21
+ value
22
+ }
23
+ thumbnails {
24
+ properties {
25
+ key
26
+ value
27
+ }
28
+ }
29
+
30
+ __typename
31
+ }
32
+ __typename
33
+ }
34
+ __typename
35
+ }
36
+ __typename
37
+ }
38
+ }`;
39
+
40
+ export const bottom = {
41
+ appInfo: {
42
+ appId: "",
43
+ appVersion: "1.0-SNAPSHOT",
44
+ preview: true,
45
+ },
46
+ deviceInfo: {
47
+ deviceId: "editor-preview",
48
+ deviceModel: "web",
49
+ locale: "de_DE",
50
+ deviceOs: "web",
51
+ platform: "WEB",
52
+ },
53
+ comparators: [
54
+ {
55
+ publicationDate: {
56
+ direction: "DESC",
57
+ },
58
+ },
59
+ ],
60
+ first: 99999,
61
+ includeBlocks: false,
62
+ includeHtml: false,
63
+ includeResources: false,
64
+ includeBundledContent: false,
65
+ authorization: {},
66
+ };
@@ -0,0 +1,202 @@
1
+ export const top = `query CatalogContentsQuery($appInfo: AppInfo!, $deviceInfo: DeviceInfo!, $authorization: Authorization!, $filter: ContentFilter, $sort: [ContentComparator!], $first: Int, $after: String, $includeBundledContent: Boolean!, $includeResources: Boolean!, $includeBlocks: Boolean!, $includeHtml: Boolean!, $includeContentSeoMetadata: Boolean!, $propertyFilter: PropertyFilter) {
2
+ catalog(
3
+ appInfo: $appInfo
4
+ deviceInfo: $deviceInfo
5
+ authorization: $authorization
6
+ ) {
7
+ contentsConnection(filter: $filter, sort: $sort, first: $first, after: $after) {
8
+ pageInfo {
9
+ hasNextPage
10
+ endCursor
11
+ }
12
+ totalCount
13
+ edges {
14
+ content: node {
15
+ __typename
16
+ ...ContentFragment
17
+ ...PostFragment
18
+ ...IssueFragment
19
+ ...BundleFragment
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
25
+
26
+ fragment ContentFragment on Content {
27
+ __typename
28
+ id
29
+ version
30
+ name
31
+ description
32
+ index
33
+ alias
34
+ externalId
35
+ publicationDate
36
+ unpublishDate
37
+ lastModified
38
+ access
39
+ productId
40
+ purchaseData {
41
+ purchased
42
+ purchasedBy
43
+ }
44
+ publication {
45
+ id
46
+ }
47
+ properties(filter: $propertyFilter) {
48
+ key
49
+ value
50
+ }
51
+ seoMetadata @include(if: $includeContentSeoMetadata) {
52
+ key
53
+ value
54
+ }
55
+ thumbnails {
56
+ kind
57
+ url
58
+ properties {
59
+ key
60
+ value
61
+ }
62
+ }
63
+ categories
64
+ tags
65
+ }
66
+
67
+ fragment PostFragment on Post {
68
+ postType
69
+ bundleId
70
+ bundles {
71
+ id
72
+ bundleType
73
+ }
74
+ taxonomies {
75
+ ...TaxonomySummaryFragment
76
+ }
77
+ authors {
78
+ name
79
+ email
80
+ }
81
+ bundleId
82
+ content @include(if: $includeBlocks) {
83
+ ...ContentBlockFragment
84
+ }
85
+ previewContentBlocks @include(if: $includeBlocks) {
86
+ ...ContentBlockFragment
87
+ }
88
+ contentHtml @include(if: $includeHtml)
89
+ previewContentHtml @include(if: $includeHtml)
90
+ resources @include(if: $includeResources) {
91
+ id
92
+ url
93
+ type
94
+ contentLength
95
+ properties {
96
+ key
97
+ value
98
+ type
99
+ }
100
+ }
101
+ }
102
+
103
+ fragment ContentBlockFragment on ContentBlock {
104
+ id
105
+ type
106
+ parentId
107
+ children
108
+ sequence
109
+ html
110
+ level
111
+ properties {
112
+ key
113
+ value
114
+ type
115
+ }
116
+ }
117
+
118
+ fragment BundleFragment on Bundle {
119
+ bundleType
120
+ taxonomies {
121
+ ...TaxonomySummaryFragment
122
+ }
123
+ authors {
124
+ name
125
+ email
126
+ }
127
+ contents @include(if: $includeBundledContent) {
128
+ id
129
+ content {
130
+ ...ContentFragment
131
+ ...PostFragment
132
+ }
133
+ }
134
+ }
135
+
136
+ fragment IssueFragment on Issue {
137
+ contentLength
138
+ numberOfPages
139
+ previewContentLength
140
+ resources @include(if: $includeResources) {
141
+ id
142
+ url
143
+ type
144
+ contentLength
145
+ properties {
146
+ key
147
+ value
148
+ type
149
+ }
150
+ }
151
+ }
152
+
153
+ fragment TaxonomySummaryFragment on Taxonomy {
154
+ id
155
+ internalId
156
+ name
157
+ type
158
+ parentId
159
+ seoMetadata @include(if: $includeContentSeoMetadata) {
160
+ key
161
+ value
162
+ }
163
+ properties {
164
+ key
165
+ value
166
+ }
167
+ }`;
168
+
169
+ export const bottom = {
170
+ filter: {
171
+ AND: [
172
+ {
173
+ contentType: {
174
+ value: "ISSUE",
175
+ },
176
+ },
177
+ {},
178
+ ],
179
+ },
180
+ first: 24,
181
+ includeBlocks: false,
182
+ includeHtml: false,
183
+ includeResources: false,
184
+ includeBundledContent: false,
185
+ includeContentSeoMetadata: false,
186
+ appInfo: {
187
+ appId: "",
188
+ appVersion: "1.0-SNAPSHOT",
189
+ preview: true,
190
+ },
191
+ deviceInfo: {
192
+ deviceId: "editor-preview",
193
+ deviceModel: "web",
194
+ locale: "de_DE",
195
+ smallestScreenWidthDp: 0,
196
+ deviceOs: "web",
197
+ platform: "WEB",
198
+ },
199
+ authorization: {
200
+ subscriptionCodes: [],
201
+ },
202
+ };
@@ -1,10 +1,16 @@
1
1
  import * as HandleCategories from "../HandleApiCategories/HandleApiCategories.js";
2
- import * as HandleDossiers from "../HandleApiDossiers/HandleApiDossiers.js";
3
2
  import * as HandleApiDossier from "../HandleApiDossier/HandleApiDossier.js";
3
+ import * as HandleDossiers from "../HandleApiDossiers/HandleApiDossiers.js";
4
+ import * as HandleApiIndex from "../HandleApiIndex/HandleApiIndex.js";
5
+ import * as HandleApiIssues from "../HandleApiIssues/HandleApiIssues.js";
6
+ import * as HandleApiAuthors from "../HandleApiAuthors/HandleApiAuthors.js";
4
7
 
5
8
  export const handleApi =
6
9
  ({ appId }) =>
7
10
  (req, res) => {
11
+ if (req.url === "/") {
12
+ return HandleApiIndex.handleIndex(req, res);
13
+ }
8
14
  if (req.url === "/categories") {
9
15
  return HandleCategories.handleCategories(appId)(req, res);
10
16
  }
@@ -14,6 +20,12 @@ export const handleApi =
14
20
  if (req.url.startsWith("/dossiers")) {
15
21
  return HandleApiDossier.handleDossier(appId)(req, res);
16
22
  }
23
+ if (req.url === "/issues") {
24
+ return HandleApiIssues.handleIssues(appId)(req, res);
25
+ }
26
+ if (req.url === "/authors") {
27
+ return HandleApiAuthors.handleAuthors(appId)(req, res);
28
+ }
17
29
  res.statusCode = 404;
18
30
  return res.end("not found");
19
31
  };
@@ -0,0 +1,34 @@
1
+ import * as GraphQlQueryAuthors from "../GraphQlQueryAuthors/GraphQlQueryAuthors.js";
2
+
3
+ export const handleAuthors = (appId) => async (req, res, next) => {
4
+ const url = `https://catalog.purplemanager.com/graphql`;
5
+ const realBottom = {
6
+ ...GraphQlQueryAuthors.bottom,
7
+ appInfo: {
8
+ ...GraphQlQueryAuthors.bottom.appInfo,
9
+ appId,
10
+ },
11
+ };
12
+ const response = await fetch(url, {
13
+ method: "POST",
14
+ headers: {
15
+ Accept: "application/json",
16
+ "Content-Type": "application/json",
17
+ },
18
+ body: JSON.stringify({
19
+ operationName: "CatalogContentsQuery",
20
+ query: GraphQlQueryAuthors.top,
21
+ variables: realBottom,
22
+ }),
23
+ });
24
+ const result = await response.json();
25
+ // @ts-ignore
26
+ const realData = result.data.catalog.taxonomiesConnection.edges
27
+ .map((edge) => edge.node)
28
+ .map((node) => {
29
+ const { __typename, ...rest } = node;
30
+ return rest;
31
+ });
32
+ res.setHeader("content-type", "application/json");
33
+ res.end(JSON.stringify(realData, null, 2));
34
+ };
@@ -0,0 +1,22 @@
1
+ export const handleIndex = async (req, res, next) => {
2
+ const html = `<!doctype html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Api</title>
8
+ </head>
9
+ <body>
10
+ <ul>
11
+ <li><a href="/api/issues">Issues</a></li>
12
+ <li><a href="/api/dossiers">Dossiers</a></li>
13
+ <li><a href="/api/categories">Categories</a></li>
14
+ <li><a href="/api/articles">Articles</a></li>
15
+ <li><a href="/api/authors">Authors</a></li>
16
+ </ul>
17
+ </body>
18
+ </html>
19
+ `;
20
+ res.setHeader("content-type", "text/html");
21
+ res.end(html);
22
+ };
@@ -0,0 +1,34 @@
1
+ import * as GraphQlQueryIssues from "../GraphQlQueryIssues/GraphQlQueryIssues.js";
2
+
3
+ export const handleIssues = (appId) => async (req, res, next) => {
4
+ const url = `https://catalog.purplemanager.com/graphql`;
5
+ const realBottom = {
6
+ ...GraphQlQueryIssues.bottom,
7
+ appInfo: {
8
+ ...GraphQlQueryIssues.bottom.appInfo,
9
+ appId,
10
+ },
11
+ };
12
+ const response = await fetch(url, {
13
+ method: "POST",
14
+ headers: {
15
+ Accept: "application/json",
16
+ "Content-Type": "application/json",
17
+ },
18
+ body: JSON.stringify({
19
+ operationName: "CatalogContentsQuery",
20
+ query: GraphQlQueryIssues.top,
21
+ variables: realBottom,
22
+ }),
23
+ });
24
+ const result = await response.json();
25
+ // @ts-ignore
26
+ const realData = result.data.catalog.contentsConnection.edges
27
+ .map((edge) => edge.content)
28
+ .map((node) => {
29
+ const { __typename, ...rest } = node;
30
+ return rest;
31
+ });
32
+ res.setHeader("content-type", "application/json");
33
+ res.send(JSON.stringify(realData, null, 2));
34
+ };
@@ -1 +1 @@
1
- export const version = '12.8.0'
1
+ export const version = '12.10.0'