@pronto-tools-and-more/api 12.39.0 → 12.41.0
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
CHANGED
@@ -0,0 +1,241 @@
|
|
1
|
+
export const top = `query CatalogTaxonomiesQuery($appInfo: AppInfo!, $deviceInfo: DeviceInfo!, $authorization: Authorization!, $filter: TaxonomyFilter, $sort: [TaxonomyComparator!], $first: Int, $after: String, $includeTaxonomySeoMetadata: Boolean!, $includeContents: Boolean!, $contentFilter: ContentFilter, $contentSort: [ContentComparator!], $contentFirst: Int, $contentAfter: 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
|
+
taxonomiesConnection(first: $first, after: $after, sort: $sort, filter: $filter) {
|
8
|
+
pageInfo {
|
9
|
+
hasNextPage
|
10
|
+
endCursor
|
11
|
+
}
|
12
|
+
edges {
|
13
|
+
node {
|
14
|
+
__typename
|
15
|
+
...TaxonomyFragment
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
fragment TaxonomyFragment on Taxonomy {
|
23
|
+
id
|
24
|
+
internalId
|
25
|
+
name
|
26
|
+
description
|
27
|
+
type
|
28
|
+
parentId
|
29
|
+
seoMetadata @include(if: $includeTaxonomySeoMetadata) {
|
30
|
+
key
|
31
|
+
value
|
32
|
+
}
|
33
|
+
properties {
|
34
|
+
key
|
35
|
+
value
|
36
|
+
}
|
37
|
+
thumbnails {
|
38
|
+
kind
|
39
|
+
url
|
40
|
+
properties {
|
41
|
+
key
|
42
|
+
value
|
43
|
+
}
|
44
|
+
}
|
45
|
+
contentsConnection(
|
46
|
+
filter: $contentFilter
|
47
|
+
sort: $contentSort
|
48
|
+
first: $contentFirst
|
49
|
+
after: $contentAfter
|
50
|
+
) @include(if: $includeContents) {
|
51
|
+
pageInfo {
|
52
|
+
hasNextPage
|
53
|
+
endCursor
|
54
|
+
}
|
55
|
+
edges {
|
56
|
+
node {
|
57
|
+
...ContentFragment
|
58
|
+
...IssueFragment
|
59
|
+
...PostFragment
|
60
|
+
...BundleFragment
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
fragment ContentFragment on Content {
|
67
|
+
__typename
|
68
|
+
id
|
69
|
+
version
|
70
|
+
name
|
71
|
+
description
|
72
|
+
index
|
73
|
+
alias
|
74
|
+
externalId
|
75
|
+
publicationDate
|
76
|
+
unpublishDate
|
77
|
+
lastModified
|
78
|
+
access
|
79
|
+
productId
|
80
|
+
purchaseData {
|
81
|
+
purchased
|
82
|
+
purchasedBy
|
83
|
+
}
|
84
|
+
publication {
|
85
|
+
id
|
86
|
+
}
|
87
|
+
properties(filter: $propertyFilter) {
|
88
|
+
key
|
89
|
+
value
|
90
|
+
}
|
91
|
+
seoMetadata @include(if: $includeContentSeoMetadata) {
|
92
|
+
key
|
93
|
+
value
|
94
|
+
}
|
95
|
+
thumbnails {
|
96
|
+
kind
|
97
|
+
url
|
98
|
+
properties {
|
99
|
+
key
|
100
|
+
value
|
101
|
+
}
|
102
|
+
}
|
103
|
+
categories
|
104
|
+
tags
|
105
|
+
}
|
106
|
+
|
107
|
+
fragment IssueFragment on Issue {
|
108
|
+
contentLength
|
109
|
+
numberOfPages
|
110
|
+
previewContentLength
|
111
|
+
resources @include(if: $includeResources) {
|
112
|
+
id
|
113
|
+
url
|
114
|
+
type
|
115
|
+
contentLength
|
116
|
+
properties {
|
117
|
+
key
|
118
|
+
value
|
119
|
+
type
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
fragment PostFragment on Post {
|
125
|
+
postType
|
126
|
+
bundleId
|
127
|
+
bundles {
|
128
|
+
id
|
129
|
+
bundleType
|
130
|
+
}
|
131
|
+
taxonomies {
|
132
|
+
...TaxonomySummaryFragment
|
133
|
+
}
|
134
|
+
authors {
|
135
|
+
name
|
136
|
+
email
|
137
|
+
}
|
138
|
+
bundleId
|
139
|
+
content @include(if: $includeBlocks) {
|
140
|
+
...ContentBlockFragment
|
141
|
+
}
|
142
|
+
previewContentBlocks @include(if: $includeBlocks) {
|
143
|
+
...ContentBlockFragment
|
144
|
+
}
|
145
|
+
contentHtml @include(if: $includeHtml)
|
146
|
+
previewContentHtml @include(if: $includeHtml)
|
147
|
+
resources @include(if: $includeResources) {
|
148
|
+
id
|
149
|
+
url
|
150
|
+
type
|
151
|
+
contentLength
|
152
|
+
properties {
|
153
|
+
key
|
154
|
+
value
|
155
|
+
type
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
fragment ContentBlockFragment on ContentBlock {
|
161
|
+
id
|
162
|
+
type
|
163
|
+
parentId
|
164
|
+
children
|
165
|
+
sequence
|
166
|
+
html
|
167
|
+
level
|
168
|
+
properties {
|
169
|
+
key
|
170
|
+
value
|
171
|
+
type
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
fragment BundleFragment on Bundle {
|
176
|
+
bundleType
|
177
|
+
taxonomies {
|
178
|
+
...TaxonomySummaryFragment
|
179
|
+
}
|
180
|
+
authors {
|
181
|
+
name
|
182
|
+
email
|
183
|
+
}
|
184
|
+
contents @include(if: $includeBundledContent) {
|
185
|
+
id
|
186
|
+
content {
|
187
|
+
...ContentFragment
|
188
|
+
...PostFragment
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
fragment TaxonomySummaryFragment on Taxonomy {
|
194
|
+
id
|
195
|
+
internalId
|
196
|
+
name
|
197
|
+
type
|
198
|
+
parentId
|
199
|
+
seoMetadata @include(if: $includeContentSeoMetadata) {
|
200
|
+
key
|
201
|
+
value
|
202
|
+
}
|
203
|
+
properties {
|
204
|
+
key
|
205
|
+
value
|
206
|
+
}
|
207
|
+
}`;
|
208
|
+
|
209
|
+
export const bottom = {
|
210
|
+
filter: {
|
211
|
+
id: {
|
212
|
+
value: "celine-bichay",
|
213
|
+
},
|
214
|
+
},
|
215
|
+
first: 1,
|
216
|
+
includeTaxonomySeoMetadata: false,
|
217
|
+
includeContents: false,
|
218
|
+
includeBundledContent: false,
|
219
|
+
includeResources: false,
|
220
|
+
includeBlocks: false,
|
221
|
+
includeHtml: false,
|
222
|
+
includeContentSeoMetadata: false,
|
223
|
+
appInfo: {
|
224
|
+
appId: "b745c9ad-2d2e-4515-92a0-d0a2baed181e",
|
225
|
+
appVersion: "1.0-SNAPSHOT",
|
226
|
+
preview: true,
|
227
|
+
},
|
228
|
+
deviceInfo: {
|
229
|
+
deviceId: "editor-preview",
|
230
|
+
deviceModel: "web",
|
231
|
+
locale: "de_DE",
|
232
|
+
smallestScreenWidthDp: 0,
|
233
|
+
deviceOs: "web",
|
234
|
+
platform: "WEB",
|
235
|
+
},
|
236
|
+
authorization: {
|
237
|
+
subscriptionCodes: [],
|
238
|
+
},
|
239
|
+
};
|
240
|
+
|
241
|
+
export const operationName = "CatalogTaxonomiesQuery";
|
@@ -6,6 +6,7 @@ import * as HandleApiCollections from "../HandleApiCollections/HandleApiCollecti
|
|
6
6
|
import * as HandleApiDossier from "../HandleApiDossier/HandleApiDossier.js";
|
7
7
|
import * as HandleDossiers from "../HandleApiDossiers/HandleApiDossiers.js";
|
8
8
|
import * as HandleApiIndex from "../HandleApiIndex/HandleApiIndex.js";
|
9
|
+
import * as HandleApiAuthor from "../HandleApiAuthor/HandleApiAuthor.js";
|
9
10
|
import * as HandleApiAppSettings from "../HandleApiAppSettings/HandleApiAppSettings.js";
|
10
11
|
import * as HandleApiIssues from "../HandleApiIssues/HandleApiIssues.js";
|
11
12
|
import * as HandleApiMenus from "../HandleApiMenus/HandleApiMenus.js";
|
@@ -32,6 +33,9 @@ export const handleApi = ({ appId, apiUrl, req }) => {
|
|
32
33
|
if (req.url === "/authors") {
|
33
34
|
return HandleApiAuthors.handleAuthors({ appId, apiUrl, req });
|
34
35
|
}
|
36
|
+
if (req.url.startsWith("/authors/")) {
|
37
|
+
return HandleApiAuthor.handleAuthor({ appId, apiUrl, req });
|
38
|
+
}
|
35
39
|
if (req.url.startsWith("/articles")) {
|
36
40
|
return HandleApiArticle.handleApiArticle({ appId, apiUrl, req });
|
37
41
|
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import * as GraphQlQueryAuthor from "../GraphQlQueryAuthor/GraphQlQueryAuthor.js";
|
2
|
+
|
3
|
+
export const handleAuthor = async ({ appId, apiUrl, req }) => {
|
4
|
+
const firstPart = "/authors/";
|
5
|
+
const secondPart = req.url.slice(firstPart.length);
|
6
|
+
const realBottom = {
|
7
|
+
...GraphQlQueryAuthor.bottom,
|
8
|
+
appInfo: {
|
9
|
+
...GraphQlQueryAuthor.bottom.appInfo,
|
10
|
+
appId,
|
11
|
+
},
|
12
|
+
filter: {
|
13
|
+
id: {
|
14
|
+
value: secondPart,
|
15
|
+
},
|
16
|
+
},
|
17
|
+
};
|
18
|
+
const response = await fetch(apiUrl, {
|
19
|
+
method: "POST",
|
20
|
+
headers: {
|
21
|
+
Accept: "application/json",
|
22
|
+
"Content-Type": "application/json",
|
23
|
+
},
|
24
|
+
body: JSON.stringify({
|
25
|
+
operationName: GraphQlQueryAuthor.operationName,
|
26
|
+
query: GraphQlQueryAuthor.top,
|
27
|
+
variables: realBottom,
|
28
|
+
}),
|
29
|
+
});
|
30
|
+
const result = await response.json();
|
31
|
+
// @ts-ignore
|
32
|
+
if (result.errors) {
|
33
|
+
// @ts-ignore
|
34
|
+
throw new Error(result.errors[0].message);
|
35
|
+
}
|
36
|
+
// @ts-ignore
|
37
|
+
const realData = result.data.catalog.taxonomiesConnection.edges
|
38
|
+
.map((edge) => edge.node)
|
39
|
+
.map((node) => {
|
40
|
+
const { __typename, ...rest } = node;
|
41
|
+
return rest;
|
42
|
+
});
|
43
|
+
return {
|
44
|
+
status: 200,
|
45
|
+
headers: {
|
46
|
+
"content-type": "application/json",
|
47
|
+
},
|
48
|
+
body: JSON.stringify(realData, null, 2),
|
49
|
+
};
|
50
|
+
};
|