opensearch-project / opensearch-js

Node.js Client for OpenSearch
https://opensearch.org/docs/latest/clients/javascript/
Apache License 2.0
176 stars 116 forks source link

[BUG][v2.8.0] aws-v3 import is missing type definitions #771

Closed maiconcarraro closed 3 weeks ago

maiconcarraro commented 1 month ago

Following https://github.com/opensearch-project/opensearch-js/blob/fb91e38130f1ccdddbe7e709f547b1fe5a58d591/USER_GUIDE.md#using-aws-v3-sdk

It shows:

const { AwsSigv4Signer } = require('@opensearch-project/opensearch/aws-v3'); // use aws-v3 import path if you are using aws-sdk v3

I'm currently using @opensearch-project/opensearch 2.8.0 which introduced these changes, but it doesn't work:

Type error: Could not find a declaration file for module '@opensearch-project/opensearch/aws-v3'. 'XXX/node_modules/@opensearch-project/opensearch/lib/aws/index-v3.js' implicitly has an 'any' type.
  If the '@opensearch-project/opensearch' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '@opensearch-project/opensearch/aws-v3';`

  3 | import { defaultProvider } from "@aws-sdk/credential-provider-node";
  4 | import { Client } from "@opensearch-project/opensearch";
> 5 | import { AwsSigv4Signer } from "@opensearch-project/opensearch/aws-v3";
    |                                ^
  6 |
  7 | const osClient = new Client({
  8 |   ...AwsSigv4Signer({
error Command failed with exit code 1.

It's missing the equivalent of https://github.com/opensearch-project/opensearch-js/blob/main/lib/aws/index.d.ts

dblock commented 1 month ago

Would love a fix @maiconcarraro, please?

maiconcarraro commented 1 month ago

@dblock sorry for the delay, sent!

dblock commented 3 weeks ago

Closed via https://github.com/opensearch-project/opensearch-js/pull/776.