cdk-local 0.11.1 → 0.11.2
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/README.md +17 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/{local-start-service-COPEJIi1.js → local-start-service-ChWqG2xl.js} +72 -7
- package/dist/local-start-service-ChWqG2xl.js.map +1 -0
- package/package.json +1 -1
- package/dist/local-start-service-COPEJIi1.js.map +0 -1
package/README.md
CHANGED
|
@@ -66,6 +66,23 @@ cdkl invoke MyStack/MyFunction --event ./event.json
|
|
|
66
66
|
|
|
67
67
|

|
|
68
68
|
|
|
69
|
+
Every target argument (across `invoke`, `run-task`, `start-service`) accepts
|
|
70
|
+
either form — the CDK display path is the recommended default, but a
|
|
71
|
+
CloudFormation logical ID works too, which is handy when copying it straight
|
|
72
|
+
out of `cdk.out/<Stack>.template.json` beats tracing the construct path (and
|
|
73
|
+
matches what a SAM background expects):
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# CDK display path (recommended)
|
|
77
|
+
cdkl invoke MyStack/MyFunction --event ./event.json
|
|
78
|
+
|
|
79
|
+
# Stack-qualified logical ID (works in any app)
|
|
80
|
+
cdkl invoke MyStack:MyFunction1234ABCD --event ./event.json
|
|
81
|
+
|
|
82
|
+
# Bare logical ID (single-stack apps — the stack is auto-detected)
|
|
83
|
+
cdkl invoke MyFunction1234ABCD --event ./event.json
|
|
84
|
+
```
|
|
85
|
+
|
|
69
86
|
#### HTTP APIs & Function URLs — `start-api`
|
|
70
87
|
|
|
71
88
|
Serve your app's HTTP surface locally — API Gateway routes (REST v1 / HTTP v2 / WebSocket) and Lambda Function URLs — on a local HTTP server.
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as createLocalStartApiCommand, r as createLocalRunTaskCommand, t as createLocalStartServiceCommand, v as createLocalInvokeCommand } from "./local-start-service-
|
|
2
|
+
import { i as createLocalStartApiCommand, r as createLocalRunTaskCommand, t as createLocalStartServiceCommand, v as createLocalInvokeCommand } from "./local-start-service-ChWqG2xl.js";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
|
|
5
5
|
//#region src/cli/index.ts
|
|
6
6
|
const program = new Command();
|
|
7
|
-
program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.11.
|
|
7
|
+
program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.11.2");
|
|
8
8
|
program.addCommand(createLocalInvokeCommand());
|
|
9
9
|
program.addCommand(createLocalStartApiCommand());
|
|
10
10
|
program.addCommand(createLocalRunTaskCommand());
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ type ExtraStateProviders = Record<string, LocalStateProviderFactory>;
|
|
|
60
60
|
declare function resolveCfnStackName(fromCfnStack: string | boolean, stackName: string): string;
|
|
61
61
|
declare function isCfnFlagPresent(opts: Pick<LocalStateSourceOptions, 'fromCfnStack'>): boolean;
|
|
62
62
|
declare function resolveCfnRegion(options: Pick<LocalStateSourceOptions, 'stackRegion' | 'region'>, synthRegion: string | undefined): string;
|
|
63
|
+
declare function resolveCfnFallbackRegion(options: Pick<LocalStateSourceOptions, 'fromCfnStack' | 'profile'>, synthRegion: string | undefined): Promise<string | undefined>;
|
|
63
64
|
declare class LocalStateSourceError extends Error {
|
|
64
65
|
constructor(message: string);
|
|
65
66
|
}
|
|
@@ -368,5 +369,5 @@ declare function discoverWebSocketApis(stacks: readonly StackInfo[]): {
|
|
|
368
369
|
declare function discoverWebSocketApisOrThrow(stacks: readonly StackInfo[]): DiscoveredWebSocketApi[];
|
|
369
370
|
declare function parseSelectionExpressionPath(expr: string): string[];
|
|
370
371
|
//#endregion
|
|
371
|
-
export { type AuthorizerEventOverlay, type CdkLocalEmbedConfig, CfnLocalStateProvider, type CfnLocalStateProviderOptions, type CreateLocalInvokeCommandOptions, type CreateLocalRunTaskCommandOptions, type CreateLocalStartApiCommandOptions, type CreateLocalStartServiceCommandOptions, type CrossStackResolver, type DiscoveredRoute, type DiscoveredWebSocketApi, type ExtraStateProviders, type HttpRequestSnapshot, type LambdaArnResolveOutcome, type LocalStateProvider, type LocalStateProviderFactory, type LocalStateRecord, LocalStateSourceError, type LocalStateSourceOptions, type MatchedRouteContext, type RequestParameterContext, type ResolveParametersOutcome, type RestV1IntegrationConfig, type RouteMatchResult, type SubstitutionContext, type TranslatedHttpResponse, type WebSocketRouteEntry, applyAuthorizerOverlay, buildHttpApiV2Event, buildRestV1Event, createLocalInvokeCommand, createLocalRunTaskCommand, createLocalStartApiCommand, createLocalStartServiceCommand, createLocalStateProvider, discoverRoutes, discoverWebSocketApis, discoverWebSocketApisOrThrow, getContainerNetworkIp, isCfnFlagPresent, matchRoute, parseSelectionExpressionPath, pickRefLogicalId, rejectExplicitCfnStackWithMultipleStacks, resolveCfnRegion, resolveCfnStackName, resolveLambdaArnIntrinsic, resolveSelectionExpression, resolveServiceIntegrationParameters, translateLambdaResponse };
|
|
372
|
+
export { type AuthorizerEventOverlay, type CdkLocalEmbedConfig, CfnLocalStateProvider, type CfnLocalStateProviderOptions, type CreateLocalInvokeCommandOptions, type CreateLocalRunTaskCommandOptions, type CreateLocalStartApiCommandOptions, type CreateLocalStartServiceCommandOptions, type CrossStackResolver, type DiscoveredRoute, type DiscoveredWebSocketApi, type ExtraStateProviders, type HttpRequestSnapshot, type LambdaArnResolveOutcome, type LocalStateProvider, type LocalStateProviderFactory, type LocalStateRecord, LocalStateSourceError, type LocalStateSourceOptions, type MatchedRouteContext, type RequestParameterContext, type ResolveParametersOutcome, type RestV1IntegrationConfig, type RouteMatchResult, type SubstitutionContext, type TranslatedHttpResponse, type WebSocketRouteEntry, applyAuthorizerOverlay, buildHttpApiV2Event, buildRestV1Event, createLocalInvokeCommand, createLocalRunTaskCommand, createLocalStartApiCommand, createLocalStartServiceCommand, createLocalStateProvider, discoverRoutes, discoverWebSocketApis, discoverWebSocketApisOrThrow, getContainerNetworkIp, isCfnFlagPresent, matchRoute, parseSelectionExpressionPath, pickRefLogicalId, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, resolveCfnRegion, resolveCfnStackName, resolveLambdaArnIntrinsic, resolveSelectionExpression, resolveServiceIntegrationParameters, translateLambdaResponse };
|
|
372
373
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/state.ts","../src/local/state-resolver.ts","../src/local/local-state-provider.ts","../src/cli/commands/local-state-source.ts","../src/local/embed-config.ts","../src/types/resource.ts","../src/synthesis/assembly-reader.ts","../src/cli/commands/local-invoke.ts","../src/local/httpv2-service-integration.ts","../src/local/integration-response-selector.ts","../src/local/rest-v1-integrations.ts","../src/local/route-discovery.ts","../src/cli/commands/local-start-api.ts","../src/cli/commands/local-run-task.ts","../src/cli/commands/local-start-service.ts","../src/local/cfn-local-state-provider.ts","../src/local/intrinsic-utils.ts","../src/local/intrinsic-lambda-arn.ts","../src/local/parameter-mapping.ts","../src/local/api-gateway-response.ts","../src/local/docker-inspect.ts","../src/local/route-matcher.ts","../src/local/api-gateway-event.ts","../src/local/websocket-route-discovery.ts"],"mappings":";;;;UAuLiB,aAAA;EAEf,UAAA;EAGA,YAAA;EAGA,UAAA,EAAY,MAAA;EAcZ,kBAAA,GAAqB,MAAA;EAGrB,UAAA,GAAa,MAAA;EAGb,YAAA;EAGA,QAAA,GAAW,MAAA;EAmBX,cAAA;EAMA,mBAAA;EAyBA,aAAA;AAAA;;;UCxIe,gBAAA;EACf,SAAA;EACA,MAAA;EACA,SAAA;EACA,SAAA;AAAA;AAAA,UAqBe,kBAAA;EAOf,aAAA,CAAc,UAAA,WAAqB,OAAA;EAQnC,qBAAA,CACE,aAAA,UACA,cAAA,UACA,UAAA,WACC,OAAA;AAAA;AAAA,UAGY,mBAAA;EAEf,SAAA,EAAW,MAAA,SAAe,aAAA;EAE1B,gBAAA,GAAmB,gBAAA;EAOnB,kBAAA,GAAqB,kBAAA;EAOrB,cAAA;AAAA;;;UCrJe,gBAAA;EAWf,SAAA,EAAW,MAAA,SAAe,aAAA;EAO1B,OAAA,EAAS,MAAA;EAOT,MAAA;AAAA;AAAA,UAsBe,kBAAA;EAAA,SAMN,KAAA;EAQT,IAAA,CAAK,SAAA,UAAmB,WAAA,uBAAkC,OAAA,CAAQ,gBAAA;EAalE,uBAAA,CAAwB,cAAA,WAAyB,OAAA,CAAQ,kBAAA;EA4BzD,0BAAA,EACE,kBAAA,WACC,OAAA,CAAQ,MAAA;EAKX,OAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/state.ts","../src/local/state-resolver.ts","../src/local/local-state-provider.ts","../src/cli/commands/local-state-source.ts","../src/local/embed-config.ts","../src/types/resource.ts","../src/synthesis/assembly-reader.ts","../src/cli/commands/local-invoke.ts","../src/local/httpv2-service-integration.ts","../src/local/integration-response-selector.ts","../src/local/rest-v1-integrations.ts","../src/local/route-discovery.ts","../src/cli/commands/local-start-api.ts","../src/cli/commands/local-run-task.ts","../src/cli/commands/local-start-service.ts","../src/local/cfn-local-state-provider.ts","../src/local/intrinsic-utils.ts","../src/local/intrinsic-lambda-arn.ts","../src/local/parameter-mapping.ts","../src/local/api-gateway-response.ts","../src/local/docker-inspect.ts","../src/local/route-matcher.ts","../src/local/api-gateway-event.ts","../src/local/websocket-route-discovery.ts"],"mappings":";;;;UAuLiB,aAAA;EAEf,UAAA;EAGA,YAAA;EAGA,UAAA,EAAY,MAAA;EAcZ,kBAAA,GAAqB,MAAA;EAGrB,UAAA,GAAa,MAAA;EAGb,YAAA;EAGA,QAAA,GAAW,MAAA;EAmBX,cAAA;EAMA,mBAAA;EAyBA,aAAA;AAAA;;;UCxIe,gBAAA;EACf,SAAA;EACA,MAAA;EACA,SAAA;EACA,SA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A;EAQA,wBAAA;EAOA,KAAA;EAaA,MAAA,EAAQ,mBAAA;EAiBR,WAAA;IAAgB,MAAA;EAAA;AAAA;AAAA,UAID,mBAAA;EAEf,QAAA;EAEA,qBAAA;EAEA,eAAA;EAEA,UAAA;AAAA;AAAA,iBAuBc,qBAAA,CAAsB,MAAA,WAAiB,SAAA;EACrD,IAAA,EAAM,sBAAA;EACN,MAAA;AAAA;AAAA,iBA8Bc,4BAAA,CACd,MAAA,WAAiB,SAAA,KAChB,sBAAA;AAAA,iBAgJa,4BAAA,CAA6B,IAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as resolveCfnFallbackRegion, E as CfnLocalStateProvider, S as rejectExplicitCfnStackWithMultipleStacks, T as resolveCfnStackName, _ as resolveLambdaArnIntrinsic, a as resolveSelectionExpression, b as createLocalStateProvider, c as translateLambdaResponse, d as buildRestV1Event, f as discoverWebSocketApis, g as pickRefLogicalId, h as discoverRoutes, i as createLocalStartApiCommand, l as applyAuthorizerOverlay, m as parseSelectionExpressionPath, n as getContainerNetworkIp, o as resolveServiceIntegrationParameters, p as discoverWebSocketApisOrThrow, r as createLocalRunTaskCommand, s as matchRoute, t as createLocalStartServiceCommand, u as buildHttpApiV2Event, v as createLocalInvokeCommand, w as resolveCfnRegion, x as isCfnFlagPresent, y as LocalStateSourceError } from "./local-start-service-ChWqG2xl.js";
|
|
2
2
|
|
|
3
|
-
export { CfnLocalStateProvider, LocalStateSourceError, applyAuthorizerOverlay, buildHttpApiV2Event, buildRestV1Event, createLocalInvokeCommand, createLocalRunTaskCommand, createLocalStartApiCommand, createLocalStartServiceCommand, createLocalStateProvider, discoverRoutes, discoverWebSocketApis, discoverWebSocketApisOrThrow, getContainerNetworkIp, isCfnFlagPresent, matchRoute, parseSelectionExpressionPath, pickRefLogicalId, rejectExplicitCfnStackWithMultipleStacks, resolveCfnRegion, resolveCfnStackName, resolveLambdaArnIntrinsic, resolveSelectionExpression, resolveServiceIntegrationParameters, translateLambdaResponse };
|
|
3
|
+
export { CfnLocalStateProvider, LocalStateSourceError, applyAuthorizerOverlay, buildHttpApiV2Event, buildRestV1Event, createLocalInvokeCommand, createLocalRunTaskCommand, createLocalStartApiCommand, createLocalStartServiceCommand, createLocalStateProvider, discoverRoutes, discoverWebSocketApis, discoverWebSocketApisOrThrow, getContainerNetworkIp, isCfnFlagPresent, matchRoute, parseSelectionExpressionPath, pickRefLogicalId, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, resolveCfnRegion, resolveCfnStackName, resolveLambdaArnIntrinsic, resolveSelectionExpression, resolveServiceIntegrationParameters, translateLambdaResponse };
|
|
@@ -845,6 +845,45 @@ function formatAwsErrorForWarn(err) {
|
|
|
845
845
|
return `${prefixParts.join(" ")}: ${err.message}`;
|
|
846
846
|
}
|
|
847
847
|
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/utils/profile-region.ts
|
|
850
|
+
/**
|
|
851
|
+
* Resolve the AWS region the SDK would pick for a named profile (the
|
|
852
|
+
* profile's `region` in `~/.aws/config`, honoring the standard
|
|
853
|
+
* env / config chain) WITHOUT resolving credentials.
|
|
854
|
+
*
|
|
855
|
+
* cdk-local already passes `--profile` straight to the AWS SDK clients
|
|
856
|
+
* for CREDENTIALS, but the `--from-cfn-stack` region resolution
|
|
857
|
+
* (`resolveCfnRegion`) only consults `--stack-region` / `--region` /
|
|
858
|
+
* `AWS_REGION` / `AWS_DEFAULT_REGION` / the synth-derived stack region.
|
|
859
|
+
* A profile that carries a `region` (e.g. `region = ap-northeast-1`)
|
|
860
|
+
* was therefore ignored, so `cdkl ... --from-cfn-stack --profile <p>`
|
|
861
|
+
* against an env-agnostic stack failed with "requires a region to query
|
|
862
|
+
* CloudFormation" even though `aws cloudformation ... --profile <p>`
|
|
863
|
+
* would have used the profile's region.
|
|
864
|
+
*
|
|
865
|
+
* Uses the same SDK region provider as
|
|
866
|
+
* `resolveProfileCredentials` (an STS client's resolved `config.region`)
|
|
867
|
+
* so the fallback region matches what the CFn client itself would pick
|
|
868
|
+
* for the profile. Best-effort: returns `undefined` when no profile is
|
|
869
|
+
* given, or the region cannot be resolved (no profile region and no
|
|
870
|
+
* `AWS_REGION` / `AWS_DEFAULT_REGION` env) — the caller then falls
|
|
871
|
+
* through to its existing "no region" handling.
|
|
872
|
+
*/
|
|
873
|
+
async function resolveProfileRegion(profile) {
|
|
874
|
+
if (profile === void 0 || profile === "") return void 0;
|
|
875
|
+
const sts = new STSClient({ profile });
|
|
876
|
+
try {
|
|
877
|
+
const regionProvider = sts.config.region;
|
|
878
|
+
const resolved = typeof regionProvider === "function" ? await regionProvider() : regionProvider;
|
|
879
|
+
return typeof resolved === "string" && resolved.length > 0 ? resolved : void 0;
|
|
880
|
+
} catch {
|
|
881
|
+
return;
|
|
882
|
+
} finally {
|
|
883
|
+
sts.destroy();
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
848
887
|
//#endregion
|
|
849
888
|
//#region src/cli/commands/local-state-source.ts
|
|
850
889
|
/**
|
|
@@ -873,7 +912,8 @@ function formatAwsErrorForWarn(err) {
|
|
|
873
912
|
* the stack name from synthesis; an explicit value overrides.
|
|
874
913
|
* - Region resolution for the CFn client: precedence
|
|
875
914
|
* `--stack-region` > `--region` > `AWS_REGION` > `AWS_DEFAULT_REGION`
|
|
876
|
-
* > the synth-derived stack region
|
|
915
|
+
* > the synth-derived stack region > the `--profile`'s configured
|
|
916
|
+
* region (see {@link resolveCfnFallbackRegion}).
|
|
877
917
|
*
|
|
878
918
|
* Returns `undefined` when no state-source flag is set — the caller
|
|
879
919
|
* skips the substitution pass entirely.
|
|
@@ -919,6 +959,31 @@ function resolveCfnRegion(options, synthRegion) {
|
|
|
919
959
|
return region;
|
|
920
960
|
}
|
|
921
961
|
/**
|
|
962
|
+
* Compute the lowest-precedence region fallback for the CFn state
|
|
963
|
+
* provider and pass the result as the `synthRegion` argument to
|
|
964
|
+
* {@link createLocalStateProvider}. The synth-derived stack region wins
|
|
965
|
+
* when present; otherwise — and only when `--from-cfn-stack` is active —
|
|
966
|
+
* the `--profile`'s configured region is used so an env-agnostic stack
|
|
967
|
+
* (no `env.region`) is still queryable via `--profile <p>` alone, the
|
|
968
|
+
* same way `aws cloudformation ... --profile <p>` resolves region from
|
|
969
|
+
* the profile.
|
|
970
|
+
*
|
|
971
|
+
* {@link resolveCfnRegion}'s precedence (`--stack-region` > `--region` >
|
|
972
|
+
* `AWS_REGION` > `AWS_DEFAULT_REGION` > this fallback) is preserved: the
|
|
973
|
+
* profile region only matters when every higher-priority signal is
|
|
974
|
+
* absent.
|
|
975
|
+
*
|
|
976
|
+
* Async because reading the profile region touches the shared config
|
|
977
|
+
* files; the public sync `resolveCfnRegion` / `createLocalStateProvider`
|
|
978
|
+
* signatures are intentionally left unchanged so embedding hosts are not
|
|
979
|
+
* forced to adopt an async region resolver.
|
|
980
|
+
*/
|
|
981
|
+
async function resolveCfnFallbackRegion(options, synthRegion) {
|
|
982
|
+
if (synthRegion !== void 0) return synthRegion;
|
|
983
|
+
if (!isCfnFlagPresent(options)) return void 0;
|
|
984
|
+
return resolveProfileRegion(options.profile);
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
922
987
|
* Common error class for the mutual-exclusion check so the CLI layer
|
|
923
988
|
* can surface a consistent error message from every command.
|
|
924
989
|
*/
|
|
@@ -5225,7 +5290,7 @@ async function localInvokeCommand(target, options, extraStateProviders) {
|
|
|
5225
5290
|
let stateAudit;
|
|
5226
5291
|
let templateEnv = getTemplateEnv$1(lambda.resource);
|
|
5227
5292
|
let stateForRoleHint;
|
|
5228
|
-
const stateProvider = createLocalStateProvider(options, lambda.stack.stackName, lambda.stack.region, extraStateProviders);
|
|
5293
|
+
const stateProvider = createLocalStateProvider(options, lambda.stack.stackName, await resolveCfnFallbackRegion(options, lambda.stack.region), extraStateProviders);
|
|
5229
5294
|
if (stateProvider) try {
|
|
5230
5295
|
const loaded = await stateProvider.load(lambda.stack.stackName, lambda.stack.region);
|
|
5231
5296
|
if (loaded) {
|
|
@@ -15781,7 +15846,7 @@ async function loadStateForRoutedStacks(stacks, routes, routesWithAuth, options,
|
|
|
15781
15846
|
for (const stackName of reachableStackNames) {
|
|
15782
15847
|
const stack = stacks.find((s) => s.stackName === stackName);
|
|
15783
15848
|
if (!stack) continue;
|
|
15784
|
-
const provider = createLocalStateProvider(options, stack.stackName, stack.region, extraStateProviders);
|
|
15849
|
+
const provider = createLocalStateProvider(options, stack.stackName, await resolveCfnFallbackRegion(options, stack.region), extraStateProviders);
|
|
15785
15850
|
if (!provider) continue;
|
|
15786
15851
|
try {
|
|
15787
15852
|
const loaded = await provider.load(stack.stackName, stack.region);
|
|
@@ -16838,7 +16903,7 @@ async function localRunTaskCommand(target, options, extraStateProviders) {
|
|
|
16838
16903
|
};
|
|
16839
16904
|
const { stacks } = await synthesizer.synthesize(synthOpts);
|
|
16840
16905
|
const candidate = pickCandidateStack$1(parseEcsTarget(target).stackPattern, stacks);
|
|
16841
|
-
stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", candidate?.region, extraStateProviders);
|
|
16906
|
+
stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders);
|
|
16842
16907
|
const imageContext = await buildEcsImageResolutionContext$1(candidate, stateProvider, options);
|
|
16843
16908
|
const task = resolveEcsTaskTarget(target, stacks, imageContext);
|
|
16844
16909
|
logger.info(`Target: ${task.stack.stackName}/${task.taskDefinitionLogicalId} (family=${task.family}, containers=${task.containers.length})`);
|
|
@@ -18228,7 +18293,7 @@ async function localStartServiceCommand(targets, options, extraStateProviders) {
|
|
|
18228
18293
|
*/
|
|
18229
18294
|
async function bootOneTarget(target, runState, stacks, options, discovery, skipPull, extraStateProviders, profileCredsFile) {
|
|
18230
18295
|
const candidate = pickCandidateStack(parseEcsTarget(target).stackPattern, stacks);
|
|
18231
|
-
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", candidate?.region, extraStateProviders);
|
|
18296
|
+
const stateProvider = createLocalStateProvider(options, candidate?.stackName ?? "", await resolveCfnFallbackRegion(options, candidate?.region), extraStateProviders);
|
|
18232
18297
|
try {
|
|
18233
18298
|
return await runOneTarget(target, runState, stacks, options, discovery, skipPull, stateProvider, profileCredsFile);
|
|
18234
18299
|
} finally {
|
|
@@ -18458,5 +18523,5 @@ function createLocalStartServiceCommand(opts = {}) {
|
|
|
18458
18523
|
}
|
|
18459
18524
|
|
|
18460
18525
|
//#endregion
|
|
18461
|
-
export {
|
|
18462
|
-
//# sourceMappingURL=local-start-service-
|
|
18526
|
+
export { resolveCfnFallbackRegion as C, CfnLocalStateProvider as E, rejectExplicitCfnStackWithMultipleStacks as S, resolveCfnStackName as T, resolveLambdaArnIntrinsic as _, resolveSelectionExpression as a, createLocalStateProvider as b, translateLambdaResponse as c, buildRestV1Event as d, discoverWebSocketApis as f, pickRefLogicalId as g, discoverRoutes as h, createLocalStartApiCommand as i, applyAuthorizerOverlay as l, parseSelectionExpressionPath as m, getContainerNetworkIp as n, resolveServiceIntegrationParameters as o, discoverWebSocketApisOrThrow as p, createLocalRunTaskCommand as r, matchRoute as s, createLocalStartServiceCommand as t, buildHttpApiV2Event as u, createLocalInvokeCommand as v, resolveCfnRegion as w, isCfnFlagPresent as x, LocalStateSourceError as y };
|
|
18527
|
+
//# sourceMappingURL=local-start-service-ChWqG2xl.js.map
|