Skip to content

Commit f5d9997

Browse files
committed
chore: update graphql-compose-elasticsearch
1 parent e6f8385 commit f5d9997

File tree

6 files changed

+47
-97
lines changed

6 files changed

+47
-97
lines changed

examples/elasticsearch/__tests__/__snapshots__/queriesFromIndex-test.ts.snap

+6-20
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`elasticsearch > queries Elastic search API 1.7 1`] = `
3+
exports[`elasticsearch > queries Elastic search API 5.6 1`] = `
44
Object {
55
"data": Object {
6-
"elastic17": null,
6+
"elastic56": null,
77
},
88
"errors": Array [
99
[GraphQLError: ✋ 🛑 I don't have public elasticsearch instance for demo purposes.
@@ -14,10 +14,10 @@ Object {
1414
}
1515
`;
1616
17-
exports[`elasticsearch > queries Elastic search API 2.4 1`] = `
17+
exports[`elasticsearch > queries Elastic search API 6.8 1`] = `
1818
Object {
1919
"data": Object {
20-
"elastic24": null,
20+
"elastic68": null,
2121
},
2222
"errors": Array [
2323
[GraphQLError: ✋ 🛑 I don't have public elasticsearch instance for demo purposes.
@@ -28,24 +28,10 @@ Object {
2828
}
2929
`;
3030
31-
exports[`elasticsearch > queries Elastic search API 5.0 1`] = `
31+
exports[`elasticsearch > queries Elastic search API 7.7 1`] = `
3232
Object {
3333
"data": Object {
34-
"elastic50": null,
35-
},
36-
"errors": Array [
37-
[GraphQLError: ✋ 🛑 I don't have public elasticsearch instance for demo purposes.
38-
🚀 Demo will work if you provide public elasticsearch instance url
39-
🚀 in query argument \`host: "http://user:[email protected]:9200"\`
40-
],
41-
],
42-
}
43-
`;
44-
45-
exports[`elasticsearch > queries Elastic search API 6.0 1`] = `
46-
Object {
47-
"data": Object {
48-
"elastic60": null,
34+
"elastic77": null,
4935
},
5036
"errors": Array [
5137
[GraphQLError: ✋ 🛑 I don't have public elasticsearch instance for demo purposes.

examples/elasticsearch/__tests__/queriesFromIndex-test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { graphql } from 'graphql';
22
import meta from '../index';
33

4-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
5-
64
describe('elasticsearch > queries', () => {
75
meta.queries.forEach(({ query, title }) => {
86
it(title, async () => {

examples/elasticsearch/index.ts

+6-16
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,30 @@ export default {
99
github: 'https://github.com/nodkz/graphql-compose-examples/tree/master/examples/elasticsearch',
1010
queries: [
1111
{
12-
title: 'Elastic search API 6.0',
12+
title: 'Elastic search API 7.7',
1313
query: `
1414
query {
15-
elastic60(host: "http://user:[email protected]:9200") {
15+
elastic77(host: "http://user:[email protected]:9200") {
1616
search(q: "JavaScript")
1717
}
1818
}
1919
`,
2020
},
2121
{
22-
title: 'Elastic search API 5.0',
22+
title: 'Elastic search API 6.8',
2323
query: `
2424
query {
25-
elastic50(host: "http://user:[email protected]:9200") {
25+
elastic68(host: "http://user:[email protected]:9200") {
2626
search(q: "JavaScript")
2727
}
2828
}
2929
`,
3030
},
3131
{
32-
title: 'Elastic search API 2.4',
32+
title: 'Elastic search API 5.6',
3333
query: `
3434
query {
35-
elastic24(host: "http://user:[email protected]:9200") {
36-
search(q: "JavaScript")
37-
}
38-
}
39-
`,
40-
},
41-
{
42-
title: 'Elastic search API 1.7',
43-
query: `
44-
query {
45-
elastic17(host: "http://user:[email protected]:9200") {
35+
elastic56(host: "http://user:[email protected]:9200") {
4636
search(q: "JavaScript")
4737
}
4838
}

examples/elasticsearch/schema.ts

+15-39
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ function checkHost(host): void {
1414

1515
const schemaComposer = new SchemaComposer();
1616

17-
schemaComposer.Query.setField('elastic60', {
18-
description: 'Elastic v6.0',
17+
schemaComposer.Query.setField('elastic77', {
18+
description: 'Elastic v7.7',
1919
type: schemaComposer.createObjectTC({
20-
name: 'Elastic60',
21-
fields: new ElasticApiParser({ version: '6_0', prefix: 'Elastic60' }).generateFieldMap(),
20+
name: 'Elastic77',
21+
fields: new ElasticApiParser({ apiVersion: '7.7', prefix: 'Elastic77' }).generateFieldMap(),
2222
}),
2323
args: {
2424
host: {
@@ -31,42 +31,18 @@ schemaComposer.Query.setField('elastic60', {
3131
context.elasticClient = new elasticsearch.Client({
3232
// eslint-disable-line no-param-reassign
3333
host: args.host,
34-
apiVersion: '6.0',
34+
apiVersion: '7.7',
3535
requestTimeout: 5000,
3636
});
3737
return {};
3838
},
3939
});
4040

41-
schemaComposer.Query.setField('elastic50', {
42-
description: 'Elastic v5.0',
41+
schemaComposer.Query.setField('elastic68', {
42+
description: 'Elastic v6.8',
4343
type: schemaComposer.createObjectTC({
44-
name: 'Elastic50',
45-
fields: new ElasticApiParser({ version: '5_0', prefix: 'Elastic50' }).generateFieldMap(),
46-
}),
47-
args: {
48-
host: {
49-
type: 'String',
50-
defaultValue: 'http://user:[email protected]:9200',
51-
},
52-
},
53-
resolve: (src, args, context) => {
54-
checkHost(args.host);
55-
context.elasticClient = new elasticsearch.Client({
56-
// eslint-disable-line no-param-reassign
57-
host: args.host,
58-
apiVersion: '5.0',
59-
requestTimeout: 5000,
60-
});
61-
return {};
62-
},
63-
});
64-
65-
schemaComposer.Query.setField('elastic24', {
66-
description: 'Elastic v2.4',
67-
type: schemaComposer.createObjectTC({
68-
name: 'Elastic24',
69-
fields: new ElasticApiParser({ version: '2_4', prefix: 'Elastic24' }).generateFieldMap(),
44+
name: 'Elastic60',
45+
fields: new ElasticApiParser({ apiVersion: '6.8', prefix: 'Elastic68' }).generateFieldMap(),
7046
}),
7147
args: {
7248
host: {
@@ -79,18 +55,18 @@ schemaComposer.Query.setField('elastic24', {
7955
context.elasticClient = new elasticsearch.Client({
8056
// eslint-disable-line no-param-reassign
8157
host: args.host,
82-
apiVersion: '2.4',
58+
apiVersion: '6.8',
8359
requestTimeout: 5000,
8460
});
8561
return {};
8662
},
8763
});
8864

89-
schemaComposer.Query.setField('elastic17', {
90-
description: 'Elastic v1.7',
65+
schemaComposer.Query.setField('elastic56', {
66+
description: 'Elastic v5.6',
9167
type: schemaComposer.createObjectTC({
92-
name: 'Elastic17',
93-
fields: new ElasticApiParser({ version: '5_0', prefix: 'Elastic17' }).generateFieldMap(),
68+
name: 'Elastic56',
69+
fields: new ElasticApiParser({ apiVersion: '5.6', prefix: 'Elastic56' }).generateFieldMap(),
9470
}),
9571
args: {
9672
host: {
@@ -103,7 +79,7 @@ schemaComposer.Query.setField('elastic17', {
10379
context.elasticClient = new elasticsearch.Client({
10480
// eslint-disable-line no-param-reassign
10581
host: args.host,
106-
apiVersion: '1.7',
82+
apiVersion: '5.6',
10783
requestTimeout: 5000,
10884
});
10985
return {};

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@apollo/federation": "0.25.2",
3131
"altair-express-middleware": "4.0.6",
3232
"apollo-server-express": "2.25.2",
33-
"aws-sdk": "2.933.0",
33+
"aws-sdk": "2.935.0",
3434
"cors": "2.8.5",
3535
"dedent": "0.7.0",
3636
"elasticsearch": "16.7.2",
@@ -39,12 +39,12 @@
3939
"graphql-compose": "9.0.1",
4040
"graphql-compose-aws": "5.2.1",
4141
"graphql-compose-connection": "8.2.0",
42-
"graphql-compose-elasticsearch": "4.0.10",
42+
"graphql-compose-elasticsearch": "5.0.0",
4343
"graphql-compose-mongoose": "9.4.2",
4444
"graphql-compose-pagination": "8.2.0",
4545
"graphql-query-complexity": "0.8.1",
4646
"graphql-voyager": "1.0.0-rc.31",
47-
"mongoose": "5.12.14",
47+
"mongoose": "5.12.15",
4848
"subscriptions-transport-ws": "0.9.19",
4949
"ts-node": "^10.0.0",
5050
"typescript": "4.3.4"
@@ -64,7 +64,7 @@
6464
"jest-junit": "12.2.0",
6565
"mongodb-memory-server": "6.9.6",
6666
"nodemon": "2.0.7",
67-
"prettier": "2.3.1",
67+
"prettier": "2.3.2",
6868
"rimraf": "3.0.2",
6969
"ts-jest": "27.0.3",
7070
"ts-node-dev": "^1.1.6"

yarn.lock

+16-16
Original file line numberDiff line numberDiff line change
@@ -1853,10 +1853,10 @@ asynckit@^0.4.0:
18531853
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
18541854
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
18551855

1856-
aws-sdk@2.933.0:
1857-
version "2.933.0"
1858-
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.933.0.tgz#42f2cab2ebb63291ce6e764510e8bfa997847256"
1859-
integrity sha512-WJBQSE3zdX5YbzTa5+k45hzUAL5EPyiZJAnzCV6TIkPEYPMY215q8iloBATqbntbvAyWC4j2Rto6+RYmki1MOQ==
1856+
aws-sdk@2.935.0:
1857+
version "2.935.0"
1858+
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.935.0.tgz#f122667a4b004d6cf5761e754d42f507b1fc36f7"
1859+
integrity sha512-OeoqkZ0fXPC1xjumoFQmPccASXmGBBNBsI3l9vs/NCQk3WyBfiYh07H6RO5owtCmp0a8hAjKSZAHjnRe2JlmEA==
18601860
dependencies:
18611861
buffer "4.9.2"
18621862
events "1.1.1"
@@ -3719,10 +3719,10 @@ [email protected]:
37193719
resolved "https://registry.yarnpkg.com/graphql-compose-connection/-/graphql-compose-connection-8.2.0.tgz#0046c4b161823b549efdd99a208d665624edb086"
37203720
integrity sha512-41tMBvYruKsGFiR9e3JuLLplq5EoB6Y8CbVPx2KA4rfKAG5MLnY3kl64QPZALK9yzOxPVfN3AFPK1whWgm20CQ==
37213721

3722-
graphql-compose-elasticsearch@4.0.10:
3723-
version "4.0.10"
3724-
resolved "https://registry.yarnpkg.com/graphql-compose-elasticsearch/-/graphql-compose-elasticsearch-4.0.10.tgz#9d2df97e62ea6f4856eb0279489db8ad15728299"
3725-
integrity sha512-OHc1x9BoUiYAD3OJd5yYj5D042r05IEZEnBGQ69PE69uwiizyOigVeKDoFQSi8msxMh8FEH8oB0mpmmcv2KgdA==
3722+
graphql-compose-elasticsearch@5.0.0:
3723+
version "5.0.0"
3724+
resolved "https://registry.yarnpkg.com/graphql-compose-elasticsearch/-/graphql-compose-elasticsearch-5.0.0.tgz#7979c315f6d464519262a8b0b90205c751a82c68"
3725+
integrity sha512-F9ryZ7xIqXPZUxqRoLcNz+DuGqqlPNB1wLR2Z/mzz3zzFSatPJAjnWZ57MH78+vOUW4CINcnUr1TIWzpusk4Fg==
37263726
dependencies:
37273727
dox "^0.9.0"
37283728

@@ -5380,10 +5380,10 @@ [email protected]:
53805380
resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4"
53815381
integrity sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==
53825382

5383-
5384-
version "5.12.14"
5385-
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.12.14.tgz#610460f0725acf67b3eefcd92f0a48a08919d51b"
5386-
integrity sha512-1lMRY8cfGYFWHqe5DLnVgNQDyD0fEbSoWIQe9Mllt/ZtayZ5XUFQt+o5VKrB44vsT5cLNzgwEFO0NvwTwqLluQ==
5383+
5384+
version "5.12.15"
5385+
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.12.15.tgz#a023afa570c15a00d39315e7c7562c77ceed2857"
5386+
integrity sha512-GVvxE2/mbUsxAbTtleFlehCNMFlzcgKue/olukIpoN6iw1MYXKodf+ZIRndO+2jzlgbZgiHkAZZJbcFNt1DgHA==
53875387
dependencies:
53885388
"@types/mongodb" "^3.5.27"
53895389
bson "^1.1.4"
@@ -5925,10 +5925,10 @@ prettier-linter-helpers@^1.0.0:
59255925
dependencies:
59265926
fast-diff "^1.1.2"
59275927

5928-
5929-
version "2.3.1"
5930-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.1.tgz#76903c3f8c4449bc9ac597acefa24dc5ad4cbea6"
5931-
integrity sha512-p+vNbgpLjif/+D+DwAZAbndtRrR0md0MwfmOVN9N+2RgyACMT+7tfaRnT+WDPkqnuVwleyuBIG2XBxKDme3hPA==
5928+
5929+
version "2.3.2"
5930+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
5931+
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
59325932

59335933
pretty-format@^26.0.0, pretty-format@^26.6.2:
59345934
version "26.6.2"

0 commit comments

Comments
 (0)