Skip to content

Commit

Permalink
missing type definitions for aws-v3
Browse files Browse the repository at this point in the history
Signed-off-by: maiconcarraro <maicon315@gmail.com>
  • Loading branch information
maiconcarraro committed May 15, 2024
1 parent b45d648 commit 0a67df0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Deprecated
### Removed
### Fixed
- Missing type definitions for `@opensearch-project/opensearch/aws-v3` ([776](https://github.com/opensearch-project/opensearch-js/pull/776)).
### Security

## [2.8.0]
Expand Down
20 changes: 20 additions & 0 deletions lib/aws/index-v3.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/

/// <reference types="node" />

import {
AwsSigv4Signer,
AwsSigv4SignerError,
AwsSigv4SignerOptions,
AwsSigv4SignerResponse,
} from './index';

export { AwsSigv4Signer, AwsSigv4SignerOptions, AwsSigv4SignerResponse, AwsSigv4SignerError };
36 changes: 36 additions & 0 deletions test/types/awssigv4signer-v3.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/
import { expectType } from 'tsd';
const { v4: uuidv4 } = require('uuid');
import {
AwsSigv4SignerResponse as AwsSigv4SignerResponseV3,
AwsSigv4Signer as AwsSigv4SignerV3,
} from '../../lib/aws/index-v3';

const mockCreds = {
accessKeyId: uuidv4(),
secretAccessKey: uuidv4(),
expired: false,
expireTime: new Date(),
sessionToken: uuidv4(),
};

const mockRegion = 'us-east-1';

{
const AwsSigv4SignerOptions = {
getCredentials: () => Promise.resolve(mockCreds),
region: mockRegion,
};

const auth = AwsSigv4SignerV3(AwsSigv4SignerOptions);

expectType<AwsSigv4SignerResponseV3>(auth);
}

0 comments on commit 0a67df0

Please sign in to comment.