@lambda-kata/cdk 0.1.3-rc.94 → 0.1.3-rc.96
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.
package/out/tsc/src/index.d.ts
CHANGED
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export { KataProps, LicensingResponse, TransformationConfig } from './types';
|
|
21
|
-
export { LicensingService, HttpLicensingService, createLicensingService, isValidAccountId, } from './licensing';
|
|
21
|
+
export { LicensingService, LicenseCheckParams, HttpLicensingService, createLicensingService, isValidAccountId, } from './licensing';
|
|
22
22
|
export { MockLicensingService, createMockLicensingService, } from './mock-licensing';
|
|
23
23
|
export { resolveAccountId, resolveAccountIdWithSource, isValidAccountIdFormat, AccountResolutionError, AccountResolutionResult, AccountResolverOptions, } from './account-resolver';
|
|
24
24
|
export { resolveAccountIdSync, resolveAccountIdSyncWithSource, resolveRegionSync, SyncAccountResolutionError, SyncAccountResolutionResult, SyncAccountResolverOptions, } from './sync-account-resolver';
|
|
25
|
-
export { kata, kataWithAccountId, applyTransformation, handleUnlicensed, isKataTransformed, getKataPromise, extractBundlePathFromHandler, KataWrapperOptions, KataResult, } from './kata-wrapper';
|
|
25
|
+
export { kata, kataWithAccountId, applyTransformation, handleUnlicensed, isKataTransformed, getKataPromise, extractBundlePathFromHandler, extractNodeVersion, KataWrapperOptions, KataResult, } from './kata-wrapper';
|
|
26
26
|
export { SnapStartActivator, SnapStartActivatorProps, } from './snapstart-construct';
|
|
27
27
|
export { activateSnapStart, SnapStartActivationResult, SnapStartActivatorConfig, } from './snapstart-activator';
|
|
28
28
|
export { createKataConfigLayer, generateConfigContent, KataConfigLayerProps, CONFIG_DIR_NAME, CONFIG_FILE_NAME, HANDLER_CONFIG_KEY, } from './config-layer';
|
|
@@ -169,6 +169,20 @@ export declare function extractBundlePathFromHandler(handler: string): string;
|
|
|
169
169
|
* @internal
|
|
170
170
|
*/
|
|
171
171
|
export declare function getOriginalRuntime(lambda: NodejsFunction | LambdaFunction): string;
|
|
172
|
+
/**
|
|
173
|
+
* Extracts the Node.js major version number from a runtime string.
|
|
174
|
+
*
|
|
175
|
+
* @param runtime - The runtime string (e.g., "nodejs20.x")
|
|
176
|
+
* @returns The major version number as NodeVersion type, or "20" as default
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* extractNodeVersion("nodejs20.x") // => "20"
|
|
180
|
+
* extractNodeVersion("nodejs22.x") // => "22"
|
|
181
|
+
* extractNodeVersion("python3.12") // => "20" (default for non-Node.js)
|
|
182
|
+
*
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
185
|
+
export declare function extractNodeVersion(runtime: string): '18' | '20' | '22' | '24';
|
|
172
186
|
/**
|
|
173
187
|
* Detects if a Lambda function uses a Node.js runtime.
|
|
174
188
|
*
|
|
@@ -7,6 +7,37 @@
|
|
|
7
7
|
* @module licensing
|
|
8
8
|
*/
|
|
9
9
|
import { LicensingResponse } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Supported Node.js versions for licensing requests.
|
|
12
|
+
* Valid values: "18", "20", "22", "24"
|
|
13
|
+
*/
|
|
14
|
+
export type NodeVersion = '18' | '20' | '22' | '24';
|
|
15
|
+
/**
|
|
16
|
+
* Supported architectures for licensing requests.
|
|
17
|
+
* Valid values: "x86_64", "arm64"
|
|
18
|
+
*/
|
|
19
|
+
export type LicenseArchitecture = 'x86_64' | 'arm64';
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for license entitlement check.
|
|
22
|
+
*/
|
|
23
|
+
export interface LicenseCheckParams {
|
|
24
|
+
/**
|
|
25
|
+
* AWS account ID (12-digit string)
|
|
26
|
+
*/
|
|
27
|
+
accountId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Node.js version number.
|
|
30
|
+
* Valid values: "18", "20", "22", "24"
|
|
31
|
+
* @default "20"
|
|
32
|
+
*/
|
|
33
|
+
nodeVersion?: NodeVersion;
|
|
34
|
+
/**
|
|
35
|
+
* Lambda architecture.
|
|
36
|
+
* Valid values: "x86_64", "arm64"
|
|
37
|
+
* @default "x86_64"
|
|
38
|
+
*/
|
|
39
|
+
architecture?: LicenseArchitecture;
|
|
40
|
+
}
|
|
10
41
|
/**
|
|
11
42
|
* Interface for the Lambda Kata licensing service.
|
|
12
43
|
*
|
|
@@ -16,9 +47,13 @@ import { LicensingResponse } from './types';
|
|
|
16
47
|
* @example
|
|
17
48
|
* ```typescript
|
|
18
49
|
* const licensingService = new HttpLicensingService();
|
|
19
|
-
* const response = await licensingService.checkEntitlement(
|
|
50
|
+
* const response = await licensingService.checkEntitlement({
|
|
51
|
+
* accountId: '123456789012',
|
|
52
|
+
* nodeVersion: '20',
|
|
53
|
+
* architecture: 'x86_64'
|
|
54
|
+
* });
|
|
20
55
|
* if (response.entitled) {
|
|
21
|
-
* console.log(`Layer ARN: ${response.
|
|
56
|
+
* console.log(`Layer ARN: ${response.layerVersionArn}`);
|
|
22
57
|
* }
|
|
23
58
|
* ```
|
|
24
59
|
*/
|
|
@@ -26,7 +61,8 @@ export interface LicensingService {
|
|
|
26
61
|
/**
|
|
27
62
|
* Check if an AWS account is entitled to use Lambda Kata.
|
|
28
63
|
*
|
|
29
|
-
* @param
|
|
64
|
+
* @param params - License check parameters (accountId, nodeVersion, architecture)
|
|
65
|
+
* For backward compatibility, can also be just accountId string
|
|
30
66
|
* @returns Promise resolving to entitlement status and Layer ARN if entitled
|
|
31
67
|
*
|
|
32
68
|
* @remarks
|
|
@@ -34,7 +70,7 @@ export interface LicensingService {
|
|
|
34
70
|
* - If the account is not entitled, the response will have `entitled: false`
|
|
35
71
|
* - Network errors are handled gracefully and treated as unlicensed (Requirement 6.5)
|
|
36
72
|
*/
|
|
37
|
-
checkEntitlement(
|
|
73
|
+
checkEntitlement(params: LicenseCheckParams | string): Promise<LicensingResponse>;
|
|
38
74
|
}
|
|
39
75
|
/**
|
|
40
76
|
* HTTP-based implementation of the LicensingService interface.
|
|
@@ -69,7 +105,7 @@ export declare class HttpLicensingService implements LicensingService {
|
|
|
69
105
|
* AWS Marketplace entitlement. If the service is unreachable or returns
|
|
70
106
|
* an error, the account is treated as unlicensed (Requirement 6.5).
|
|
71
107
|
*
|
|
72
|
-
* @param
|
|
108
|
+
* @param params - License check parameters or accountId string for backward compatibility
|
|
73
109
|
* @returns Promise resolving to entitlement status and Layer ARN if entitled
|
|
74
110
|
*
|
|
75
111
|
* @remarks
|
|
@@ -78,11 +114,13 @@ export declare class HttpLicensingService implements LicensingService {
|
|
|
78
114
|
* - 3.3: Returns the customer-specific Layer_ARN if entitled
|
|
79
115
|
* - 6.5: Treats unreachable service as unlicensed with appropriate warning
|
|
80
116
|
*/
|
|
81
|
-
checkEntitlement(
|
|
117
|
+
checkEntitlement(params: LicenseCheckParams | string): Promise<LicensingResponse>;
|
|
82
118
|
/**
|
|
83
119
|
* Makes the HTTP request to the licensing service.
|
|
84
120
|
*
|
|
85
121
|
* @param accountId - The AWS account ID to check
|
|
122
|
+
* @param nodeVersion - Optional Node.js version (defaults to "20")
|
|
123
|
+
* @param architecture - Optional architecture (defaults to "x86_64")
|
|
86
124
|
* @returns Promise resolving to the licensing response
|
|
87
125
|
* @throws Error if the request fails or times out
|
|
88
126
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module mock-licensing
|
|
8
8
|
*/
|
|
9
|
-
import { LicensingService } from './licensing';
|
|
9
|
+
import { LicensingService, LicenseCheckParams } from './licensing';
|
|
10
10
|
import { LicensingResponse } from './types';
|
|
11
11
|
/**
|
|
12
12
|
* Mock implementation of the LicensingService interface for testing.
|
|
@@ -171,7 +171,7 @@ export declare class MockLicensingService implements LicensingService {
|
|
|
171
171
|
* This mock implementation returns entitlement status based on
|
|
172
172
|
* accounts configured via setEntitled().
|
|
173
173
|
*
|
|
174
|
-
* @param
|
|
174
|
+
* @param params - License check parameters or accountId string for backward compatibility
|
|
175
175
|
* @returns Promise resolving to entitlement status and Layer ARN if entitled
|
|
176
176
|
*
|
|
177
177
|
* @remarks
|
|
@@ -179,7 +179,7 @@ export declare class MockLicensingService implements LicensingService {
|
|
|
179
179
|
* - 3.2: Validates the account's entitlement based on configured entitlements
|
|
180
180
|
* - 3.3: Returns the customer-specific Layer_ARN if entitled
|
|
181
181
|
*/
|
|
182
|
-
checkEntitlement(
|
|
182
|
+
checkEntitlement(params: LicenseCheckParams | string): Promise<LicensingResponse>;
|
|
183
183
|
/**
|
|
184
184
|
* Returns the number of entitled accounts.
|
|
185
185
|
*
|
package/out/tsc/src/types.d.ts
CHANGED
|
@@ -51,7 +51,8 @@ export interface LicensingResponse {
|
|
|
51
51
|
* This is the ARN that should be used when attaching layers to Lambda functions.
|
|
52
52
|
* Only present if the account is entitled.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
54
|
+
* Format: lambda-kata-node{version}-{arch}-{regionCode}
|
|
55
|
+
* @example "arn:aws:lambda:eu-central-1:113258654684:layer:lambda-kata-node20-x86_64-euc:1"
|
|
55
56
|
*/
|
|
56
57
|
layerVersionArn?: string;
|
|
57
58
|
/**
|
|
@@ -63,6 +64,18 @@ export interface LicensingResponse {
|
|
|
63
64
|
* Only present if the account is entitled.
|
|
64
65
|
*/
|
|
65
66
|
expiresAt?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Node.js version used for the layer.
|
|
69
|
+
* Echoed back from the request or defaults to "20".
|
|
70
|
+
* @example "20", "22", "24"
|
|
71
|
+
*/
|
|
72
|
+
nodeVersion?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Architecture used for the layer.
|
|
75
|
+
* Echoed back from the request or defaults to "x86_64".
|
|
76
|
+
* @example "x86_64", "arm64"
|
|
77
|
+
*/
|
|
78
|
+
architecture?: string;
|
|
66
79
|
}
|
|
67
80
|
/**
|
|
68
81
|
* Configuration for transforming a Lambda function to use Lambda Kata.
|
package/package.json
CHANGED