Skip to content
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ site
tmp

# TS build files
tsconfig.tsbuildinfo
tsconfig.esm.tsbuildinfo
*.tsbuildinfo
17 changes: 14 additions & 3 deletions layers/tests/e2e/layerPublisher.class.test.functionCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,22 @@ const getVersionFromModule = async (moduleName: string): Promise<string> => {

export const handler = async (): Promise<void> => {
// Check that the packages version matches the expected one
for (const moduleName of ['commons', 'logger', 'metrics', 'tracer']) {
for (const moduleName of [
'commons',
'logger',
'metrics',
'tracer',
'parameters',
'idempotency',
'batch',
]) {
const moduleVersion = await getVersionFromModule(moduleName);
if (moduleVersion != expectedVersion) {
// TODO: remove this check once v2 becomes GA
// if (moduleVersion != expectedVersion) {
if (!moduleVersion.startsWith(expectedVersion)) {
throw new Error(
`Package version mismatch (${moduleName}): ${moduleVersion} != ${expectedVersion}`
// `Package version mismatch (${moduleName}): ${moduleVersion} != ${expectedVersion}`
`Package version mismatch (${moduleName}): ${moduleVersion} does not start with ${expectedVersion}`
);
}
}
Expand Down
7 changes: 3 additions & 4 deletions packages/batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
"test:e2e:nodejs18x": "echo 'Not Implemented'",
"test:e2e": "echo 'Not Implemented'",
"watch": "jest --watch",
"build:cjs": "tsc --build --force && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --project tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"prebuild": "rimraf ./lib",
"prepack": "rimraf ./lib/*.tsbuildinfo && node ../../.github/scripts/release_patch_package_json.js ."
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
},
"lint-staged": {
"*.{js,ts}": "npm run lint-fix"
Expand Down
3 changes: 2 additions & 1 deletion packages/batch/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src"
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
},
"include": [
"./src/**/*"
Expand Down
1 change: 1 addition & 0 deletions packages/batch/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"outDir": "./lib/cjs/",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
Expand Down
6 changes: 3 additions & 3 deletions packages/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"test:e2e": "echo 'Not Applicable'",
"watch": "jest --watch",
"generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts",
"build:cjs": "tsc --build --force && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --project tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"prepack": "rimraf ./lib/*.tsbuildinfo && node ../../.github/scripts/release_patch_package_json.js ."
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
},
"lint-staged": {
"*.{js,ts}": "npm run lint-fix"
Expand Down
11 changes: 8 additions & 3 deletions packages/commons/src/types/LambdaInterface.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { Handler } from 'aws-lambda';

export type SyncHandler<T extends Handler> = (
type SyncHandler<T extends Handler> = (
event: Parameters<T>[0],
context: Parameters<T>[1],
callback: Parameters<T>[2]
) => void;

export type AsyncHandler<T extends Handler> = (
type AsyncHandler<T extends Handler> = (
event: Parameters<T>[0],
context: Parameters<T>[1]
) => Promise<NonNullable<Parameters<Parameters<T>[2]>[1]>>;
Expand All @@ -23,4 +23,9 @@ type HandlerMethodDecorator = (
| TypedPropertyDescriptor<AsyncHandler<Handler>>
) => void;

export { LambdaInterface, HandlerMethodDecorator };
export type {
AsyncHandler,
SyncHandler,
LambdaInterface,
HandlerMethodDecorator,
};
2 changes: 1 addition & 1 deletion packages/commons/src/types/awsSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ interface SdkClient {
*/
type MiddlewareArgsLike = { request: { headers: { [key: string]: string } } };

export { SdkClient, MiddlewareArgsLike };
export type { SdkClient, MiddlewareArgsLike };
13 changes: 9 additions & 4 deletions packages/commons/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
export {
export type {
MiddlewareLikeObj,
MiddyLikeRequest,
CleanupFunction,
} from './middy.js';
export { SdkClient, MiddlewareArgsLike } from './awsSdk.js';
export { JSONPrimitive, JSONValue, JSONObject, JSONArray } from './json.js';
export {
export type { SdkClient, MiddlewareArgsLike } from './awsSdk.js';
export type {
JSONPrimitive,
JSONValue,
JSONObject,
JSONArray,
} from './json.js';
export type {
SyncHandler,
AsyncHandler,
LambdaInterface,
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/src/types/middy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ type MiddyLikeRequest = {
*/
type CleanupFunction = (request: MiddyLikeRequest) => Promise<void>;

export { MiddlewareLikeObj, MiddyLikeRequest, CleanupFunction };
export type { MiddlewareLikeObj, MiddyLikeRequest, CleanupFunction };
3 changes: 2 additions & 1 deletion packages/commons/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src"
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
},
"include": [
"./src/**/*"
Expand Down
1 change: 1 addition & 0 deletions packages/commons/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"outDir": "./lib/cjs/",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
Expand Down
9 changes: 4 additions & 5 deletions packages/idempotency/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
"test:e2e": "jest --group=e2e",
"watch": "jest --watch",
"build:cjs": "tsc --build --force && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --project tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"prebuild": "rimraf ./lib",
"prepack": "rimraf ./lib/*.tsbuildinfo && node ../../.github/scripts/release_patch_package_json.js ."
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
},
"lint-staged": {
"*.{js,ts}": "npm run lint-fix"
Expand Down Expand Up @@ -136,4 +135,4 @@
"aws-sdk-client-mock": "^3.0.0",
"aws-sdk-client-mock-jest": "^3.0.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/idempotency/src/types/BasePersistenceLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ interface BasePersistenceLayerInterface {
getRecord(data: unknown): Promise<IdempotencyRecord>;
}

export { BasePersistenceLayerOptions, BasePersistenceLayerInterface };
export type { BasePersistenceLayerOptions, BasePersistenceLayerInterface };
2 changes: 1 addition & 1 deletion packages/idempotency/src/types/ConfigServiceInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ interface ConfigServiceInterface {
getIdempotencyEnabled(): boolean;
}

export { ConfigServiceInterface };
export type { ConfigServiceInterface };
2 changes: 1 addition & 1 deletion packages/idempotency/src/types/IdempotencyOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ type IdempotencyConfigOptions = {
lambdaContext?: Context;
};

export {
export type {
AnyFunction,
IdempotencyConfigOptions,
ItempotentFunctionOptions,
Expand Down
2 changes: 1 addition & 1 deletion packages/idempotency/src/types/IdempotencyRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ type IdempotencyRecordOptions = {
payloadHash?: string;
};

export { IdempotencyRecordStatusValue, IdempotencyRecordOptions };
export type { IdempotencyRecordStatusValue, IdempotencyRecordOptions };
2 changes: 1 addition & 1 deletion packages/idempotency/src/types/LRUCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ type LRUCacheOptions = {
maxSize: number;
};

export { LRUCacheOptions };
export type { LRUCacheOptions };
6 changes: 3 additions & 3 deletions packages/idempotency/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export {
export type {
IdempotencyRecordOptions,
IdempotencyRecordStatusValue,
} from './IdempotencyRecord.js';
export {
export type {
BasePersistenceLayerInterface,
BasePersistenceLayerOptions,
} from './BasePersistenceLayer.js';
export {
export type {
IdempotencyConfigOptions,
IdempotencyLambdaHandlerOptions,
IdempotencyHandlerOptions,
Expand Down
3 changes: 2 additions & 1 deletion packages/idempotency/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src"
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
},
"include": [
"./src/**/*"
Expand Down
1 change: 1 addition & 0 deletions packages/idempotency/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"outDir": "./lib/cjs",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
Expand Down
7 changes: 3 additions & 4 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
"test:e2e": "jest --group=e2e",
"watch": "jest --watch --group=unit",
"build:cjs": "tsc --build --force && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --project tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"prebuild": "rimraf ./lib",
"prepack": "rimraf ./lib/*.tsbuildinfo && node ../../.github/scripts/release_patch_package_json.js ."
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
},
"lint-staged": {
"*.{js,ts}": "npm run lint-fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/src/types/ConfigServiceInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ interface ConfigServiceInterface {
isValueTrue(value: string): boolean;
}

export { ConfigServiceInterface };
export type { ConfigServiceInterface };
2 changes: 1 addition & 1 deletion packages/logger/src/types/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type LoggerInterface = {
warn(input: LogItemMessage, ...extraInput: LogItemExtraInput): void;
};

export {
export type {
LogFunction,
LoggerInterface,
LogItemMessage,
Expand Down
1 change: 0 additions & 1 deletion packages/logger/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export type {
LogAttributes,
LogLevel,
} from './Log.js';

export type {
LogItemMessage,
LogItemExtraInput,
Expand Down
9 changes: 6 additions & 3 deletions packages/logger/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src"
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
},
"include": ["./src/**/*"]
}
"include": [
"./src/**/*"
]
}
9 changes: 6 additions & 3 deletions packages/logger/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/cjs/",
"rootDir": "./src"
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": ["./src/**/*"]
}
"include": [
"./src/**/*"
]
}
7 changes: 3 additions & 4 deletions packages/metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
"test:e2e": "jest --group=e2e",
"watch": "jest --group=unit --watch ",
"build:cjs": "tsc --build --force && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --project tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"prebuild": "rimraf ./lib",
"prepack": "rimraf ./lib/*.tsbuildinfo && node ../../.github/scripts/release_patch_package_json.js ."
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
},
"lint-staged": {
"*.{js,ts}": "npm run lint-fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/metrics/src/types/ConfigServiceInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ interface ConfigServiceInterface {
getServiceName(): string;
}

export { ConfigServiceInterface };
export type { ConfigServiceInterface };
2 changes: 1 addition & 1 deletion packages/metrics/src/types/Metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type MetricDefinition = {
StorageResolution?: MetricResolution;
};

export {
export type {
MetricsOptions,
Dimensions,
EmfOutput,
Expand Down
2 changes: 1 addition & 1 deletion packages/metrics/src/types/MetricsInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ interface MetricsInterface {
singleMetric(): Metrics;
}

export { MetricsInterface };
export type { MetricsInterface };
6 changes: 3 additions & 3 deletions packages/metrics/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export {
export type {
MetricsOptions,
Dimensions,
EmfOutput,
Expand All @@ -9,5 +9,5 @@ export {
MetricResolution,
MetricUnit,
} from './Metrics.js';
export { ConfigServiceInterface } from './ConfigServiceInterface.js';
export { MetricsInterface } from './MetricsInterface.js';
export type { ConfigServiceInterface } from './ConfigServiceInterface.js';
export type { MetricsInterface } from './MetricsInterface.js';
3 changes: 2 additions & 1 deletion packages/metrics/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src"
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
},
"include": [
"./src/**/*"
Expand Down
1 change: 1 addition & 0 deletions packages/metrics/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"outDir": "./lib/cjs",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
Expand Down
Loading