-
Notifications
You must be signed in to change notification settings - Fork 154
/
Copy pathtypes.ts
99 lines (90 loc) · 2.14 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import type { App, Stack } from 'aws-cdk-lib';
import type { AttributeType, TableProps } from 'aws-cdk-lib/aws-dynamodb';
import type { NodejsFunctionProps } from 'aws-cdk-lib/aws-lambda-nodejs';
import type { LogLevel } from './constants.js';
interface ExtraTestProps {
/**
* The suffix to be added to the resource name.
*
* For example, if the resource name is `fn-12345` and the suffix is `BasicFeatures`,
* the output will be `fn-12345-BasicFeatures`.
*
* Note that the maximum length of the name is 64 characters, so the suffix might be truncated.
*/
nameSuffix: string;
/**
* The output format of the bundled code.
*
* @default 'CJS'
*/
outputFormat?: 'CJS' | 'ESM';
}
type TestDynamodbTableProps = Omit<
TableProps,
'removalPolicy' | 'tableName' | 'billingMode' | 'partitionKey'
> & {
partitionKey?: {
name: string;
type: AttributeType;
};
};
type TestNodejsFunctionProps = Omit<
NodejsFunctionProps,
'logRetention' | 'runtime' | 'functionName' | 'bundling'
> & {
bundling?: Omit<
NodejsFunctionProps['bundling'],
'minify' | 'mainFields' | 'sourceMap' | 'format' | 'banner'
>;
};
type InvokeTestFunctionOptions = {
functionName: string;
times?: number;
invocationMode?: 'PARALLEL' | 'SEQUENTIAL';
payload?: Record<string, unknown> | Array<Record<string, unknown>>;
};
type ErrorField = {
name: string;
message: string;
stack: string;
};
type FunctionLog = {
level: keyof typeof LogLevel;
error: ErrorField;
} & { [key: string]: unknown };
type StackNameProps = {
/**
* Prefix for the stack name.
*/
stackNamePrefix: string;
/**
* Name of the test.
*/
testName: string;
};
interface TestStackProps {
/**
* Name of the test stack.
*/
stackNameProps: StackNameProps;
/**
* Reference to the AWS CDK App object.
* @default new App()
*/
app?: App;
/**
* Reference to the AWS CDK Stack object.
* @default new Stack(this.app, stackName)
*/
stack?: Stack;
}
export type {
ExtraTestProps,
TestDynamodbTableProps,
TestNodejsFunctionProps,
InvokeTestFunctionOptions,
ErrorField,
FunctionLog,
StackNameProps,
TestStackProps,
};