Skip to content

Commit faa9307

Browse files
authored
feat(idempotency): add package exports (#1483)
* feat: top-level exports * chore: version * feat: exports * chore: license field
1 parent 0021536 commit faa9307

12 files changed

+106
-80
lines changed

packages/idempotency/package.json

+89-63
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,90 @@
1-
{
2-
"name": "@aws-lambda-powertools/idempotency",
3-
"version": "0.0.11",
4-
"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.",
5-
"author": {
6-
"name": "Amazon Web Services",
7-
"url": "https://aws.amazon.com"
8-
},
9-
"publishConfig": {
10-
"access": "public"
11-
},
12-
"scripts": {
13-
"commit": "commit",
14-
"test": "npm run test:unit",
15-
"test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose",
16-
"test:e2e:nodejs14x": "RUNTIME=nodejs14x jest --group=e2e",
17-
"test:e2e:nodejs16x": "RUNTIME=nodejs16x jest --group=e2e",
18-
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
19-
"test:e2e": "jest --group=e2e --detectOpenHandles",
20-
"watch": "jest --watch --group=unit",
21-
"build": "tsc",
22-
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
23-
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
24-
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
25-
"package-bundle": "../../package-bundler.sh idempotency-bundle ./dist",
26-
"prepare": "npm run build"
27-
},
28-
"lint-staged": {
29-
"*.ts": "npm run lint-fix"
30-
},
31-
"homepage": "https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/idempotency#readme",
32-
"license": "MIT",
33-
"main": "./lib/index.js",
34-
"types": "./lib/index.d.ts",
35-
"typedocMain": "src/file_that_does_not_exist_so_its_ignored_from_api_docs.ts",
36-
"files": [
37-
"lib"
38-
],
39-
"repository": {
40-
"type": "git",
41-
"url": "git+https://github.com/awslabs/aws-lambda-powertools-typescript.git"
42-
},
43-
"bugs": {
44-
"url": "https://github.com/awslabs/aws-lambda-powertools-typescript/issues"
45-
},
46-
"dependencies": {
47-
"@aws-lambda-powertools/commons": "^1.5.0",
48-
"@aws-sdk/lib-dynamodb": "^3.231.0",
49-
"jmespath": "^0.16.0"
50-
},
51-
"keywords": [
52-
"aws",
53-
"lambda",
54-
"powertools",
55-
"serverless",
56-
"nodejs"
57-
],
58-
"devDependencies": {
59-
"@types/jmespath": "^0.15.0",
60-
"@aws-sdk/client-dynamodb": "^3.231.0",
61-
"aws-sdk-client-mock": "^2.0.1",
62-
"aws-sdk-client-mock-jest": "^2.0.1"
63-
}
1+
{
2+
"name": "@aws-lambda-powertools/idempotency",
3+
"version": "1.8.0-alpha.0",
4+
"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.",
5+
"author": {
6+
"name": "Amazon Web Services",
7+
"url": "https://aws.amazon.com"
8+
},
9+
"publishConfig": {
10+
"access": "public"
11+
},
12+
"scripts": {
13+
"commit": "commit",
14+
"test": "npm run test:unit",
15+
"test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose",
16+
"test:e2e:nodejs14x": "RUNTIME=nodejs14x jest --group=e2e",
17+
"test:e2e:nodejs16x": "RUNTIME=nodejs16x jest --group=e2e",
18+
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
19+
"test:e2e": "jest --group=e2e --detectOpenHandles",
20+
"watch": "jest --watch --group=unit",
21+
"build": "tsc",
22+
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
23+
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
24+
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
25+
"package-bundle": "../../package-bundler.sh idempotency-bundle ./dist",
26+
"preprepare": "rm -rf ./lib",
27+
"prepare": "npm run build"
28+
},
29+
"lint-staged": {
30+
"*.ts": "npm run lint-fix",
31+
"*.js": "npm run lint-fix"
32+
},
33+
"homepage": "https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/idempotency#readme",
34+
"license": "MIT-0",
35+
"exports": {
36+
".": {
37+
"import": "./lib/index.js",
38+
"require": "./lib/index.js"
39+
},
40+
"./persistence": {
41+
"import": "./lib/persistence/index.js",
42+
"require": "./lib/persistence/index.js"
43+
},
44+
"./dynamodb": {
45+
"import": "./lib/persistence/DynamoDbPersistenceLayer.js",
46+
"require": "./lib/persistence/DynamoDbPersistenceLayer.js"
47+
}
48+
},
49+
"typesVersions": {
50+
"*": {
51+
"persistence": [
52+
"lib/persistence/index.d.ts"
53+
],
54+
"dynamodb": [
55+
"lib/persistence/DynamoDbPersistenceLayer.d.ts"
56+
]
57+
}
58+
},
59+
"main": "./lib/index.js",
60+
"types": "./lib/index.d.ts",
61+
"typedocMain": "src/file_that_does_not_exist_so_its_ignored_from_api_docs.ts",
62+
"files": [
63+
"lib"
64+
],
65+
"repository": {
66+
"type": "git",
67+
"url": "git+https://github.com/awslabs/aws-lambda-powertools-typescript.git"
68+
},
69+
"bugs": {
70+
"url": "https://github.com/awslabs/aws-lambda-powertools-typescript/issues"
71+
},
72+
"dependencies": {
73+
"@aws-lambda-powertools/commons": "^1.5.0",
74+
"@aws-sdk/lib-dynamodb": "^3.231.0",
75+
"jmespath": "^0.16.0"
76+
},
77+
"keywords": [
78+
"aws",
79+
"lambda",
80+
"powertools",
81+
"serverless",
82+
"nodejs"
83+
],
84+
"devDependencies": {
85+
"@aws-sdk/client-dynamodb": "^3.231.0",
86+
"@types/jmespath": "^0.15.0",
87+
"aws-sdk-client-mock": "^2.0.1",
88+
"aws-sdk-client-mock-jest": "^2.0.1"
89+
}
6490
}

packages/idempotency/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './Exceptions';
2+
export * from './IdempotencyConfig';
3+
export * from './idempotentDecorator';
4+
export * from './makeFunctionIdempotent';
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from './DynamoDBPersistenceLayer';
21
export * from './BasePersistenceLayer';
32
export * from './BasePersistenceLayerInterface';
43
export * from './IdempotencyRecord';

packages/idempotency/tests/e2e/idempotencyDecorator.test.FunctionCode.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1+
import type { Context } from 'aws-lambda';
12
import { LambdaInterface } from '@aws-lambda-powertools/commons';
2-
import { DynamoDBPersistenceLayer } from '../../src/persistence';
3-
import {
4-
idempotentFunction,
5-
idempotentLambdaHandler,
6-
} from '../../src/idempotentDecorator';
7-
import { Context } from 'aws-lambda';
3+
import { DynamoDBPersistenceLayer } from '../../src/dynamodb';
4+
import { idempotentFunction, idempotentLambdaHandler } from '../../src';
85
import { Logger } from '../../../logger';
96

107
const IDEMPOTENCY_TABLE_NAME =

packages/idempotency/tests/e2e/makeFunctionIdempotent.test.FunctionCode.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DynamoDBPersistenceLayer } from '../../src/persistence';
2-
import { makeFunctionIdempotent } from '../../src/makeFunctionIdempotent';
1+
import type { Context } from 'aws-lambda';
2+
import { DynamoDBPersistenceLayer } from '../../src/dynamodb';
3+
import { makeFunctionIdempotent } from '../../src';
34
import { Logger } from '@aws-lambda-powertools/logger';
4-
import { Context } from 'aws-lambda';
55

66
const IDEMPOTENCY_TABLE_NAME =
77
process.env.IDEMPOTENCY_TABLE_NAME || 'table_name';

packages/idempotency/tests/unit/IdempotencyConfig.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @group unit/idempotency/config
55
*/
66
import { ContextExamples as dummyContext } from '@aws-lambda-powertools/commons';
7-
import { IdempotencyConfig } from '../../src/IdempotencyConfig';
7+
import { IdempotencyConfig } from '../../src';
88
import type { IdempotencyConfigOptions } from '../../src/types';
99

1010
describe('Class: IdempotencyConfig', () => {

packages/idempotency/tests/unit/IdempotencyHandler.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { IdempotencyRecordStatus } from '../../src/types';
1313
import { BasePersistenceLayer, IdempotencyRecord } from '../../src/persistence';
1414
import { IdempotencyHandler } from '../../src/IdempotencyHandler';
15-
import { IdempotencyConfig } from '../../src/IdempotencyConfig';
15+
import { IdempotencyConfig } from '../../src';
1616

1717
class PersistenceLayerTestClass extends BasePersistenceLayer {
1818
protected _deleteRecord = jest.fn();

packages/idempotency/tests/unit/idempotentDecorator.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
IdempotencyItemAlreadyExistsError,
1818
IdempotencyPersistenceLayerError,
1919
} from '../../src/Exceptions';
20-
import { IdempotencyConfig } from '../../src/IdempotencyConfig';
20+
import { IdempotencyConfig } from '../../src';
2121

2222
const mockSaveInProgress = jest
2323
.spyOn(BasePersistenceLayer.prototype, 'saveInProgress')

packages/idempotency/tests/unit/makeFunctionIdempotent.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import { IdempotencyFunctionOptions } from '../../src/types/IdempotencyOptions';
77
import { BasePersistenceLayer, IdempotencyRecord } from '../../src/persistence';
8-
import { makeFunctionIdempotent } from '../../src/makeFunctionIdempotent';
8+
import { makeFunctionIdempotent } from '../../src';
99
import type {
1010
AnyIdempotentFunction,
1111
IdempotencyRecordOptions,

packages/idempotency/tests/unit/persistence/BasePersistenceLayer.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @group unit/idempotency/persistence/base
55
*/
66
import { ContextExamples as dummyContext } from '@aws-lambda-powertools/commons';
7-
import { IdempotencyConfig } from '../../../src/IdempotencyConfig';
7+
import { IdempotencyConfig } from '../../../src';
88
import {
99
IdempotencyRecord,
1010
BasePersistenceLayer,

packages/idempotency/tests/unit/persistence/DynamoDbPersistenceLayer.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
IdempotencyItemAlreadyExistsError,
99
IdempotencyItemNotFoundError,
1010
} from '../../../src/Exceptions';
11-
import { IdempotencyRecord } from '../../../src/persistence/IdempotencyRecord';
11+
import { IdempotencyRecord } from '../../../src/persistence';
1212
import type { DynamoPersistenceOptions } from '../../../src/types';
1313
import { IdempotencyRecordStatus } from '../../../src/types';
1414
import {

packages/idempotency/tests/unit/persistence/IdempotencyRecord.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @group unit/idempotency/persistence/idempotencyRecord
55
*/
66
import { IdempotencyInvalidStatusError } from '../../../src/Exceptions';
7-
import { IdempotencyRecord } from '../../../src/persistence/IdempotencyRecord';
7+
import { IdempotencyRecord } from '../../../src/persistence';
88
import { IdempotencyRecordStatus } from '../../../src/types';
99

1010
const mockIdempotencyKey = '123';

0 commit comments

Comments
 (0)