@pronto-tools-and-more/pronto 12.7.0 → 12.9.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.7.0",
3
+ "version": "12.9.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.7.0",
21
- "@pronto-tools-and-more/files": "12.7.0",
22
- "@pronto-tools-and-more/network-process": "12.7.0",
23
- "@pronto-tools-and-more/sass-compiler": "12.7.0",
24
- "@pronto-tools-and-more/components-renderer": "12.7.0",
25
- "@pronto-tools-and-more/components": "12.7.0",
26
- "@pronto-tools-and-more/schema-process": "12.7.0",
27
- "@pronto-tools-and-more/diff-process": "12.7.0",
28
- "@pronto-tools-and-more/type-checker": "12.7.0",
29
- "@pronto-tools-and-more/custom-js-functions": "12.7.0",
20
+ "@pronto-tools-and-more/file-watcher": "12.9.0",
21
+ "@pronto-tools-and-more/files": "12.9.0",
22
+ "@pronto-tools-and-more/network-process": "12.9.0",
23
+ "@pronto-tools-and-more/sass-compiler": "12.9.0",
24
+ "@pronto-tools-and-more/components-renderer": "12.9.0",
25
+ "@pronto-tools-and-more/components": "12.9.0",
26
+ "@pronto-tools-and-more/schema-process": "12.9.0",
27
+ "@pronto-tools-and-more/diff-process": "12.9.0",
28
+ "@pronto-tools-and-more/type-checker": "12.9.0",
29
+ "@pronto-tools-and-more/custom-js-functions": "12.9.0",
30
30
  "execa": "^9.5.2",
31
31
  "express": "^4.21.2"
32
32
  },
@@ -1,6 +1,7 @@
1
1
  import express from "express";
2
2
  import { join } from "node:path";
3
3
  import * as FilesPath from "../FilesPath/FilesPath.js";
4
+ import * as HandleApi from "../HandleApi/HandleApi.js";
4
5
  import * as HandleConfigLoader from "../HandleConfigLoader/HandleConfigLoader.js";
5
6
  import * as HandleCss from "../HandleCss/HandleCss.js";
6
7
  import * as HandleCustomServer from "../HandleCustomServer/HandleCustomServer.js";
@@ -9,8 +10,6 @@ import * as HandleIndex from "../HandleIndex/HandleIndex.js";
9
10
  import * as HandleMainJs from "../HandleMainJs/HandleMainJs.js";
10
11
  import * as HandleViews from "../HandleViews/HandleViews.js";
11
12
  import * as ProxyPath from "../ProxyPath/ProxyPath.js";
12
- import * as HandleTaxonomies from "../HandleTaxonomies/HandleTaxonomies.js";
13
- import * as HandleCategories from "../HandleCategories/HandleCategories.js";
14
13
 
