Skip to content

Commit

Permalink
refactor: types
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamorosi committed Jan 5, 2023
1 parent f25b824 commit 2e3af84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
19 changes: 3 additions & 16 deletions packages/parameters/src/types/DynamoDBProvider.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
import type { TransformOptions } from './BaseProvider';
import type { GetOptionsInterface, GetMultipleOptionsInterface } from './BaseProvider';
import type { GetItemCommandInput, QueryCommandInput, DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';

// TODO: move this to BaseProvider.ts
interface GetBaseOptionsInterface {
maxAge?: number
forceFetch?: boolean
decrypt?: boolean
transform?: TransformOptions
}

// TODO: move this to BaseProvider.ts
interface GetMultipleBaseOptionsInterface extends GetBaseOptionsInterface {
throwOnTransformError?: boolean
}

interface DynamoDBProviderOptions {
tableName: string
keyAttr?: string
Expand All @@ -30,11 +17,11 @@ interface DynamoDBProviderOptions {
* @property {boolean} decrypt - If true, the parameter will be decrypted.
* @property {Partial<GetItemCommandInput>} sdkOptions - Options for the AWS SDK.
*/
interface DynamoDBGetOptionsInterface extends GetBaseOptionsInterface {
interface DynamoDBGetOptionsInterface extends GetOptionsInterface {
sdkOptions?: Omit<Partial<GetItemCommandInput>, 'Key' | 'TableName' | 'ProjectionExpression'>
}

interface DynamoDBGetMultipleOptionsInterface extends GetMultipleBaseOptionsInterface {
interface DynamoDBGetMultipleOptionsInterface extends GetMultipleOptionsInterface {
sdkOptions?: Partial<QueryCommandInput>
}

Expand Down
12 changes: 4 additions & 8 deletions packages/parameters/tests/unit/DynamoDBProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
/**
* Test DynamoDBProvider class
*
* @group unit/parameters/DynamoDBProvider/class
*/
* Test DynamoDBProvider class
*
* @group unit/parameters/DynamoDBProvider/class
*/
import { DynamoDBProvider } from '../../src/DynamoDBProvider';
import { DynamoDBClient, GetItemCommand, QueryCommand } from '@aws-sdk/client-dynamodb';
import type { GetItemCommandInput, QueryCommandInput } from '@aws-sdk/client-dynamodb';
import { marshall } from '@aws-sdk/util-dynamodb';
import { mockClient } from 'aws-sdk-client-mock';
import 'aws-sdk-client-mock-jest';
/* import type {
DynamoDBGetOptionsInterface,
DynamoDBGetMultipleOptionsInterface,
} from '../../src/types/DynamoDBProvider'; */

describe('Class: DynamoDBProvider', () => {

Expand Down

0 comments on commit 2e3af84

Please sign in to comment.