Skip to content

feat(idempotency): add package exports #1483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 89 additions & 63 deletions packages/idempotency/package.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,90 @@
{
"name": "@aws-lambda-powertools/idempotency",
"version": "0.0.11",
"description": "The idempotency package for the Powertools for AWS Lambda (TypeScript) library. It provides options to make your Lambda functions idempotent and safe to retry.",
"author": {
"name": "Amazon Web Services",
"url": "https://aws.amazon.com"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"commit": "commit",
"test": "npm run test:unit",
"test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose",
"test:e2e:nodejs14x": "RUNTIME=nodejs14x jest --group=e2e",
"test:e2e:nodejs16x": "RUNTIME=nodejs16x jest --group=e2e",
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
"test:e2e": "jest --group=e2e --detectOpenHandles",
"watch": "jest --watch --group=unit",
"build": "tsc",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
"package-bundle": "../../package-bundler.sh idempotency-bundle ./dist",
"prepare": "npm run build"
},
"lint-staged": {
"*.ts": "npm run lint-fix"
},
"homepage": "https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/idempotency#readme",
"license": "MIT",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"typedocMain": "src/file_that_does_not_exist_so_its_ignored_from_api_docs.ts",
"files": [
"lib"
],
"repository": {
"type": "git",
"url": "git+https://github.com/awslabs/aws-lambda-powertools-typescript.git"
},
"bugs": {
"url": "https://github.com/awslabs/aws-lambda-powertools-typescript/issues"
},
"dependencies": {
"@aws-lambda-powertools/commons": "^1.5.0",
"@aws-sdk/lib-dynamodb": "^3.231.0",
"jmespath": "^0.16.0"
},
"keywords": [
"aws",
"lambda",
"powertools",
"serverless",
"nodejs"
],
"devDependencies": {
"@types/jmespath": "^0.15.0",
"@aws-sdk/client-dynamodb": "^3.231.0",
"aws-sdk-client-mock": "^2.0.1",
"aws-sdk-client-mock-jest": "^2.0.1"
}
{
"name": "@aws-lambda-powertools/idempotency",
"version": "1.8.0-alpha.0",
"description": "The idempotency package for the Powertools for AWS Lambda (TypeScript) library. It provides options to make your Lambda functions idempotent and safe to retry.",
"author": {
"name": "Amazon Web Services",
"url": "https://aws.amazon.com"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"commit": "commit",
"test": "npm run test:unit",
"test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose",
"test:e2e:nodejs14x": "RUNTIME=nodejs14x jest --group=e2e",
"test:e2e:nodejs16x": "RUNTIME=nodejs16x jest --group=e2e",
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
"test:e2e": "jest --group=e2e --detectOpenHandles",
"watch": "jest --watch --group=unit",
"build": "tsc",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
"package-bundle": "../../package-bundler.sh idempotency-bundle ./dist",
"preprepare": "rm -rf ./lib",
"prepare": "npm run build"
},
"lint-staged": {
"*.ts": "npm run lint-fix",
"*.js": "npm run lint-fix"
},
"homepage": "https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/idempotency#readme",
"license": "MIT-0",
"exports": {
".": {
"import": "./lib/index.js",
"require": "./lib/index.js"
},
"./persistence": {
"import": "./lib/persistence/index.js",
"require": "./lib/persistence/index.js"
},
"./dynamodb": {
"import": "./lib/persistence/DynamoDbPersistenceLayer.js",
"require": "./lib/persistence/DynamoDbPersistenceLayer.js"
}
},
"typesVersions": {
"*": {
"persistence": [
"lib/persistence/index.d.ts"
],
"dynamodb": [
"lib/persistence/DynamoDbPersistenceLayer.d.ts"
]
}
},
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"typedocMain": "src/file_that_does_not_exist_so_its_ignored_from_api_docs.ts",
"files": [
"lib"
],
"repository": {
"type": "git",
"url": "git+https://github.com/awslabs/aws-lambda-powertools-typescript.git"
},
"bugs": {
"url": "https://github.com/awslabs/aws-lambda-powertools-typescript/issues"
},
"dependencies": {
"@aws-lambda-powertools/commons": "^1.5.0",
"@aws-sdk/lib-dynamodb": "^3.231.0",
"jmespath": "^0.16.0"
},
"keywords": [
"aws",
"lambda",
"powertools",
"serverless",
"nodejs"
],
"devDependencies": {
"@aws-sdk/client-dynamodb": "^3.231.0",
"@types/jmespath": "^0.15.0",
"aws-sdk-client-mock": "^2.0.1",
"aws-sdk-client-mock-jest": "^2.0.1"
}
}
4 changes: 4 additions & 0 deletions packages/idempotency/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './Exceptions';
export * from './IdempotencyConfig';
export * from './idempotentDecorator';
export * from './makeFunctionIdempotent';
1 change: 0 additions & 1 deletion packages/idempotency/src/persistence/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './DynamoDBPersistenceLayer';
export * from './BasePersistenceLayer';
export * from './BasePersistenceLayerInterface';
export * from './IdempotencyRecord';
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { Context } from 'aws-lambda';
import { LambdaInterface } from '@aws-lambda-powertools/commons';
import { DynamoDBPersistenceLayer } from '../../src/persistence';
import {
idempotentFunction,
idempotentLambdaHandler,
} from '../../src/idempotentDecorator';
import { Context } from 'aws-lambda';
import { DynamoDBPersistenceLayer } from '../../src/dynamodb';
import { idempotentFunction, idempotentLambdaHandler } from '../../src';
import { Logger } from '../../../logger';

const IDEMPOTENCY_TABLE_NAME =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DynamoDBPersistenceLayer } from '../../src/persistence';
import { makeFunctionIdempotent } from '../../src/makeFunctionIdempotent';
import type { Context } from 'aws-lambda';
import { DynamoDBPersistenceLayer } from '../../src/dynamodb';
import { makeFunctionIdempotent } from '../../src';
import { Logger } from '@aws-lambda-powertools/logger';
import { Context } from 'aws-lambda';