15
14
  export const create = ({
16
15
  root,
@@ -91,7 +90,7 @@ export const create = ({
91
90
  injectCustomJs,
92
91
  })
93
92
  );
94
- app.get("/api/categories", HandleCategories.handleCategories(appId));
93
+ app.use("/api", HandleApi.handleApi({ appId }));
95
94
  app.use("*", HandleCss.handleCss(storeFrontPath, rootSassFile));
96
95
  app.use(express.static(FilesPath.filesPath));
97
96
  app.use(express.static(storeFrontPath));
@@ -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,221 @@
1
+ export const top1 = `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
+ edges {
13
+ content: node {
14
+ __typename
15
+ ...ContentFragment
16
+ ...PostFragment
17
+ ...IssueFragment
18
+ ...BundleFragment
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+
25
+ fragment ContentFragment on Content {
26
+ __typename
27
+ id
28
+ version
29
+ name
30
+ description
31
+ index
32
+ alias
33
+ externalId
34
+ publicationDate
35
+ unpublishDate
36
+ lastModified
37
+ access
38
+ productId
39
+ purchaseData {
40
+ purchased
41
+ purchasedBy
42
+ }
43
+ publication {
44
+ id
45
+ }
46
+ properties(filter: $propertyFilter) {
47
+ key
48
+ value
49
+ }
50
+ seoMetadata @include(if: $includeContentSeoMetadata) {
51
+ key
52
+ value
53
+ }
54
+ thumbnails {
55
+ kind
56
+ url
57
+ properties {
58
+ key
59
+ value
60
+ }
61
+ }
62
+ categories
63
+ tags
64
+ }
65
+
66
+ fragment PostFragment on Post {
67
+ postType
68
+ bundleId
69
+ bundles {
70
+ id
71
+ bundleType
72
+ }
73
+ taxonomies {
74
+ ...TaxonomySummaryFragment
75
+ }
76
+ authors {
77
+ name
78
+ email
79
+ }
80
+ bundleId
81
+ content @include(if: $includeBlocks) {
82
+ ...ContentBlockFragment
83
+ }
84
+ previewContentBlocks @include(if: $includeBlocks) {
85
+ ...ContentBlockFragment
86
+ }
87
+ contentHtml @include(if: $includeHtml)
88
+ previewContentHtml @include(if: $includeHtml)
89
+ resources @include(if: $includeResources) {
90
+ id
91
+ url
92
+ type
93
+ contentLength
94
+ properties {
95
+ key
96
+ value
97
+ type
98
+ }
99
+ }
100
+ }
101
+
102
+ fragment ContentBlockFragment on ContentBlock {
103
+ id
104
+ type
105
+ parentId
106
+ children
107
+ sequence
108
+ html
109
+ level
110
+ properties {
111
+ key
112
+ value
113
+ type
114
+ }
115
+ }
116
+
117
+ fragment BundleFragment on Bundle {
118
+ bundleType
119
+ taxonomies {
120
+ ...TaxonomySummaryFragment
121
+ }
122
+ authors {
123
+ name
124
+ email
125
+ }
126
+ contents @include(if: $includeBundledContent) {
127
+ id
128
+ content {
129
+ ...ContentFragment
130
+ ...PostFragment
131
+ }
132
+ }
133
+ }
134
+
135
+ fragment IssueFragment on Issue {
136
+ contentLength
137
+ numberOfPages
138
+ previewContentLength
139
+ resources @include(if: $includeResources) {
140
+ id
141
+ url
142
+ type
143
+ contentLength
144
+ properties {
145
+ key
146
+ value
147
+ type
148
+ }
149
+ }
150
+ }
151
+
152
+ fragment TaxonomySummaryFragment on Taxonomy {
153
+ id
154
+ internalId
155
+ name
156
+ type
157
+ parentId
158
+ seoMetadata @include(if: $includeContentSeoMetadata) {
159
+ key
160
+ value
161
+ }
162
+ properties {
163
+ key
164
+ value
165
+ }
166
+ }`;
167
+
168
+ export const bottom1 = {
169
+ filter: {
170
+ AND: [
171
+ {
172
+ postType: {
173
+ value: "post",
174
+ },
175
+ },
176
+ {
177
+ contentType: {
178
+ value: "POST",
179
+ },
180
+ },
181
+ {
182
+ AND: [
183
+ {
184
+ bundleId: {
185
+ value: "id",
186
+ },
187
+ },
188
+ ],
189
+ },
190
+ ],
191
+ },
192
+ sort: [
193
+ {
194
+ publicationDate: {
195
+ direction: "DESC",
196
+ },
197
+ },
198
+ ],
199
+ first: 1,
200
+ includeBlocks: false,
201
+ includeHtml: false,
202
+ includeResources: false,
203
+ includeBundledContent: false,
204
+ includeContentSeoMetadata: false,
205
+ appInfo: {
206
+ appId: "",
207
+ appVersion: "1.0-SNAPSHOT",
208
+ preview: true,
209
+ },
210
+ deviceInfo: {
211
+ deviceId: "editor-preview",
212
+ deviceModel: "web",
213
+ locale: "de_DE",
214
+ smallestScreenWidthDp: 0,
215
+ deviceOs: "web",
216
+ platform: "WEB",
217
+ },
218
+ authorization: {
219
+ subscriptionCodes: [],
220
+ },
221
+ };
@@ -0,0 +1,201 @@
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
+ edges {
13
+ content: node {
14
+ __typename
15
+ ...ContentFragment
16
+ ...PostFragment
17
+ ...IssueFragment
18
+ ...BundleFragment
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+
25
+ fragment ContentFragment on Content {
26
+ __typename
27
+ id
28
+ version
29
+ name
30
+ description
31
+ index
32
+ alias
33
+ externalId
34
+ publicationDate
35
+ unpublishDate
36
+ lastModified
37
+ access
38
+ productId
39
+ purchaseData {
40
+ purchased
41
+ purchasedBy
42
+ }
43
+ publication {
44
+ id
45
+ }
46
+ properties(filter: $propertyFilter) {
47
+ key
48
+ value
49
+ }
50
+ seoMetadata @include(if: $includeContentSeoMetadata) {
51
+ key
52
+ value
53
+ }
54
+ thumbnails {
55
+ kind
56
+ url
57
+ properties {
58
+ key
59
+ value
60
+ }
61
+ }
62
+ categories
63
+ tags
64
+ }
65
+
66
+ fragment PostFragment on Post {
67
+ postType
68
+ bundleId
69
+ bundles {
70
+ id
71
+ bundleType
72
+ }
73
+ taxonomies {
74
+ ...TaxonomySummaryFragment
75
+ }
76
+ authors {
77
+ name
78
+ email
79
+ }
80
+ bundleId
81
+ content @include(if: $includeBlocks) {
82
+ ...ContentBlockFragment
83
+ }
84
+ previewContentBlocks @include(if: $includeBlocks) {
85
+ ...ContentBlockFragment
86
+ }
87
+ contentHtml @include(if: $includeHtml)
88
+ previewContentHtml @include(if: $includeHtml)
89
+ resources @include(if: $includeResources) {
90
+ id
91
+ url
92
+ type
93
+ contentLength
94
+ properties {
95
+ key
96
+ value
97
+ type
98
+ }
99
+ }
100
+ }
101
+
102
+ fragment ContentBlockFragment on ContentBlock {
103
+ id
104
+ type
105
+ parentId
106
+ children
107
+ sequence
108
+ html
109
+ level
110
+ properties {
111
+ key
112
+ value
113
+ type
114
+ }
115
+ }
116
+
117
+ fragment BundleFragment on Bundle {
118
+ bundleType
119
+ taxonomies {
120
+ ...TaxonomySummaryFragment
121
+ }
122
+ authors {
123
+ name
124
+ email
125
+ }
126
+ contents @include(if: $includeBundledContent) {
127
+ id
128
+ content {
129
+ ...ContentFragment
130
+ ...PostFragment
131
+ }
132
+ }
133
+ }
134
+
135
+ fragment IssueFragment on Issue {
136
+ contentLength
137
+ numberOfPages
138
+ previewContentLength
139
+ resources @include(if: $includeResources) {
140
+ id
141
+ url
142
+ type
143
+ contentLength
144
+ properties {
145
+ key
146
+ value
147
+ type
148
+ }
149
+ }
150
+ }
151
+
152
+ fragment TaxonomySummaryFragment on Taxonomy {
153
+ id
154
+ internalId
155
+ name
156
+ type
157
+ parentId
158
+ seoMetadata @include(if: $includeContentSeoMetadata) {
159
+ key
160
+ value
161
+ }
162
+ properties {
163
+ key
164
+ value
165
+ }
166
+ }`;
167
+
168
+ export const bottom = {
169
+ filter: {
170
+ AND: [
171
+ {
172
+ bundleType: {
173
+ value: "DOSSIER",
174
+ },
175
+ },
176
+ ],
177
+ },
178
+ sort: [],
179
+ first: 12,
180
+ includeBlocks: false,
181
+ includeHtml: false,
182
+ includeResources: false,
183
+ includeBundledContent: false,
184
+ includeContentSeoMetadata: false,
185
+ appInfo: {
186
+ appId: "",
187
+ appVersion: "1.0-SNAPSHOT",
188
+ preview: true,
189
+ },
190
+ deviceInfo: {
191
+ deviceId: "editor-preview",
192
+ deviceModel: "web",
193
+ locale: "de_DE",
194
+ smallestScreenWidthDp: 0,
195
+ deviceOs: "web",
196
+ platform: "WEB",
197
+ },
198
+ authorization: {
199
+ subscriptionCodes: [],
200
+ },
201
+ };
@@ -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
+ };
@@ -0,0 +1,57 @@
1
+ export const top1 = `query LookupPathSegmentsQuery($appInfo: AppInfo!, $deviceInfo: DeviceInfo!, $authorization: Authorization!, $pathSegments: [String!]!) {
2
+ catalog(
3
+ appInfo: $appInfo
4
+ deviceInfo: $deviceInfo
5
+ authorization: $authorization
6
+ ) {
7
+ lookupPathSegments(pathSegments: $pathSegments) {
8
+ identifier
9
+ matches {
10
+ __typename
11
+ ... on ContentMatch {
12
+ id
13
+ contentType
14
+ postType
15
+ }
16
+ ... on TaxonomyMatch {
17
+ id
18
+ identifier
19
+ parentIdentifier
20
+ name
21
+ taxonomyType
22
+ }
23
+ ... on CollectionMatch {
24
+ id
25
+ name
26
+ }
27
+ ... on RedirectMatch {
28
+ id
29
+ identifier
30
+ redirectType
31
+ target
32
+ statusCode
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }`;
38
+
39
+ export const bottom1 = {
40
+ pathSegments: [],
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
+ smallestScreenWidthDp: 0,
51
+ deviceOs: "web",
52
+ platform: "WEB",
53
+ },
54
+ authorization: {
55
+ subscriptionCodes: [],
56
+ },
57
+ };
@@ -0,0 +1,31 @@
1
+ import * as HandleCategories from "../HandleApiCategories/HandleApiCategories.js";
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";
7
+
8
+ export const handleApi =
9
+ ({ appId }) =>
10
+ (req, res) => {
11
+ if (req.url === "/") {
12
+ return HandleApiIndex.handleIndex(req, res);
13
+ }
14
+ if (req.url === "/categories") {
15
+ return HandleCategories.handleCategories(appId)(req, res);
16
+ }
17
+ if (req.url === "/dossiers") {
18
+ return HandleDossiers.handleDossiers(appId)(req, res);
19
+ }
20
+ if (req.url.startsWith("/dossiers")) {
21
+ return HandleApiDossier.handleDossier(appId)(req, res);
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
+ }
29
+ res.statusCode = 404;
30
+ return res.end("not found");
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
+ };
@@ -29,5 +29,6 @@ export const handleCategories = (appId) => async (req, res, next) => {
29
29
  const { __typename, ...rest } = node;
30
30
  return rest;
31
31
  });
32
+ res.setHeader("content-type", "application/json");
32
33
  res.end(JSON.stringify(realData, null, 2));
33
34
  };
@@ -0,0 +1,103 @@
1
+ import * as GraphQlQueryPathSegment from "../GraphQlQueryPathSegment/GraphQlQueryPathSegment.js";
2
+ import * as GraphQlQueryDossier from "../GraphQlQueryDossier/GraphQlQueryDossier.js";
3
+
4
+ const getBundleId = async ({ appId, reqUrl }) => {
5
+ const url = `https://catalog.purplemanager.com/graphql`;
6
+ const part = reqUrl.slice("/dossiers".length + 1);
7
+ const realBottom = {
8
+ ...GraphQlQueryPathSegment.bottom1,
9
+ appInfo: {
10
+ ...GraphQlQueryPathSegment.bottom1.appInfo,
11
+ appId,
12
+ },
13
+ pathSegments: [part],
14
+ };
15
+ const response = await fetch(url, {
16
+ method: "POST",
17
+ headers: {
18
+ Accept: "application/json",
19
+ "Content-Type": "application/json",
20
+ },
21
+ body: JSON.stringify({
22
+ operationName: "LookupPathSegmentsQuery",
23
+ query: GraphQlQueryPathSegment.top1,
24
+ variables: realBottom,
25
+ }),
26
+ });
27
+ const result = await response.json();
28
+ // @ts-ignore
29
+ const items = result.data.catalog.lookupPathSegments.flatMap(
30
+ (item) => item.matches
31
+ );
32
+ if (items.length === 0) {
33
+ return "";
34
+ }
35
+ const id = items[0].id;
36
+ return id;
37
+ };
38
+
39
+ export const handleDossier = (appId) => async (req, res, next) => {
40
+ const bundleId = await getBundleId({
41
+ appId,
42
+ reqUrl: req.url,
43
+ });
44
+ if (!bundleId) {
45
+ res.statusCode = 404;
46
+ res.end("Not found");
47
+ return;
48
+ }
49
+ const url = `https://catalog.purplemanager.com/graphql`;
50
+ const realBottom = {
51
+ ...GraphQlQueryDossier.bottom1,
52
+ appInfo: {
53
+ ...GraphQlQueryDossier.bottom1.appInfo,
54
+ appId,
55
+ },
56
+ filter: {
57
+ AND: [
58
+ {
59
+ postType: {
60
+ value: "post",
61
+ },
62
+ },
63
+ {
64
+ contentType: {
65
+ value: "POST",
66
+ },
67
+ },
68
+ {
69
+ AND: [
70
+ {
71
+ bundleId: {
72
+ value: bundleId,
73
+ },
74
+ },
75
+ ],
76
+ },
77
+ ],
78
+ },
79
+ };
80
+ const response = await fetch(url, {
81
+ method: "POST",
82
+ headers: {
83
+ Accept: "application/json",
84
+ "Content-Type": "application/json",
85
+ },
86
+ body: JSON.stringify({
87
+ operationName: "CatalogContentsQuery",
88
+ query: GraphQlQueryDossier.top1,
89
+ variables: realBottom,
90
+ }),
91
+ });
92
+ const result = await response.json();
93
+ // @ts-ignore
94
+ const realData = result.data.catalog.contentsConnection.edges
95
+ .map((edge) => edge.content)
96
+ .map((node) => {
97
+ const { __typename, ...rest } = node;
98
+ return rest;
99
+ });
100
+
101
+ res.setHeader("content-type", "application/json");
102
+ res.send(JSON.stringify(realData, null, 2));
103
+ };
@@ -0,0 +1,35 @@
1
+ import * as GraphQlQueryDossiers from "../GraphQlQueryDossiers/GraphQlQueryDossiers.js";
2
+
3
+ export const handleDossiers = (appId) => async (req, res, next) => {
4
+ const url = `https://catalog.purplemanager.com/graphql`;
5
+ const realBottom = {
6
+ ...GraphQlQueryDossiers.bottom,
7
+ appInfo: {
8
+ ...GraphQlQueryDossiers.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: GraphQlQueryDossiers.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
+
33
+ res.setHeader("content-type", "application/json");
34
+ res.send(JSON.stringify(realData, null, 2));
35
+ };
@@ -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.7.0'
1
+ export const version = '12.9.0'