@pronto-tools-and-more/pronto 12.23.0 → 12.25.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,34 +1,35 @@
1
1
  import * as GraphQlQueryIssues from "../GraphQlQueryIssues/GraphQlQueryIssues.js";
2
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;
3
+ export const handleIssues =
4
+ ({ appId, apiUrl }) =>
5
+ async (req, res, next) => {
6
+ const realBottom = {
7
+ ...GraphQlQueryIssues.bottom,
8
+ appInfo: {
9
+ ...GraphQlQueryIssues.bottom.appInfo,
10
+ appId,
11
+ },
12
+ };
13
+ const response = await fetch(apiUrl, {
14
+ method: "POST",
15
+ headers: {
16
+ Accept: "application/json",
17
+ "Content-Type": "application/json",
18
+ },
19
+ body: JSON.stringify({
20
+ operationName: "CatalogContentsQuery",
21
+ query: GraphQlQueryIssues.top,
22
+ variables: realBottom,
23
+ }),
31
24
  });
32
- res.setHeader("content-type", "application/json");
33
- res.send(JSON.stringify(realData, null, 2));
34
- };
25
+ const result = await response.json();
26
+ // @ts-ignore
27
+ const realData = result.data.catalog.contentsConnection.edges
28
+ .map((edge) => edge.content)
29
+ .map((node) => {
30
+ const { __typename, ...rest } = node;
31
+ return rest;
32
+ });
33
+ res.setHeader("content-type", "application/json");
34
+ res.send(JSON.stringify(realData, null, 2));
35
+ };
@@ -1 +1 @@
1
- export const version = '12.23.0'
1
+ export const version = '12.25.0'