const IDEMPOTENCY_TABLE_NAME =
process.env.IDEMPOTENCY_TABLE_NAME || 'table_name';
Expand Down
2 changes: 1 addition & 1 deletion packages/idempotency/tests/unit/IdempotencyConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @group unit/idempotency/config
*/
import { ContextExamples as dummyContext } from '@aws-lambda-powertools/commons';
import { IdempotencyConfig } from '../../src/IdempotencyConfig';
import { IdempotencyConfig } from '../../src';
import type { IdempotencyConfigOptions } from '../../src/types';

describe('Class: IdempotencyConfig', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/idempotency/tests/unit/IdempotencyHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { IdempotencyRecordStatus } from '../../src/types';
import { BasePersistenceLayer, IdempotencyRecord } from '../../src/persistence';
import { IdempotencyHandler } from '../../src/IdempotencyHandler';
import { IdempotencyConfig } from '../../src/IdempotencyConfig';
import { IdempotencyConfig } from '../../src';

class PersistenceLayerTestClass extends BasePersistenceLayer {
protected _deleteRecord = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
IdempotencyItemAlreadyExistsError,
IdempotencyPersistenceLayerError,
} from '../../src/Exceptions';
import { IdempotencyConfig } from '../../src/IdempotencyConfig';
import { IdempotencyConfig } from '../../src';

const mockSaveInProgress = jest
.spyOn(BasePersistenceLayer.prototype, 'saveInProgress')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { IdempotencyFunctionOptions } from '../../src/types/IdempotencyOptions';
import { BasePersistenceLayer, IdempotencyRecord } from '../../src/persistence';
import { makeFunctionIdempotent } from '../../src/makeFunctionIdempotent';
import { makeFunctionIdempotent } from '../../src';
import type {
AnyIdempotentFunction,
IdempotencyRecordOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @group unit/idempotency/persistence/base
*/
import { ContextExamples as dummyContext } from '@aws-lambda-powertools/commons';
import { IdempotencyConfig } from '../../../src/IdempotencyConfig';
import { IdempotencyConfig } from '../../../src';
import {
IdempotencyRecord,
BasePersistenceLayer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
IdempotencyItemAlreadyExistsError,
IdempotencyItemNotFoundError,
} from '../../../src/Exceptions';
import { IdempotencyRecord } from '../../../src/persistence/IdempotencyRecord';
import { IdempotencyRecord } from '../../../src/persistence';
import type { DynamoPersistenceOptions } from '../../../src/types';
import { IdempotencyRecordStatus } from '../../../src/types';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @group unit/idempotency/persistence/idempotencyRecord
*/
import { IdempotencyInvalidStatusError } from '../../../src/Exceptions';
import { IdempotencyRecord } from '../../../src/persistence/IdempotencyRecord';
import { IdempotencyRecord } from '../../../src/persistence';
import { IdempotencyRecordStatus } from '../../../src/types';

const mockIdempotencyKey = '123';
Expand Down