@evenicanpm/admin-graphql-codegen 1.0.0 → 1.2.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/codegen.ts +21 -20
- package/documents/search-engine/aliases.ts +80 -1
- package/documents/search-engine/indexes.ts +73 -0
- package/documents/seo/generate-sitemap.ts +13 -0
- package/documents/seo/sitemap-schedule.ts +12 -0
- package/documents/seo/update-sitemap-schedule.ts +14 -0
- package/package.json +20 -20
- package/test.js +7 -7
package/codegen.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import type { CodegenConfig } from "@graphql-codegen/cli";
|
|
2
2
|
|
|
3
3
|
const config: CodegenConfig = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
schema: "https://api.e4.local/graphql",
|
|
5
|
+
documents: [
|
|
6
|
+
"./documents/**/*.ts",
|
|
7
|
+
"../admin-integrate/documents/**/*.ts",
|
|
8
|
+
"!./documents/core/**",
|
|
9
|
+
"!./documents/base/**",
|
|
10
|
+
],
|
|
11
|
+
generates: {
|
|
12
|
+
"./index.ts": {
|
|
13
|
+
plugins: [
|
|
14
|
+
"typescript",
|
|
15
|
+
"typescript-operations",
|
|
16
|
+
"typescript-graphql-request",
|
|
17
|
+
],
|
|
18
|
+
config: {
|
|
19
|
+
preset: "client",
|
|
20
|
+
rawRequest: true,
|
|
21
|
+
documentMode: "documentNode",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
export default config;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import gql from "graphql-tag";
|
|
2
|
+
|
|
3
|
+
const GET_ALIAS = gql`
|
|
4
|
+
query alias($name: String!) {
|
|
5
|
+
alias(name: $name) {
|
|
6
|
+
alias
|
|
7
|
+
index
|
|
8
|
+
lastIndexed
|
|
9
|
+
indexDetails {
|
|
10
|
+
health
|
|
11
|
+
status
|
|
12
|
+
docsCount
|
|
13
|
+
storeSize
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
2
18
|
|
|
3
19
|
const GET_ALIASES = gql`
|
|
4
20
|
query aliases {
|
|
@@ -15,3 +31,66 @@ const GET_ALIASES = gql`
|
|
|
15
31
|
}
|
|
16
32
|
}
|
|
17
33
|
`;
|
|
34
|
+
|
|
35
|
+
const MAPPING_BY_ALIAS = gql`
|
|
36
|
+
query mapping($alias: String!) {
|
|
37
|
+
indexFieldTypes {
|
|
38
|
+
key
|
|
39
|
+
value
|
|
40
|
+
}
|
|
41
|
+
mapping(alias: $alias) {
|
|
42
|
+
id
|
|
43
|
+
parentId
|
|
44
|
+
fieldName
|
|
45
|
+
displayName
|
|
46
|
+
fieldType
|
|
47
|
+
searchable
|
|
48
|
+
facetable
|
|
49
|
+
sortable
|
|
50
|
+
suggestable
|
|
51
|
+
isKey
|
|
52
|
+
sort
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const BULK_MAPPPING = gql`
|
|
58
|
+
mutation bulkMapping(
|
|
59
|
+
$alias: String!
|
|
60
|
+
$createMappings: [MappingFieldInput!]!
|
|
61
|
+
$updateMappings: [MappingFieldInput!]!
|
|
62
|
+
$deleteMappings: [DeleteMappingFieldInput!]!
|
|
63
|
+
) {
|
|
64
|
+
createMappings(alias: $alias, mapping: $createMappings) {
|
|
65
|
+
id
|
|
66
|
+
parentId
|
|
67
|
+
fieldName
|
|
68
|
+
fieldType
|
|
69
|
+
displayName
|
|
70
|
+
isKey
|
|
71
|
+
sort
|
|
72
|
+
searchable
|
|
73
|
+
facetable
|
|
74
|
+
sortable
|
|
75
|
+
suggestable
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
updateMappings(mapping: $updateMappings) {
|
|
79
|
+
id
|
|
80
|
+
parentId
|
|
81
|
+
fieldName
|
|
82
|
+
fieldType
|
|
83
|
+
displayName
|
|
84
|
+
isKey
|
|
85
|
+
sort
|
|
86
|
+
searchable
|
|
87
|
+
facetable
|
|
88
|
+
sortable
|
|
89
|
+
suggestable
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
deleteMappingFields(ids: $deleteMappings) {
|
|
93
|
+
id
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import gql from "graphql-tag";
|
|
2
|
+
|
|
3
|
+
const GET_INDEXES = gql`
|
|
4
|
+
query indexes {
|
|
5
|
+
indexes {
|
|
6
|
+
id
|
|
7
|
+
health
|
|
8
|
+
index
|
|
9
|
+
docsCount
|
|
10
|
+
storeSize
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const GET_INDEX_HISTORY = gql`
|
|
16
|
+
query indexHistory($alias: String, $status: String) {
|
|
17
|
+
indexHistory(alias: $alias, status: $status) {
|
|
18
|
+
id
|
|
19
|
+
index
|
|
20
|
+
status
|
|
21
|
+
isActiveIndex
|
|
22
|
+
executionTime
|
|
23
|
+
errorCount
|
|
24
|
+
indexedItemsCount
|
|
25
|
+
endTime
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const REINDEX_INDEX_HISTORY = gql`
|
|
31
|
+
mutation reindex($index: String!) {
|
|
32
|
+
reindex(index: $index) {
|
|
33
|
+
index
|
|
34
|
+
id
|
|
35
|
+
status
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const SWAP_INDEX = gql`
|
|
41
|
+
mutation swapIndex($newIndex: String, $oldIndex: String) {
|
|
42
|
+
swapIndex(newIndex: $newIndex, oldIndex: $oldIndex) {
|
|
43
|
+
# alias,
|
|
44
|
+
# index,
|
|
45
|
+
# filter,
|
|
46
|
+
# is_write_index,
|
|
47
|
+
# lastIndexed
|
|
48
|
+
code
|
|
49
|
+
success
|
|
50
|
+
indexExecution {
|
|
51
|
+
id
|
|
52
|
+
index
|
|
53
|
+
executionTime
|
|
54
|
+
status
|
|
55
|
+
startTime
|
|
56
|
+
endTime
|
|
57
|
+
alias
|
|
58
|
+
isActiveIndex
|
|
59
|
+
}
|
|
60
|
+
searchAlias {
|
|
61
|
+
index
|
|
62
|
+
indexDetails {
|
|
63
|
+
status
|
|
64
|
+
index
|
|
65
|
+
health
|
|
66
|
+
docsCount
|
|
67
|
+
docsDeleted
|
|
68
|
+
storeSize
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import gql from "graphql-tag";
|
|
2
|
+
|
|
3
|
+
const UPDATE_SITEMAP_SCHEDULE = gql`
|
|
4
|
+
mutation UpdateSitemapSchedule(
|
|
5
|
+
$updateSitemapScheduleInput: UpdateSitemapScheduleInput!
|
|
6
|
+
) {
|
|
7
|
+
updateSitemapSchedule(input: $updateSitemapScheduleInput) {
|
|
8
|
+
code
|
|
9
|
+
message
|
|
10
|
+
source
|
|
11
|
+
success
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
"name": "@evenicanpm/admin-graphql-codegen",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"gitHead": "6a95e9f84f48a7e1e96bfdf4ee1a766a7d8808b6",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"codegen:insecure": "NODE_TLS_REJECT_UNAUTHORIZED=0 npm run codegen",
|
|
12
|
+
"codegen": "graphql-codegen"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@graphql-codegen/cli": "^5.0.5",
|
|
16
|
+
"@graphql-codegen/typescript": "^4.1.6",
|
|
17
|
+
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
|
|
18
|
+
"glob": "^11.0.1",
|
|
19
|
+
"graphql": "^16.10.0",
|
|
20
|
+
"graphql-request": "^7.1.2"
|
|
21
|
+
}
|
|
22
22
|
}
|
package/test.js
CHANGED
|
@@ -3,13 +3,13 @@ import { parse } from "graphql";
|
|
|
3
3
|
import { glob } from "glob";
|
|
4
4
|
|
|
5
5
|
const main = async () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const files = await glob("./documents/**/*.ts");
|
|
7
|
+
return files.map((f) => {
|
|
8
|
+
console.log(f);
|
|
9
|
+
const js = readFileSync(f, "utf8");
|
|
10
|
+
eval(js);
|
|
11
|
+
//const gql = parse(js);
|
|
12
|
+
});
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
main();
|