@lafken/common 0.11.8 → 0.11.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { EnvironmentValue, GetResourceProps } from '../../types';
|
|
1
|
+
import type { EnvironmentValue, GetResourceProps, LambdaReferenceNames, ResourceOutputType } from '../../types';
|
|
2
2
|
import type { ServicesValues } from '../../types/services.types';
|
|
3
|
+
export type LambdaOutputAttributes = 'arn' | 'invokeArn' | 'qualifiedArn';
|
|
3
4
|
export interface VpcConfig {
|
|
4
5
|
/**
|
|
5
6
|
* Enables IPv6 for dual-stack networking.
|
|
@@ -51,6 +52,43 @@ export interface AliasConfig {
|
|
|
51
52
|
*/
|
|
52
53
|
provisionedExecutions?: number;
|
|
53
54
|
}
|
|
55
|
+
export interface LoggingConfig {
|
|
56
|
+
/**
|
|
57
|
+
* Log format for the Lambda function.
|
|
58
|
+
*
|
|
59
|
+
* Controls the format of the log records written to CloudWatch.
|
|
60
|
+
* - `'Text'`: Unstructured text output (default Lambda behaviour).
|
|
61
|
+
* - `'JSON'`: Structured JSON records, enabling `applicationLogLevel`
|
|
62
|
+
* and `systemLogLevel`.
|
|
63
|
+
*/
|
|
64
|
+
logFormat: 'text' | 'json';
|
|
65
|
+
/**
|
|
66
|
+
* Log retention period in days.
|
|
67
|
+
*
|
|
68
|
+
* Specifies the number of days to retain Lambda invocation logs
|
|
69
|
+
* in the CloudWatch Log Group before they are automatically deleted.
|
|
70
|
+
* When omitted, the log group never expires.
|
|
71
|
+
*/
|
|
72
|
+
retentionInDays?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Application-level log verbosity.
|
|
75
|
+
*
|
|
76
|
+
* Only valid when `logFormat` is `'json'`.
|
|
77
|
+
* Controls the level of logs emitted by your function code.
|
|
78
|
+
*
|
|
79
|
+
* Supported values: `'trace'` | `'debug'` | `'info'` | `'warn'` | `'error'` | `'fatal'`
|
|
80
|
+
*/
|
|
81
|
+
applicationLogLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
82
|
+
/**
|
|
83
|
+
* System-level log verbosity.
|
|
84
|
+
*
|
|
85
|
+
* Only valid when `logFormat` is `'json'`.
|
|
86
|
+
* Controls the level of logs emitted by the Lambda runtime itself.
|
|
87
|
+
*
|
|
88
|
+
* Supported values: `'debug'` | `'info'` | `'warn'`
|
|
89
|
+
*/
|
|
90
|
+
systemLogLevel?: 'debug' | 'info' | 'warn';
|
|
91
|
+
}
|
|
54
92
|
export interface LambdaProps {
|
|
55
93
|
/**
|
|
56
94
|
* Lambda execution timeout.
|
|
@@ -170,6 +208,34 @@ export interface LambdaProps {
|
|
|
170
208
|
* { name: 'live', provisionedExecutions: 5 }
|
|
171
209
|
*/
|
|
172
210
|
alias?: AliasConfig;
|
|
211
|
+
/**
|
|
212
|
+
* Logging configuration for the Lambda function.
|
|
213
|
+
*
|
|
214
|
+
* When provided, configures the CloudWatch logging behaviour for the
|
|
215
|
+
* Lambda function. If `logGroup` is specified, a `CloudwatchLogGroup`
|
|
216
|
+
* resource will be created and linked automatically.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* { logFormat: 'Text', logGroup: { name: '/aws/lambda/my-fn', retentionInDays: 30 } }
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* { logFormat: 'JSON', applicationLogLevel: 'WARN', systemLogLevel: 'INFO' }
|
|
223
|
+
*/
|
|
224
|
+
loggingConfig?: LoggingConfig;
|
|
225
|
+
/**
|
|
226
|
+
* Output configuration for the Lambda function.
|
|
227
|
+
*
|
|
228
|
+
* Defines which attributes should be exported to SSM Parameter Store or
|
|
229
|
+
* as Terraform outputs. Supported attributes: `'arn'`, `'invokeArn'`, `'qualifiedArn'`.
|
|
230
|
+
*/
|
|
231
|
+
outputs?: ResourceOutputType<LambdaOutputAttributes>;
|
|
232
|
+
/**
|
|
233
|
+
* Registers this Lambda as a named global reference.
|
|
234
|
+
*
|
|
235
|
+
* Allows other resources to look up this function by name via
|
|
236
|
+
* `lafkenResource.getResource('lambda', ref)`.
|
|
237
|
+
*/
|
|
238
|
+
ref?: LambdaReferenceNames;
|
|
173
239
|
}
|
|
174
240
|
export interface LambdaMetadata {
|
|
175
241
|
name: string;
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface
|
|
4
|
-
}
|
|
5
|
-
export
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
type
|
|
20
|
-
type
|
|
21
|
-
export type
|
|
22
|
-
export type
|
|
23
|
-
export type
|
|
24
|
-
export type
|
|
25
|
-
export type
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
28
|
-
export type
|
|
29
|
-
export type
|
|
30
|
-
export type
|
|
31
|
-
export type
|
|
32
|
-
export type EventBusScopedNames = StackResourceName<EventBusAvailable, 'event-bus'>;
|
|
33
|
-
export type DynamoTableNames = ResourceNames<DynamoTableAvailable>;
|
|
34
|
-
export type DynamoTableScopedNames = StackResourceName<DynamoTableAvailable, 'dynamo'>;
|
|
35
|
-
export type StateMachineNames = ResourceIdentifiers<ModulesAvailable, 'StateMachine'> | (string & {});
|
|
36
|
-
export type StateMachineScopedNames = ScopedResourceNames<ModulesAvailable, 'StateMachine', 'state-machine'> | (string & {});
|
|
37
|
-
export type QueueNames = ResourceIdentifiers<ModulesAvailable, 'Queue'> | (string & {});
|
|
38
|
-
export type QueueScopedNames = ScopedResourceNames<ModulesAvailable, 'Queue', 'queue'> | (string & {});
|
|
39
|
-
export {};
|
|
1
|
+
export interface SharedResourceNames {
|
|
2
|
+
}
|
|
3
|
+
export interface SharedReferenceResources {
|
|
4
|
+
}
|
|
5
|
+
export type ResourceScopedKeys<T> = {
|
|
6
|
+
[Scope in keyof T]: `${Scope & string}::${T[Scope] & string}`;
|
|
7
|
+
}[keyof T];
|
|
8
|
+
export type ResourceScopeKeys<T, Scope extends string> = T extends Record<Scope, string> ? T[Scope] : string & {};
|
|
9
|
+
export type AvailableReference = [keyof SharedReferenceResources] extends [never] ? string : ResourceScopedKeys<SharedReferenceResources>;
|
|
10
|
+
export type ApiNames = ResourceScopeKeys<SharedResourceNames, 'api'>;
|
|
11
|
+
export type ApiReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'api'>;
|
|
12
|
+
export type BucketNames = ResourceScopeKeys<SharedResourceNames, 'bucket'>;
|
|
13
|
+
export type BucketReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'bucket'>;
|
|
14
|
+
export type DynamoTableNames = ResourceScopeKeys<SharedResourceNames, 'dynamo'>;
|
|
15
|
+
export type DynamoReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'dynamo'>;
|
|
16
|
+
export type StateMachineNames = ResourceScopeKeys<SharedResourceNames, 'state-machine'>;
|
|
17
|
+
export type StateMachineReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'state-machine'>;
|
|
18
|
+
export type EventBusNames = ResourceScopeKeys<SharedResourceNames, 'event-bus'>;
|
|
19
|
+
export type EventBusReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'event-bus'>;
|
|
20
|
+
export type EventRuleReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'event-rule'>;
|
|
21
|
+
export type QueueNames = ResourceScopeKeys<SharedResourceNames, 'queue'>;
|
|
22
|
+
export type QueueReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'queue'>;
|
|
23
|
+
export type UserPoolNames = ResourceScopeKeys<SharedResourceNames, 'user-pool'>;
|
|
24
|
+
export type UserPoolReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'user-pool'>;
|
|
25
|
+
export type UserPoolClientNames = ResourceScopeKeys<SharedResourceNames, 'user-pool-client'>;
|
|
26
|
+
export type UserPoolClientReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'user-pool-client'>;
|
|
27
|
+
export type ApiAuthorizerNames = ResourceScopeKeys<SharedResourceNames, 'api-authorizer'>;
|
|
28
|
+
export type ScheduleReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'schedule'>;
|
|
29
|
+
export type LambdaNames = ResourceScopeKeys<SharedResourceNames, 'lambda'>;
|
|
30
|
+
export type LambdaReferenceNames = ResourceScopeKeys<SharedReferenceResources, 'lambda'>;
|
|
31
|
+
export type RegisterNamespaces = 'api' | 'bucket' | 'dynamo' | 'state-machine' | 'queue' | 'authentication' | 'api-authorizer' | 'user-pool' | 'user-pool-client' | 'schedule' | 'event-bus' | 'event-rule' | 'lambda' | (string & {});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GetResourceValue } from './output.types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AvailableReference } from './override-resources.types';
|
|
3
3
|
export interface ClassResource {
|
|
4
4
|
new (...args: any[]): {};
|
|
5
5
|
}
|
|
@@ -272,7 +272,7 @@ export interface GetResourceProps {
|
|
|
272
272
|
* // Get a bucket ARN
|
|
273
273
|
* getResourceValue('bucket::uploads', 'arn')
|
|
274
274
|
*/
|
|
275
|
-
getResourceValue: GetResourceValue<
|
|
275
|
+
getResourceValue: GetResourceValue<AvailableReference>;
|
|
276
276
|
/**
|
|
277
277
|
* Retrieves a value from AWS Systems Manager Parameter Store.
|
|
278
278
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lafken/common",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Lafken utilities - TypeScript decorator factories and metadata reflection for infrastructure-as-code decorators",
|
|
6
6
|
"keywords": [
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"reflect-metadata": "0.2.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@swc/core": "^1.15.
|
|
35
|
-
"@swc/helpers": "^0.5.
|
|
36
|
-
"@vitest/runner": "^4.1.
|
|
34
|
+
"@swc/core": "^1.15.30",
|
|
35
|
+
"@swc/helpers": "^0.5.21",
|
|
36
|
+
"@vitest/runner": "^4.1.5",
|
|
37
37
|
"cdktn-vitest": "^1.0.0",
|
|
38
|
-
"typescript": "6.0.
|
|
38
|
+
"typescript": "6.0.3",
|
|
39
39
|
"unplugin-swc": "^1.5.9",
|
|
40
|
-
"vitest": "^4.1.
|
|
40
|
+
"vitest": "^4.1.5"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=20.19"
|