aws-v3-sdk 1.0.10 → 1.0.12

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.
@@ -2,7 +2,7 @@ const { Client, Connection } = require('@opensearch-project/opensearch')
2
2
  const { defaultProvider } = require('@aws-sdk/credential-provider-node')
3
3
  const aws4 = require('aws4')
4
4
 
5
- const { AWS_REGION, ELASTICSEARCH_AUDITS_ENDPOINT } = process.env
5
+ const { REGION, ELASTICSEARCH_AUDITS_ENDPOINT } = process.env
6
6
 
7
7
  const host = 'https://' + ELASTICSEARCH_AUDITS_ENDPOINT
8
8
 
@@ -24,7 +24,7 @@ const createAwsConnector = (credentials, region) => {
24
24
 
25
25
  const getClient = async () => {
26
26
  const credentials = await defaultProvider()()
27
- const cred = createAwsConnector(credentials, AWS_REGION)
27
+ const cred = createAwsConnector(credentials, REGION)
28
28
  return new Client({
29
29
  ...cred,
30
30
  node: host
@@ -2,7 +2,7 @@ const { Client, Connection } = require('@opensearch-project/opensearch')
2
2
  const { defaultProvider } = require('@aws-sdk/credential-provider-node')
3
3
  const aws4 = require('aws4')
4
4
 
5
- const { AWS_REGION, ELASTICSEARCH_ENDPOINT } = process.env
5
+ const { REGION, ELASTICSEARCH_ENDPOINT } = process.env
6
6
 
7
7
  const host = 'https://' + ELASTICSEARCH_ENDPOINT
8
8
 
@@ -24,7 +24,7 @@ const createAwsConnector = (credentials, region) => {
24
24
 
25
25
  const getClient = async () => {
26
26
  const credentials = await defaultProvider()()
27
- const cred = createAwsConnector(credentials, AWS_REGION)
27
+ const cred = createAwsConnector(credentials, REGION)
28
28
  return new Client({
29
29
  ...cred,
30
30
  node: host
@@ -2,7 +2,7 @@ const { Client, Connection } = require('@opensearch-project/opensearch')
2
2
  const { defaultProvider } = require('@aws-sdk/credential-provider-node')
3
3
  const aws4 = require('aws4')
4
4
 
5
- const { AWS_REGION, ELASTICSEARCH_ENDPOINT } = process.env
5
+ const { REGION, ELASTICSEARCH_ENDPOINT } = process.env
6
6
  const host = 'https://' + ELASTICSEARCH_ENDPOINT
7
7
 
8
8
  const createAwsConnector = (credentials, region) => {
@@ -23,19 +23,26 @@ const createAwsConnector = (credentials, region) => {
23
23
 
24
24
  const getClient = async () => {
25
25
  const credentials = await defaultProvider()()
26
- const cred = createAwsConnector(credentials, AWS_REGION)
26
+ const cred = createAwsConnector(credentials, REGION)
27
27
  return new Client({
28
28
  ...cred,
29
29
  node: host
30
30
  })
31
31
  }
32
32
 
33
- exports.sendGetRequest = async (index, query, from, size, sort) => {
33
+ exports.sendGetRequest = async (index, query, from, size, sort, _source) => {
34
34
  const client = await getClient()
35
35
  return new Promise((resolve, reject) => {
36
+ let body = { query }
37
+ if (sort) {
38
+ body = { query, sort }
39
+ }
36
40
  client.search({
37
41
  index,
38
- body: { query }
42
+ from,
43
+ size,
44
+ _source,
45
+ body
39
46
  }).then(response => {
40
47
  const data = response.body.hits.hits
41
48
  const totalCount = response.body.hits.total
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-v3-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "AWS v3 SDK Utils",
5
5
  "main": "index.js",
6
6
  "scripts": {