@go-to-k/cdkd 0.135.0 → 0.136.0
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/dist/cli.js +100 -190
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-CX1x5ug1.js → deploy-engine-DZYchTh6.js} +663 -3
- package/dist/deploy-engine-DZYchTh6.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-CX1x5ug1.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { _ as withSkipPrefix, a as runDockerStreaming, c as getLogger, d as getLiveRenderer, f as PATTERN_B_NAME_PROPERTIES, g as generateResourceNameWithFallback, h as generateResourceName, i as runDockerForeground, n as formatDockerLoginError, p as PATTERN_B_RESOURCE_TYPES, r as getDockerCmd, u as runStackBuffered, v as withStackName } from "./docker-cmd-EtWSTAje.js";
|
|
3
|
-
import { A as AssetPublisher, B as resolveStateBucketWithDefault, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as getDefaultStateBucketName, G as
|
|
3
|
+
import { A as AssetPublisher, B as resolveStateBucketWithDefault, C as applyRoleArnIfSet, D as LockManager, E as TemplateParser, F as getDefaultStateBucketName, G as MIGRATE_TMP_PREFIX, H as warnDeprecatedNoPrefixCliFlag, I as getLegacyStateBucketName, J as AssemblyReader, K as findLargeInlineResources, L as resolveApp, M as WorkGraph, N as buildDockerImage, O as S3StateBackend, P as Synthesizer, Q as CdkdError, R as resolveCaptureObservedState, S as IntrinsicFunctionResolver, T as DagBuilder, U as CFN_TEMPLATE_BODY_LIMIT, V as resolveStateBucketWithDefaultAndSource, W as CFN_TEMPLATE_URL_LIMIT, X as resolveBucketRegion, _ as normalizeAwsTagsToCfn, _t as normalizeAwsError, a as withRetry, at as MissingCdkCliError, b as CloudControlProvider, c as cyan, ct as ResourceTimeoutError, d as red, dt as StackHasActiveImportsError, f as yellow, ft as StackTerminationProtectionError, g as matchesCdkPath, h as CDK_PATH_TAG, i as withResourceDeadline, j as stringifyValue, k as shouldRetainResource, l as gray, lt as ResourceUpdateNotSupportedError, m as collectInlinePolicyNamesManagedBySiblings, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as LocalMigrateError, o as IMPLICIT_DELETE_DEPENDENCIES, ot as PartialFailureError, p as IAMRoleProvider, q as uploadCfnTemplate, r as DeployEngine, rt as LocalStartServiceError, s as bold, st as ProvisioningError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as LocalInvokeBuildError, u as green, ut as RouteDiscoveryError, v as resolveExplicitPhysicalId, vt as withErrorHandling, w as DiffCalculator, x as assertRegionMatch, y as ProviderRegistry, z as resolveSkipPrefix } from "./deploy-engine-DZYchTh6.js";
|
|
4
4
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-BF03Alpe.js";
|
|
5
5
|
import { createHash, createHmac, createPublicKey, createVerify, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
6
|
-
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand,
|
|
6
|
+
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
7
7
|
import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachUserPolicyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachUserPolicyCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListInstanceProfilesCommand, ListUserPoliciesCommand, ListUserTagsCommand, ListUsersCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagUserCommand, UntagUserCommand, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
|
|
8
8
|
import { CreateQueueCommand, DeleteQueueCommand, GetQueueAttributesCommand, GetQueueUrlCommand, ListQueueTagsCommand, ListQueuesCommand, QueueDoesNotExist, SQSClient, SetQueueAttributesCommand, TagQueueCommand, UntagQueueCommand } from "@aws-sdk/client-sqs";
|
|
9
9
|
import { CreateTopicCommand, DeleteTopicCommand, GetSubscriptionAttributesCommand, GetTopicAttributesCommand, ListTagsForResourceCommand, ListTopicsCommand, NotFoundException, SNSClient, SetTopicAttributesCommand, SubscribeCommand, TagResourceCommand, UnsubscribeCommand, UntagResourceCommand } from "@aws-sdk/client-sns";
|
|
@@ -30866,7 +30866,9 @@ async function deployCommand(stacks, options) {
|
|
|
30866
30866
|
output: options.output,
|
|
30867
30867
|
...options.region && { region: options.region },
|
|
30868
30868
|
...options.profile && { profile: options.profile },
|
|
30869
|
-
...Object.keys(context).length > 0 && { context }
|
|
30869
|
+
...Object.keys(context).length > 0 && { context },
|
|
30870
|
+
stateBucket,
|
|
30871
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
30870
30872
|
});
|
|
30871
30873
|
logger.debug(`Found ${allStacks.length} stack(s) in assembly`);
|
|
30872
30874
|
const stackPatterns = stacks.length > 0 ? stacks : options.stack ? [options.stack] : [];
|
|
@@ -31124,7 +31126,9 @@ async function diffCommand(stacks, options) {
|
|
|
31124
31126
|
output: options.output,
|
|
31125
31127
|
...options.region && { region: options.region },
|
|
31126
31128
|
...options.profile && { profile: options.profile },
|
|
31127
|
-
...Object.keys(context).length > 0 && { context }
|
|
31129
|
+
...Object.keys(context).length > 0 && { context },
|
|
31130
|
+
stateBucket,
|
|
31131
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
31128
31132
|
});
|
|
31129
31133
|
logger.info(`Found ${allStacks.length} stack(s) in assembly`);
|
|
31130
31134
|
const stackPatterns = stacks.length > 0 ? stacks : options.stack ? [options.stack] : [];
|
|
@@ -32477,7 +32481,9 @@ async function destroyCommand(stackArgs, options) {
|
|
|
32477
32481
|
appStacks = (await synthesizer.synthesize({
|
|
32478
32482
|
app: appCmd,
|
|
32479
32483
|
output: options.output || "cdk.out",
|
|
32480
|
-
...Object.keys(context).length > 0 && { context }
|
|
32484
|
+
...Object.keys(context).length > 0 && { context },
|
|
32485
|
+
stateBucket,
|
|
32486
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
32481
32487
|
})).stacks.map((s) => ({
|
|
32482
32488
|
stackName: s.stackName,
|
|
32483
32489
|
displayName: s.displayName,
|
|
@@ -33101,7 +33107,9 @@ async function orphanCommand(pathArgs, options) {
|
|
|
33101
33107
|
const resolved = resolveConstructPaths(pathArgs, (await synthesizer.synthesize({
|
|
33102
33108
|
app: appCmd,
|
|
33103
33109
|
output: options.output || "cdk.out",
|
|
33104
|
-
...Object.keys(context).length > 0 && { context }
|
|
33110
|
+
...Object.keys(context).length > 0 && { context },
|
|
33111
|
+
stateBucket,
|
|
33112
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
33105
33113
|
})).stacks);
|
|
33106
33114
|
const stackInfo = resolved.stack;
|
|
33107
33115
|
const orphanLogicalIds = resolved.logicalIds;
|
|
@@ -34775,143 +34783,6 @@ const STABLE_TERMINAL_STATUSES = new Set([
|
|
|
34775
34783
|
"IMPORT_ROLLBACK_COMPLETE"
|
|
34776
34784
|
]);
|
|
34777
34785
|
|
|
34778
|
-
//#endregion
|
|
34779
|
-
//#region src/cli/upload-cfn-template.ts
|
|
34780
|
-
/**
|
|
34781
|
-
* CloudFormation `TemplateBody` hard limit (51,200 bytes). Templates larger
|
|
34782
|
-
* than this cannot be submitted inline and must be uploaded to S3 and
|
|
34783
|
-
* referenced via `TemplateURL` instead — see {@link uploadCfnTemplate}.
|
|
34784
|
-
*/
|
|
34785
|
-
const CFN_TEMPLATE_BODY_LIMIT = 51200;
|
|
34786
|
-
/**
|
|
34787
|
-
* CloudFormation `TemplateURL` hard limit (1 MB / 1,048,576 bytes).
|
|
34788
|
-
* Templates larger than this are structurally unsubmittable through any
|
|
34789
|
-
* CloudFormation API — no S3 indirection helps. The caller surfaces a
|
|
34790
|
-
* pre-flight error pointing the user at template-splitting (nested stacks)
|
|
34791
|
-
* or shrinking inline asset payloads (`lambda.Code.fromAsset`).
|
|
34792
|
-
*/
|
|
34793
|
-
const CFN_TEMPLATE_URL_LIMIT = 1048576;
|
|
34794
|
-
/**
|
|
34795
|
-
* Shared S3 key prefix for transient CFn templates uploaded by `cdkd import
|
|
34796
|
-
* --migrate-from-cloudformation` and `cdkd export`. Kept distinct from
|
|
34797
|
-
* cdkd's `cdkd/` state prefix so `state list` / `state info` never conflate
|
|
34798
|
-
* transient migration artifacts with persisted stack state. The prefix is
|
|
34799
|
-
* intentionally human-grep-able — leftovers (if cleanup fails) point
|
|
34800
|
-
* straight at the offending stack name.
|
|
34801
|
-
*
|
|
34802
|
-
* Re-used by both commands so operator-facing audit trails (CloudTrail
|
|
34803
|
-
* records of the migrate-tmp uploads) stay consistent across the two
|
|
34804
|
-
* flows.
|
|
34805
|
-
*/
|
|
34806
|
-
const MIGRATE_TMP_PREFIX = "cdkd-migrate-tmp";
|
|
34807
|
-
/**
|
|
34808
|
-
* Upload a CFn template body to the cdkd state bucket and return both a
|
|
34809
|
-
* virtual-hosted-style HTTPS URL CloudFormation can fetch via
|
|
34810
|
-
* `TemplateURL` and a `cleanup` callback that deletes the object (and
|
|
34811
|
-
* destroys the S3 client).
|
|
34812
|
-
*
|
|
34813
|
-
* The state bucket's actual region is resolved via `GetBucketLocation`
|
|
34814
|
-
* (cached per-process) so the upload client and the URL match the
|
|
34815
|
-
* bucket's region — the calling CLI's profile region is irrelevant here.
|
|
34816
|
-
*
|
|
34817
|
-
* Cleanup is the caller's responsibility: invoke `cleanup` in a `finally`
|
|
34818
|
-
* around the CFn call. CloudFormation copies the template into its own
|
|
34819
|
-
* internal storage during the synchronous `CreateChangeSet` /
|
|
34820
|
-
* `UpdateStack` API call, so the S3 object is no longer needed after that
|
|
34821
|
-
* call returns (success or failure).
|
|
34822
|
-
*
|
|
34823
|
-
* Shared between `cdkd import --migrate-from-cloudformation` (via
|
|
34824
|
-
* `retire-cfn-stack.ts`) and `cdkd export` (via `commands/export.ts`) so
|
|
34825
|
-
* the upload + cleanup contract is single-sourced.
|
|
34826
|
-
*/
|
|
34827
|
-
async function uploadCfnTemplate(args) {
|
|
34828
|
-
const { bucket, body, stackName, format, s3ClientOpts } = args;
|
|
34829
|
-
const region = await resolveBucketRegion(bucket, {
|
|
34830
|
-
...s3ClientOpts?.profile && { profile: s3ClientOpts.profile },
|
|
34831
|
-
...s3ClientOpts?.credentials && { credentials: s3ClientOpts.credentials }
|
|
34832
|
-
});
|
|
34833
|
-
const s3 = new S3Client({
|
|
34834
|
-
region,
|
|
34835
|
-
...s3ClientOpts?.profile && { profile: s3ClientOpts.profile },
|
|
34836
|
-
...s3ClientOpts?.credentials && { credentials: s3ClientOpts.credentials }
|
|
34837
|
-
});
|
|
34838
|
-
const ext = format === "yaml" ? "yaml" : "json";
|
|
34839
|
-
const contentType = format === "yaml" ? "application/x-yaml" : "application/json";
|
|
34840
|
-
const key = `${MIGRATE_TMP_PREFIX}/${stackName}/${Date.now()}.${ext}`;
|
|
34841
|
-
try {
|
|
34842
|
-
await s3.send(new PutObjectCommand({
|
|
34843
|
-
Bucket: bucket,
|
|
34844
|
-
Key: key,
|
|
34845
|
-
Body: body,
|
|
34846
|
-
ContentType: contentType
|
|
34847
|
-
}));
|
|
34848
|
-
} catch (err) {
|
|
34849
|
-
s3.destroy();
|
|
34850
|
-
throw err;
|
|
34851
|
-
}
|
|
34852
|
-
const url = `https://${bucket}.s3.${region}.amazonaws.com/${key}`;
|
|
34853
|
-
const cleanup = async () => {
|
|
34854
|
-
try {
|
|
34855
|
-
await s3.send(new DeleteObjectCommand({
|
|
34856
|
-
Bucket: bucket,
|
|
34857
|
-
Key: key
|
|
34858
|
-
}));
|
|
34859
|
-
} finally {
|
|
34860
|
-
s3.destroy();
|
|
34861
|
-
}
|
|
34862
|
-
};
|
|
34863
|
-
return {
|
|
34864
|
-
url,
|
|
34865
|
-
cleanup
|
|
34866
|
-
};
|
|
34867
|
-
}
|
|
34868
|
-
/**
|
|
34869
|
-
* Threshold (in bytes) above which a single resource's serialized
|
|
34870
|
-
* `Properties` block is considered an "inline payload" worth surfacing as
|
|
34871
|
-
* a contributor to a template that exceeds the 1 MB CFn `TemplateURL`
|
|
34872
|
-
* ceiling. 4 KB matches the typical inline `Code.ZipFile` Lambda payload
|
|
34873
|
-
* that pushes a multi-resource CDK app over the wire-format limit.
|
|
34874
|
-
*/
|
|
34875
|
-
const LARGE_INLINE_RESOURCE_THRESHOLD = 4096;
|
|
34876
|
-
/**
|
|
34877
|
-
* Walk a CFn template and surface every resource whose serialized
|
|
34878
|
-
* `Properties` block exceeds {@link LARGE_INLINE_RESOURCE_THRESHOLD}.
|
|
34879
|
-
* Used to build the actionable "offending resources" list in the
|
|
34880
|
-
* pre-flight error when a template exceeds the 1 MB `TemplateURL`
|
|
34881
|
-
* ceiling — typical culprits are inline `Code.ZipFile` Lambdas, inline
|
|
34882
|
-
* StepFunctions definitions, or large `AWS::CloudFormation::Stack`
|
|
34883
|
-
* bodies.
|
|
34884
|
-
*
|
|
34885
|
-
* Returns entries sorted by `approxBytes` descending so the user sees
|
|
34886
|
-
* the biggest contributor first. A non-CFn-template input (no
|
|
34887
|
-
* `Resources` object) returns an empty array.
|
|
34888
|
-
*/
|
|
34889
|
-
function findLargeInlineResources(template, threshold = LARGE_INLINE_RESOURCE_THRESHOLD) {
|
|
34890
|
-
const result = [];
|
|
34891
|
-
const resources = template["Resources"];
|
|
34892
|
-
if (!resources || typeof resources !== "object" || Array.isArray(resources)) return result;
|
|
34893
|
-
for (const [logicalId, resource] of Object.entries(resources)) {
|
|
34894
|
-
if (!resource || typeof resource !== "object" || Array.isArray(resource)) continue;
|
|
34895
|
-
const r = resource;
|
|
34896
|
-
const resourceType = typeof r["Type"] === "string" ? r["Type"] : "<unknown>";
|
|
34897
|
-
const properties = r["Properties"];
|
|
34898
|
-
if (properties === void 0 || properties === null) continue;
|
|
34899
|
-
let approxBytes;
|
|
34900
|
-
try {
|
|
34901
|
-
approxBytes = JSON.stringify(properties).length;
|
|
34902
|
-
} catch {
|
|
34903
|
-
continue;
|
|
34904
|
-
}
|
|
34905
|
-
if (approxBytes >= threshold) result.push({
|
|
34906
|
-
logicalId,
|
|
34907
|
-
resourceType,
|
|
34908
|
-
approxBytes
|
|
34909
|
-
});
|
|
34910
|
-
}
|
|
34911
|
-
result.sort((a, b) => b.approxBytes - a.approxBytes);
|
|
34912
|
-
return result;
|
|
34913
|
-
}
|
|
34914
|
-
|
|
34915
34786
|
//#endregion
|
|
34916
34787
|
//#region src/cli/yaml-cfn.ts
|
|
34917
34788
|
/**
|
|
@@ -35498,7 +35369,9 @@ async function importCommand(stackArg, options) {
|
|
|
35498
35369
|
const result = await synthesizer.synthesize({
|
|
35499
35370
|
app: appCmd,
|
|
35500
35371
|
output: options.output || "cdk.out",
|
|
35501
|
-
...Object.keys(context).length > 0 && { context }
|
|
35372
|
+
...Object.keys(context).length > 0 && { context },
|
|
35373
|
+
stateBucket,
|
|
35374
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
35502
35375
|
});
|
|
35503
35376
|
let stackInfo;
|
|
35504
35377
|
if (stackArg) {
|
|
@@ -42012,29 +41885,50 @@ function selectIntegrationResponse(entries, matchTarget, fallbackStatusCode = 20
|
|
|
42012
41885
|
try {
|
|
42013
41886
|
if (new RegExp(`^${entry.SelectionPattern}$`).test(matchTarget)) return {
|
|
42014
41887
|
entry,
|
|
42015
|
-
statusCode: parseStatus
|
|
41888
|
+
statusCode: parseStatus(entry.StatusCode, fallbackStatusCode)
|
|
42016
41889
|
};
|
|
42017
41890
|
} catch {}
|
|
42018
41891
|
}
|
|
42019
41892
|
const entry = defaultEntry ?? null;
|
|
42020
41893
|
return {
|
|
42021
41894
|
entry,
|
|
42022
|
-
statusCode: entry !== null ? parseStatus
|
|
41895
|
+
statusCode: entry !== null ? parseStatus(entry.StatusCode, fallbackStatusCode) : fallbackStatusCode
|
|
42023
41896
|
};
|
|
42024
41897
|
}
|
|
42025
|
-
|
|
41898
|
+
/**
|
|
41899
|
+
* Parse an `IntegrationResponse.StatusCode` value into an HTTP status
|
|
41900
|
+
* code, returning `undefined` when the value is malformed or outside
|
|
41901
|
+
* the valid `[100, 600)` range.
|
|
41902
|
+
*
|
|
41903
|
+
* Issue (#507) items 6 + 7 + PR #515 item 4: this is the single source
|
|
41904
|
+
* of truth for "is `raw` a usable HTTP status code?" — `parseStatus`
|
|
41905
|
+
* in `rest-v1-integrations.ts` and this module's `parseStatus(raw, fallback)`
|
|
41906
|
+
* both delegate here so future shape-tightening (e.g. accepting `0x10`
|
|
41907
|
+
* the way `Number("0x10") === 16` does) lands in one place.
|
|
41908
|
+
*
|
|
41909
|
+
* Validation rules:
|
|
41910
|
+
* - non-string non-number → undefined
|
|
41911
|
+
* - empty / whitespace-only string → undefined
|
|
41912
|
+
* - NaN / non-integer → undefined
|
|
41913
|
+
* - integer outside `[100, 600)` (HTTP valid range) → undefined
|
|
41914
|
+
* - hex literal `"0x10"` → Number coerces to 16 but below 100 → undefined
|
|
41915
|
+
*/
|
|
41916
|
+
function tryParseStatus(raw) {
|
|
42026
41917
|
if (typeof raw === "number") {
|
|
42027
41918
|
if (Number.isInteger(raw) && raw >= 100 && raw < 600) return raw;
|
|
42028
|
-
return
|
|
41919
|
+
return;
|
|
42029
41920
|
}
|
|
42030
|
-
if (typeof raw !== "string") return
|
|
41921
|
+
if (typeof raw !== "string") return void 0;
|
|
42031
41922
|
const trimmed = raw.trim();
|
|
42032
|
-
if (trimmed === "") return
|
|
41923
|
+
if (trimmed === "") return void 0;
|
|
42033
41924
|
const parsed = Number(trimmed);
|
|
42034
|
-
if (!Number.isInteger(parsed)) return
|
|
42035
|
-
if (parsed < 100 || parsed >= 600) return
|
|
41925
|
+
if (!Number.isInteger(parsed)) return void 0;
|
|
41926
|
+
if (parsed < 100 || parsed >= 600) return void 0;
|
|
42036
41927
|
return parsed;
|
|
42037
41928
|
}
|
|
41929
|
+
function parseStatus(raw, fallback) {
|
|
41930
|
+
return tryParseStatus(raw) ?? fallback;
|
|
41931
|
+
}
|
|
42038
41932
|
/**
|
|
42039
41933
|
* Evaluate `IntegrationResponse.ResponseParameters` — header literals
|
|
42040
41934
|
* mapped onto the HTTP response. Returns `{name: value}` for every entry
|
|
@@ -42140,7 +42034,7 @@ function dispatchMockIntegration(config, req) {
|
|
|
42140
42034
|
return vtlFailure("request", err, config.requestTemplate);
|
|
42141
42035
|
}
|
|
42142
42036
|
let entry = null;
|
|
42143
|
-
if (pickedStatus !== void 0) entry = config.responses.find((e) =>
|
|
42037
|
+
if (pickedStatus !== void 0) entry = config.responses.find((e) => tryParseStatus(e.StatusCode) === pickedStatus) ?? defaultResponseEntry(config.responses);
|
|
42144
42038
|
else entry = defaultResponseEntry(config.responses);
|
|
42145
42039
|
if (!entry) return {
|
|
42146
42040
|
statusCode: pickedStatus ?? 200,
|
|
@@ -42164,7 +42058,7 @@ function dispatchMockIntegration(config, req) {
|
|
|
42164
42058
|
Object.assign(headers, evaluateResponseParameters(entry.ResponseParameters, { onUnsupported: (_k, _v, reason) => logger.warn(`MOCK response: ${reason}`) }));
|
|
42165
42059
|
if (body === "" && headers["content-type"] === contentType) delete headers["content-type"];
|
|
42166
42060
|
return {
|
|
42167
|
-
statusCode:
|
|
42061
|
+
statusCode: tryParseStatus(entry.StatusCode) ?? 200,
|
|
42168
42062
|
headers,
|
|
42169
42063
|
body
|
|
42170
42064
|
};
|
|
@@ -42469,19 +42363,6 @@ function extractStatusCodeFromRendered(rendered) {
|
|
|
42469
42363
|
function defaultResponseEntry(entries) {
|
|
42470
42364
|
return entries.find((e) => e.SelectionPattern === void 0 || e.SelectionPattern === "") ?? null;
|
|
42471
42365
|
}
|
|
42472
|
-
function parseStatus(raw) {
|
|
42473
|
-
if (typeof raw === "number") {
|
|
42474
|
-
if (Number.isInteger(raw) && raw >= 100 && raw < 600) return raw;
|
|
42475
|
-
return;
|
|
42476
|
-
}
|
|
42477
|
-
if (typeof raw !== "string") return void 0;
|
|
42478
|
-
const trimmed = raw.trim();
|
|
42479
|
-
if (trimmed === "") return void 0;
|
|
42480
|
-
const n = Number(trimmed);
|
|
42481
|
-
if (!Number.isInteger(n)) return void 0;
|
|
42482
|
-
if (n < 100 || n >= 600) return void 0;
|
|
42483
|
-
return n;
|
|
42484
|
-
}
|
|
42485
42366
|
/**
|
|
42486
42367
|
* Heuristic: is the given HTTP `Content-Type` header value likely to
|
|
42487
42368
|
* carry text content that VTL ResponseTemplates can safely render
|
|
@@ -43789,6 +43670,38 @@ function matchHeaderList(headerList, allowed) {
|
|
|
43789
43670
|
return true;
|
|
43790
43671
|
}
|
|
43791
43672
|
|
|
43673
|
+
//#endregion
|
|
43674
|
+
//#region src/local/authorizer-context.ts
|
|
43675
|
+
/**
|
|
43676
|
+
* Build the per-kind context shape for the authorizer pipeline. Returns
|
|
43677
|
+
* an empty object only when nothing in the result is surfaceable (e.g.
|
|
43678
|
+
* a Lambda authorizer with no `principalId` and no `context`); callers
|
|
43679
|
+
* decide whether to skip surfacing in that case.
|
|
43680
|
+
*
|
|
43681
|
+
* For Lambda kinds: callers may need to wrap the returned shape in a
|
|
43682
|
+
* `lambda` namespace for HTTP API v2 (`{ lambda: shape }`); the wrap
|
|
43683
|
+
* is consumer-specific so it's NOT done here. The shape returned is
|
|
43684
|
+
* the always-flat REST v1 form.
|
|
43685
|
+
*/
|
|
43686
|
+
function buildAuthorizerContextShape(authorizer, result) {
|
|
43687
|
+
if (authorizer.kind === "lambda-token" || authorizer.kind === "lambda-request") {
|
|
43688
|
+
const ctx = {};
|
|
43689
|
+
if (result.principalId !== void 0) ctx["principalId"] = result.principalId;
|
|
43690
|
+
if (result.context) Object.assign(ctx, result.context);
|
|
43691
|
+
return ctx;
|
|
43692
|
+
}
|
|
43693
|
+
if (authorizer.kind === "iam") {
|
|
43694
|
+
const ctx = {};
|
|
43695
|
+
if (result.principalId !== void 0) ctx["principalId"] = result.principalId;
|
|
43696
|
+
return ctx;
|
|
43697
|
+
}
|
|
43698
|
+
if (authorizer.kind === "cognito") return { claims: { ...result.context ?? {} } };
|
|
43699
|
+
return { jwt: {
|
|
43700
|
+
claims: { ...result.context ?? {} },
|
|
43701
|
+
scopes: []
|
|
43702
|
+
} };
|
|
43703
|
+
}
|
|
43704
|
+
|
|
43792
43705
|
//#endregion
|
|
43793
43706
|
//#region src/local/authorizer-resolver.ts
|
|
43794
43707
|
/**
|
|
@@ -46300,22 +46213,7 @@ function buildServiceIntegrationContextVars(req, route) {
|
|
|
46300
46213
|
*/
|
|
46301
46214
|
function buildAuthorizerContextForServiceIntegration(authorizer, result) {
|
|
46302
46215
|
if (!authorizer || !result) return void 0;
|
|
46303
|
-
|
|
46304
|
-
const ctx = {};
|
|
46305
|
-
if (result.principalId !== void 0) ctx["principalId"] = result.principalId;
|
|
46306
|
-
if (result.context) Object.assign(ctx, result.context);
|
|
46307
|
-
return ctx;
|
|
46308
|
-
}
|
|
46309
|
-
if (authorizer.kind === "iam") {
|
|
46310
|
-
const ctx = {};
|
|
46311
|
-
if (result.principalId !== void 0) ctx["principalId"] = result.principalId;
|
|
46312
|
-
return ctx;
|
|
46313
|
-
}
|
|
46314
|
-
if (authorizer.kind === "cognito") return { claims: { ...result.context ?? {} } };
|
|
46315
|
-
return { jwt: {
|
|
46316
|
-
claims: { ...result.context ?? {} },
|
|
46317
|
-
scopes: []
|
|
46318
|
-
} };
|
|
46216
|
+
return buildAuthorizerContextShape(authorizer, result);
|
|
46319
46217
|
}
|
|
46320
46218
|
/**
|
|
46321
46219
|
* Write the 501 Not Implemented response surfaced for routes the
|
|
@@ -46967,7 +46865,9 @@ async function localStartApiCommand(target, options) {
|
|
|
46967
46865
|
output: options.output,
|
|
46968
46866
|
...options.region && { region: options.region },
|
|
46969
46867
|
...options.profile && { profile: options.profile },
|
|
46970
|
-
...Object.keys(context).length > 0 && { context }
|
|
46868
|
+
...Object.keys(context).length > 0 && { context },
|
|
46869
|
+
...options.stateBucket && { stateBucket: options.stateBucket },
|
|
46870
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
46971
46871
|
};
|
|
46972
46872
|
const { stacks } = await synthesizer.synthesize(synthOpts);
|
|
46973
46873
|
const targetStacks = pickTargetStacks(stacks, options.stack);
|
|
@@ -48895,7 +48795,9 @@ async function localRunTaskCommand(target, options) {
|
|
|
48895
48795
|
output: options.output,
|
|
48896
48796
|
...options.region && { region: options.region },
|
|
48897
48797
|
...options.profile && { profile: options.profile },
|
|
48898
|
-
...Object.keys(context).length > 0 && { context }
|
|
48798
|
+
...Object.keys(context).length > 0 && { context },
|
|
48799
|
+
...options.stateBucket && { stateBucket: options.stateBucket },
|
|
48800
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
48899
48801
|
};
|
|
48900
48802
|
const { stacks } = await synthesizer.synthesize(synthOpts);
|
|
48901
48803
|
const imageContext = await buildEcsImageResolutionContext$1(target, stacks, options);
|
|
@@ -49528,8 +49430,10 @@ const defaultWaitForExitImpl = async (containerId) => {
|
|
|
49528
49430
|
* test-overridable function so unit tests do not need a real container.
|
|
49529
49431
|
*/
|
|
49530
49432
|
let waitForExitImpl = defaultWaitForExitImpl;
|
|
49433
|
+
const defaultSleepImpl = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
49434
|
+
let sleepImpl = defaultSleepImpl;
|
|
49531
49435
|
function sleep(ms) {
|
|
49532
|
-
return
|
|
49436
|
+
return sleepImpl(ms);
|
|
49533
49437
|
}
|
|
49534
49438
|
|
|
49535
49439
|
//#endregion
|
|
@@ -49574,7 +49478,9 @@ async function localStartServiceCommand(target, options) {
|
|
|
49574
49478
|
output: options.output,
|
|
49575
49479
|
...options.region && { region: options.region },
|
|
49576
49480
|
...options.profile && { profile: options.profile },
|
|
49577
|
-
...Object.keys(context).length > 0 && { context }
|
|
49481
|
+
...Object.keys(context).length > 0 && { context },
|
|
49482
|
+
...options.stateBucket && { stateBucket: options.stateBucket },
|
|
49483
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
49578
49484
|
};
|
|
49579
49485
|
const { stacks } = await synthesizer.synthesize(synthOpts);
|
|
49580
49486
|
const imageContext = await buildEcsImageResolutionContext(target, stacks, options);
|
|
@@ -49895,7 +49801,9 @@ async function localInvokeCommand(target, options) {
|
|
|
49895
49801
|
output: options.output,
|
|
49896
49802
|
...options.region && { region: options.region },
|
|
49897
49803
|
...options.profile && { profile: options.profile },
|
|
49898
|
-
...Object.keys(context).length > 0 && { context }
|
|
49804
|
+
...Object.keys(context).length > 0 && { context },
|
|
49805
|
+
...options.stateBucket && { stateBucket: options.stateBucket },
|
|
49806
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
49899
49807
|
};
|
|
49900
49808
|
const { stacks } = await synthesizer.synthesize(synthOpts);
|
|
49901
49809
|
const lambda = resolveLambdaTarget(target, stacks);
|
|
@@ -50803,7 +50711,9 @@ async function exportCommand(stackArg, options) {
|
|
|
50803
50711
|
const result = await synthesizer.synthesize({
|
|
50804
50712
|
app: appCmd,
|
|
50805
50713
|
output: options.output || "cdk.out",
|
|
50806
|
-
...Object.keys(context).length > 0 && { context }
|
|
50714
|
+
...Object.keys(context).length > 0 && { context },
|
|
50715
|
+
stateBucket,
|
|
50716
|
+
...options.profile && { macroExpandS3ClientOpts: { profile: options.profile } }
|
|
50807
50717
|
});
|
|
50808
50718
|
let stackInfo;
|
|
50809
50719
|
if (stackArg) {
|
|
@@ -52972,7 +52882,7 @@ function reorderArgs(argv) {
|
|
|
52972
52882
|
*/
|
|
52973
52883
|
async function main() {
|
|
52974
52884
|
const program = new Command();
|
|
52975
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
52885
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.136.0");
|
|
52976
52886
|
program.addCommand(createBootstrapCommand());
|
|
52977
52887
|
program.addCommand(createSynthCommand());
|
|
52978
52888
|
program.addCommand(createListCommand());
|