@go-to-k/cdkd 0.66.0 → 0.68.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/README.md +46 -3
- package/dist/cli.js +988 -274
- package/dist/cli.js.map +4 -4
- package/dist/go-to-k-cdkd-0.68.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.66.0.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -708,10 +708,10 @@ var require_GraphQLError = __commonJS({
|
|
|
708
708
|
*/
|
|
709
709
|
constructor(message, ...rawArgs) {
|
|
710
710
|
var _this$nodes, _nodeLocations$, _ref;
|
|
711
|
-
const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs);
|
|
711
|
+
const { nodes, source, positions, path: path2, originalError, extensions } = toNormalizedOptions(rawArgs);
|
|
712
712
|
super(message);
|
|
713
713
|
this.name = "GraphQLError";
|
|
714
|
-
this.path =
|
|
714
|
+
this.path = path2 !== null && path2 !== void 0 ? path2 : void 0;
|
|
715
715
|
this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0;
|
|
716
716
|
this.nodes = undefinedIfEmpty(
|
|
717
717
|
Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0
|
|
@@ -4173,14 +4173,14 @@ var require_visitor = __commonJS({
|
|
|
4173
4173
|
let node = root;
|
|
4174
4174
|
let key = void 0;
|
|
4175
4175
|
let parent = void 0;
|
|
4176
|
-
const
|
|
4176
|
+
const path2 = [];
|
|
4177
4177
|
const ancestors = [];
|
|
4178
4178
|
do {
|
|
4179
4179
|
index++;
|
|
4180
4180
|
const isLeaving = index === keys.length;
|
|
4181
4181
|
const isEdited = isLeaving && edits.length !== 0;
|
|
4182
4182
|
if (isLeaving) {
|
|
4183
|
-
key = ancestors.length === 0 ? void 0 :
|
|
4183
|
+
key = ancestors.length === 0 ? void 0 : path2[path2.length - 1];
|
|
4184
4184
|
node = parent;
|
|
4185
4185
|
parent = ancestors.pop();
|
|
4186
4186
|
if (isEdited) {
|
|
@@ -4214,7 +4214,7 @@ var require_visitor = __commonJS({
|
|
|
4214
4214
|
if (node === null || node === void 0) {
|
|
4215
4215
|
continue;
|
|
4216
4216
|
}
|
|
4217
|
-
|
|
4217
|
+
path2.push(key);
|
|
4218
4218
|
}
|
|
4219
4219
|
let result;
|
|
4220
4220
|
if (!Array.isArray(node)) {
|
|
@@ -4224,13 +4224,13 @@ var require_visitor = __commonJS({
|
|
|
4224
4224
|
`Invalid AST Node: ${(0, _inspect.inspect)(node)}.`
|
|
4225
4225
|
);
|
|
4226
4226
|
const visitFn = isLeaving ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get === void 0 ? void 0 : _enterLeaveMap$get.leave : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get2 === void 0 ? void 0 : _enterLeaveMap$get2.enter;
|
|
4227
|
-
result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent,
|
|
4227
|
+
result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path2, ancestors);
|
|
4228
4228
|
if (result === BREAK) {
|
|
4229
4229
|
break;
|
|
4230
4230
|
}
|
|
4231
4231
|
if (result === false) {
|
|
4232
4232
|
if (!isLeaving) {
|
|
4233
|
-
|
|
4233
|
+
path2.pop();
|
|
4234
4234
|
continue;
|
|
4235
4235
|
}
|
|
4236
4236
|
} else if (result !== void 0) {
|
|
@@ -4239,7 +4239,7 @@ var require_visitor = __commonJS({
|
|
|
4239
4239
|
if ((0, _ast.isNode)(result)) {
|
|
4240
4240
|
node = result;
|
|
4241
4241
|
} else {
|
|
4242
|
-
|
|
4242
|
+
path2.pop();
|
|
4243
4243
|
continue;
|
|
4244
4244
|
}
|
|
4245
4245
|
}
|
|
@@ -4249,7 +4249,7 @@ var require_visitor = __commonJS({
|
|
|
4249
4249
|
edits.push([key, node]);
|
|
4250
4250
|
}
|
|
4251
4251
|
if (isLeaving) {
|
|
4252
|
-
|
|
4252
|
+
path2.pop();
|
|
4253
4253
|
} else {
|
|
4254
4254
|
var _node$kind;
|
|
4255
4255
|
stack = {
|
|
@@ -4374,16 +4374,16 @@ var require_printer = __commonJS({
|
|
|
4374
4374
|
},
|
|
4375
4375
|
// Document
|
|
4376
4376
|
Document: {
|
|
4377
|
-
leave: (node) =>
|
|
4377
|
+
leave: (node) => join7(node.definitions, "\n\n")
|
|
4378
4378
|
},
|
|
4379
4379
|
OperationDefinition: {
|
|
4380
4380
|
leave(node) {
|
|
4381
|
-
const varDefs = hasMultilineItems(node.variableDefinitions) ? wrap("(\n",
|
|
4382
|
-
const prefix = wrap("", node.description, "\n") +
|
|
4381
|
+
const varDefs = hasMultilineItems(node.variableDefinitions) ? wrap("(\n", join7(node.variableDefinitions, "\n"), "\n)") : wrap("(", join7(node.variableDefinitions, ", "), ")");
|
|
4382
|
+
const prefix = wrap("", node.description, "\n") + join7(
|
|
4383
4383
|
[
|
|
4384
4384
|
node.operation,
|
|
4385
|
-
|
|
4386
|
-
|
|
4385
|
+
join7([node.name, varDefs]),
|
|
4386
|
+
join7(node.directives, " ")
|
|
4387
4387
|
],
|
|
4388
4388
|
" "
|
|
4389
4389
|
);
|
|
@@ -4391,7 +4391,7 @@ var require_printer = __commonJS({
|
|
|
4391
4391
|
}
|
|
4392
4392
|
},
|
|
4393
4393
|
VariableDefinition: {
|
|
4394
|
-
leave: ({ variable, type, defaultValue, directives, description }) => wrap("", description, "\n") + variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ",
|
|
4394
|
+
leave: ({ variable, type, defaultValue, directives, description }) => wrap("", description, "\n") + variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join7(directives, " "))
|
|
4395
4395
|
},
|
|
4396
4396
|
SelectionSet: {
|
|
4397
4397
|
leave: ({ selections }) => block(selections)
|
|
@@ -4399,11 +4399,11 @@ var require_printer = __commonJS({
|
|
|
4399
4399
|
Field: {
|
|
4400
4400
|
leave({ alias, name, arguments: args, directives, selectionSet }) {
|
|
4401
4401
|
const prefix = wrap("", alias, ": ") + name;
|
|
4402
|
-
let argsLine = prefix + wrap("(",
|
|
4402
|
+
let argsLine = prefix + wrap("(", join7(args, ", "), ")");
|
|
4403
4403
|
if (argsLine.length > MAX_LINE_LENGTH) {
|
|
4404
|
-
argsLine = prefix + wrap("(\n", indent(
|
|
4404
|
+
argsLine = prefix + wrap("(\n", indent(join7(args, "\n")), "\n)");
|
|
4405
4405
|
}
|
|
4406
|
-
return
|
|
4406
|
+
return join7([argsLine, join7(directives, " "), selectionSet], " ");
|
|
4407
4407
|
}
|
|
4408
4408
|
},
|
|
4409
4409
|
Argument: {
|
|
@@ -4411,14 +4411,14 @@ var require_printer = __commonJS({
|
|
|
4411
4411
|
},
|
|
4412
4412
|
// Fragments
|
|
4413
4413
|
FragmentSpread: {
|
|
4414
|
-
leave: ({ name, directives }) => "..." + name + wrap(" ",
|
|
4414
|
+
leave: ({ name, directives }) => "..." + name + wrap(" ", join7(directives, " "))
|
|
4415
4415
|
},
|
|
4416
4416
|
InlineFragment: {
|
|
4417
|
-
leave: ({ typeCondition, directives, selectionSet }) =>
|
|
4417
|
+
leave: ({ typeCondition, directives, selectionSet }) => join7(
|
|
4418
4418
|
[
|
|
4419
4419
|
"...",
|
|
4420
4420
|
wrap("on ", typeCondition),
|
|
4421
|
-
|
|
4421
|
+
join7(directives, " "),
|
|
4422
4422
|
selectionSet
|
|
4423
4423
|
],
|
|
4424
4424
|
" "
|
|
@@ -4434,7 +4434,7 @@ var require_printer = __commonJS({
|
|
|
4434
4434
|
description
|
|
4435
4435
|
}) => wrap("", description, "\n") + // Note: fragment variable definitions are experimental and may be changed
|
|
4436
4436
|
// or removed in the future.
|
|
4437
|
-
`fragment ${name}${wrap("(",
|
|
4437
|
+
`fragment ${name}${wrap("(", join7(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join7(directives, " "), " ")}` + selectionSet
|
|
4438
4438
|
},
|
|
4439
4439
|
// Value
|
|
4440
4440
|
IntValue: {
|
|
@@ -4456,17 +4456,17 @@ var require_printer = __commonJS({
|
|
|
4456
4456
|
leave: ({ value }) => value
|
|
4457
4457
|
},
|
|
4458
4458
|
ListValue: {
|
|
4459
|
-
leave: ({ values }) => "[" +
|
|
4459
|
+
leave: ({ values }) => "[" + join7(values, ", ") + "]"
|
|
4460
4460
|
},
|
|
4461
4461
|
ObjectValue: {
|
|
4462
|
-
leave: ({ fields }) => "{" +
|
|
4462
|
+
leave: ({ fields }) => "{" + join7(fields, ", ") + "}"
|
|
4463
4463
|
},
|
|
4464
4464
|
ObjectField: {
|
|
4465
4465
|
leave: ({ name, value }) => name + ": " + value
|
|
4466
4466
|
},
|
|
4467
4467
|
// Directive
|
|
4468
4468
|
Directive: {
|
|
4469
|
-
leave: ({ name, arguments: args }) => "@" + name + wrap("(",
|
|
4469
|
+
leave: ({ name, arguments: args }) => "@" + name + wrap("(", join7(args, ", "), ")")
|
|
4470
4470
|
},
|
|
4471
4471
|
// Type
|
|
4472
4472
|
NamedType: {
|
|
@@ -4480,61 +4480,61 @@ var require_printer = __commonJS({
|
|
|
4480
4480
|
},
|
|
4481
4481
|
// Type System Definitions
|
|
4482
4482
|
SchemaDefinition: {
|
|
4483
|
-
leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") +
|
|
4483
|
+
leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join7(["schema", join7(directives, " "), block(operationTypes)], " ")
|
|
4484
4484
|
},
|
|
4485
4485
|
OperationTypeDefinition: {
|
|
4486
4486
|
leave: ({ operation, type }) => operation + ": " + type
|
|
4487
4487
|
},
|
|
4488
4488
|
ScalarTypeDefinition: {
|
|
4489
|
-
leave: ({ description, name, directives }) => wrap("", description, "\n") +
|
|
4489
|
+
leave: ({ description, name, directives }) => wrap("", description, "\n") + join7(["scalar", name, join7(directives, " ")], " ")
|
|
4490
4490
|
},
|
|
4491
4491
|
ObjectTypeDefinition: {
|
|
4492
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") +
|
|
4492
|
+
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join7(
|
|
4493
4493
|
[
|
|
4494
4494
|
"type",
|
|
4495
4495
|
name,
|
|
4496
|
-
wrap("implements ",
|
|
4497
|
-
|
|
4496
|
+
wrap("implements ", join7(interfaces, " & ")),
|
|
4497
|
+
join7(directives, " "),
|
|
4498
4498
|
block(fields)
|
|
4499
4499
|
],
|
|
4500
4500
|
" "
|
|
4501
4501
|
)
|
|
4502
4502
|
},
|
|
4503
4503
|
FieldDefinition: {
|
|
4504
|
-
leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(
|
|
4504
|
+
leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join7(args, "\n")), "\n)") : wrap("(", join7(args, ", "), ")")) + ": " + type + wrap(" ", join7(directives, " "))
|
|
4505
4505
|
},
|
|
4506
4506
|
InputValueDefinition: {
|
|
4507
|
-
leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") +
|
|
4508
|
-
[name + ": " + type, wrap("= ", defaultValue),
|
|
4507
|
+
leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join7(
|
|
4508
|
+
[name + ": " + type, wrap("= ", defaultValue), join7(directives, " ")],
|
|
4509
4509
|
" "
|
|
4510
4510
|
)
|
|
4511
4511
|
},
|
|
4512
4512
|
InterfaceTypeDefinition: {
|
|
4513
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") +
|
|
4513
|
+
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join7(
|
|
4514
4514
|
[
|
|
4515
4515
|
"interface",
|
|
4516
4516
|
name,
|
|
4517
|
-
wrap("implements ",
|
|
4518
|
-
|
|
4517
|
+
wrap("implements ", join7(interfaces, " & ")),
|
|
4518
|
+
join7(directives, " "),
|
|
4519
4519
|
block(fields)
|
|
4520
4520
|
],
|
|
4521
4521
|
" "
|
|
4522
4522
|
)
|
|
4523
4523
|
},
|
|
4524
4524
|
UnionTypeDefinition: {
|
|
4525
|
-
leave: ({ description, name, directives, types }) => wrap("", description, "\n") +
|
|
4526
|
-
["union", name,
|
|
4525
|
+
leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join7(
|
|
4526
|
+
["union", name, join7(directives, " "), wrap("= ", join7(types, " | "))],
|
|
4527
4527
|
" "
|
|
4528
4528
|
)
|
|
4529
4529
|
},
|
|
4530
4530
|
EnumTypeDefinition: {
|
|
4531
|
-
leave: ({ description, name, directives, values }) => wrap("", description, "\n") +
|
|
4531
|
+
leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join7(["enum", name, join7(directives, " "), block(values)], " ")
|
|
4532
4532
|
},
|
|
4533
4533
|
EnumValueDefinition: {
|
|
4534
|
-
leave: ({ description, name, directives }) => wrap("", description, "\n") +
|
|
4534
|
+
leave: ({ description, name, directives }) => wrap("", description, "\n") + join7([name, join7(directives, " ")], " ")
|
|
4535
4535
|
},
|
|
4536
4536
|
InputObjectTypeDefinition: {
|
|
4537
|
-
leave: ({ description, name, directives, fields }) => wrap("", description, "\n") +
|
|
4537
|
+
leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join7(["input", name, join7(directives, " "), block(fields)], " ")
|
|
4538
4538
|
},
|
|
4539
4539
|
DirectiveDefinition: {
|
|
4540
4540
|
leave: ({
|
|
@@ -4544,84 +4544,84 @@ var require_printer = __commonJS({
|
|
|
4544
4544
|
directives,
|
|
4545
4545
|
repeatable,
|
|
4546
4546
|
locations
|
|
4547
|
-
}) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(
|
|
4547
|
+
}) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join7(args, "\n")), "\n)") : wrap("(", join7(args, ", "), ")")) + wrap(" ", join7(directives, " ")) + (repeatable ? " repeatable" : "") + " on " + join7(locations, " | ")
|
|
4548
4548
|
},
|
|
4549
4549
|
SchemaExtension: {
|
|
4550
|
-
leave: ({ directives, operationTypes }) =>
|
|
4551
|
-
["extend schema",
|
|
4550
|
+
leave: ({ directives, operationTypes }) => join7(
|
|
4551
|
+
["extend schema", join7(directives, " "), block(operationTypes)],
|
|
4552
4552
|
" "
|
|
4553
4553
|
)
|
|
4554
4554
|
},
|
|
4555
4555
|
ScalarTypeExtension: {
|
|
4556
|
-
leave: ({ name, directives }) =>
|
|
4556
|
+
leave: ({ name, directives }) => join7(["extend scalar", name, join7(directives, " ")], " ")
|
|
4557
4557
|
},
|
|
4558
4558
|
ObjectTypeExtension: {
|
|
4559
|
-
leave: ({ name, interfaces, directives, fields }) =>
|
|
4559
|
+
leave: ({ name, interfaces, directives, fields }) => join7(
|
|
4560
4560
|
[
|
|
4561
4561
|
"extend type",
|
|
4562
4562
|
name,
|
|
4563
|
-
wrap("implements ",
|
|
4564
|
-
|
|
4563
|
+
wrap("implements ", join7(interfaces, " & ")),
|
|
4564
|
+
join7(directives, " "),
|
|
4565
4565
|
block(fields)
|
|
4566
4566
|
],
|
|
4567
4567
|
" "
|
|
4568
4568
|
)
|
|
4569
4569
|
},
|
|
4570
4570
|
InterfaceTypeExtension: {
|
|
4571
|
-
leave: ({ name, interfaces, directives, fields }) =>
|
|
4571
|
+
leave: ({ name, interfaces, directives, fields }) => join7(
|
|
4572
4572
|
[
|
|
4573
4573
|
"extend interface",
|
|
4574
4574
|
name,
|
|
4575
|
-
wrap("implements ",
|
|
4576
|
-
|
|
4575
|
+
wrap("implements ", join7(interfaces, " & ")),
|
|
4576
|
+
join7(directives, " "),
|
|
4577
4577
|
block(fields)
|
|
4578
4578
|
],
|
|
4579
4579
|
" "
|
|
4580
4580
|
)
|
|
4581
4581
|
},
|
|
4582
4582
|
UnionTypeExtension: {
|
|
4583
|
-
leave: ({ name, directives, types }) =>
|
|
4583
|
+
leave: ({ name, directives, types }) => join7(
|
|
4584
4584
|
[
|
|
4585
4585
|
"extend union",
|
|
4586
4586
|
name,
|
|
4587
|
-
|
|
4588
|
-
wrap("= ",
|
|
4587
|
+
join7(directives, " "),
|
|
4588
|
+
wrap("= ", join7(types, " | "))
|
|
4589
4589
|
],
|
|
4590
4590
|
" "
|
|
4591
4591
|
)
|
|
4592
4592
|
},
|
|
4593
4593
|
EnumTypeExtension: {
|
|
4594
|
-
leave: ({ name, directives, values }) =>
|
|
4594
|
+
leave: ({ name, directives, values }) => join7(["extend enum", name, join7(directives, " "), block(values)], " ")
|
|
4595
4595
|
},
|
|
4596
4596
|
InputObjectTypeExtension: {
|
|
4597
|
-
leave: ({ name, directives, fields }) =>
|
|
4597
|
+
leave: ({ name, directives, fields }) => join7(["extend input", name, join7(directives, " "), block(fields)], " ")
|
|
4598
4598
|
},
|
|
4599
4599
|
DirectiveExtension: {
|
|
4600
|
-
leave: ({ name, directives }) =>
|
|
4600
|
+
leave: ({ name, directives }) => join7(["extend directive @" + name, join7(directives, " ")], " ")
|
|
4601
4601
|
},
|
|
4602
4602
|
// Schema Coordinates
|
|
4603
4603
|
TypeCoordinate: {
|
|
4604
4604
|
leave: ({ name }) => name
|
|
4605
4605
|
},
|
|
4606
4606
|
MemberCoordinate: {
|
|
4607
|
-
leave: ({ name, memberName }) =>
|
|
4607
|
+
leave: ({ name, memberName }) => join7([name, wrap(".", memberName)])
|
|
4608
4608
|
},
|
|
4609
4609
|
ArgumentCoordinate: {
|
|
4610
|
-
leave: ({ name, fieldName, argumentName }) =>
|
|
4610
|
+
leave: ({ name, fieldName, argumentName }) => join7([name, wrap(".", fieldName), wrap("(", argumentName, ":)")])
|
|
4611
4611
|
},
|
|
4612
4612
|
DirectiveCoordinate: {
|
|
4613
|
-
leave: ({ name }) =>
|
|
4613
|
+
leave: ({ name }) => join7(["@", name])
|
|
4614
4614
|
},
|
|
4615
4615
|
DirectiveArgumentCoordinate: {
|
|
4616
|
-
leave: ({ name, argumentName }) =>
|
|
4616
|
+
leave: ({ name, argumentName }) => join7(["@", name, wrap("(", argumentName, ":)")])
|
|
4617
4617
|
}
|
|
4618
4618
|
};
|
|
4619
|
-
function
|
|
4619
|
+
function join7(maybeArray, separator = "") {
|
|
4620
4620
|
var _maybeArray$filter$jo;
|
|
4621
4621
|
return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
|
|
4622
4622
|
}
|
|
4623
4623
|
function block(array) {
|
|
4624
|
-
return wrap("{\n", indent(
|
|
4624
|
+
return wrap("{\n", indent(join7(array, "\n")), "\n}");
|
|
4625
4625
|
}
|
|
4626
4626
|
function wrap(start, maybeString, end = "") {
|
|
4627
4627
|
return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
|
|
@@ -9578,8 +9578,8 @@ var require_printPathArray = __commonJS({
|
|
|
9578
9578
|
value: true
|
|
9579
9579
|
});
|
|
9580
9580
|
exports.printPathArray = printPathArray;
|
|
9581
|
-
function printPathArray(
|
|
9582
|
-
return
|
|
9581
|
+
function printPathArray(path2) {
|
|
9582
|
+
return path2.map(
|
|
9583
9583
|
(key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key
|
|
9584
9584
|
).join("");
|
|
9585
9585
|
}
|
|
@@ -9602,9 +9602,9 @@ var require_Path = __commonJS({
|
|
|
9602
9602
|
typename
|
|
9603
9603
|
};
|
|
9604
9604
|
}
|
|
9605
|
-
function pathToArray(
|
|
9605
|
+
function pathToArray(path2) {
|
|
9606
9606
|
const flattened = [];
|
|
9607
|
-
let curr =
|
|
9607
|
+
let curr = path2;
|
|
9608
9608
|
while (curr) {
|
|
9609
9609
|
flattened.push(curr.key);
|
|
9610
9610
|
curr = curr.prev;
|
|
@@ -9635,21 +9635,21 @@ var require_coerceInputValue = __commonJS({
|
|
|
9635
9635
|
function coerceInputValue(inputValue, type, onError = defaultOnError) {
|
|
9636
9636
|
return coerceInputValueImpl(inputValue, type, onError, void 0);
|
|
9637
9637
|
}
|
|
9638
|
-
function defaultOnError(
|
|
9638
|
+
function defaultOnError(path2, invalidValue, error) {
|
|
9639
9639
|
let errorPrefix = "Invalid value " + (0, _inspect.inspect)(invalidValue);
|
|
9640
|
-
if (
|
|
9641
|
-
errorPrefix += ` at "value${(0, _printPathArray.printPathArray)(
|
|
9640
|
+
if (path2.length > 0) {
|
|
9641
|
+
errorPrefix += ` at "value${(0, _printPathArray.printPathArray)(path2)}"`;
|
|
9642
9642
|
}
|
|
9643
9643
|
error.message = errorPrefix + ": " + error.message;
|
|
9644
9644
|
throw error;
|
|
9645
9645
|
}
|
|
9646
|
-
function coerceInputValueImpl(inputValue, type, onError,
|
|
9646
|
+
function coerceInputValueImpl(inputValue, type, onError, path2) {
|
|
9647
9647
|
if ((0, _definition.isNonNullType)(type)) {
|
|
9648
9648
|
if (inputValue != null) {
|
|
9649
|
-
return coerceInputValueImpl(inputValue, type.ofType, onError,
|
|
9649
|
+
return coerceInputValueImpl(inputValue, type.ofType, onError, path2);
|
|
9650
9650
|
}
|
|
9651
9651
|
onError(
|
|
9652
|
-
(0, _Path.pathToArray)(
|
|
9652
|
+
(0, _Path.pathToArray)(path2),
|
|
9653
9653
|
inputValue,
|
|
9654
9654
|
new _GraphQLError.GraphQLError(
|
|
9655
9655
|
`Expected non-nullable type "${(0, _inspect.inspect)(
|
|
@@ -9666,16 +9666,16 @@ var require_coerceInputValue = __commonJS({
|
|
|
9666
9666
|
const itemType = type.ofType;
|
|
9667
9667
|
if ((0, _isIterableObject.isIterableObject)(inputValue)) {
|
|
9668
9668
|
return Array.from(inputValue, (itemValue, index) => {
|
|
9669
|
-
const itemPath = (0, _Path.addPath)(
|
|
9669
|
+
const itemPath = (0, _Path.addPath)(path2, index, void 0);
|
|
9670
9670
|
return coerceInputValueImpl(itemValue, itemType, onError, itemPath);
|
|
9671
9671
|
});
|
|
9672
9672
|
}
|
|
9673
|
-
return [coerceInputValueImpl(inputValue, itemType, onError,
|
|
9673
|
+
return [coerceInputValueImpl(inputValue, itemType, onError, path2)];
|
|
9674
9674
|
}
|
|
9675
9675
|
if ((0, _definition.isInputObjectType)(type)) {
|
|
9676
9676
|
if (!(0, _isObjectLike.isObjectLike)(inputValue) || Array.isArray(inputValue)) {
|
|
9677
9677
|
onError(
|
|
9678
|
-
(0, _Path.pathToArray)(
|
|
9678
|
+
(0, _Path.pathToArray)(path2),
|
|
9679
9679
|
inputValue,
|
|
9680
9680
|
new _GraphQLError.GraphQLError(
|
|
9681
9681
|
`Expected type "${type.name}" to be an object.`
|
|
@@ -9693,7 +9693,7 @@ var require_coerceInputValue = __commonJS({
|
|
|
9693
9693
|
} else if ((0, _definition.isNonNullType)(field.type)) {
|
|
9694
9694
|
const typeStr = (0, _inspect.inspect)(field.type);
|
|
9695
9695
|
onError(
|
|
9696
|
-
(0, _Path.pathToArray)(
|
|
9696
|
+
(0, _Path.pathToArray)(path2),
|
|
9697
9697
|
inputValue,
|
|
9698
9698
|
new _GraphQLError.GraphQLError(
|
|
9699
9699
|
`Field "${field.name}" of required type "${typeStr}" was not provided.`
|
|
@@ -9706,7 +9706,7 @@ var require_coerceInputValue = __commonJS({
|
|
|
9706
9706
|
fieldValue,
|
|
9707
9707
|
field.type,
|
|
9708
9708
|
onError,
|
|
9709
|
-
(0, _Path.addPath)(
|
|
9709
|
+
(0, _Path.addPath)(path2, field.name, type.name)
|
|
9710
9710
|
);
|
|
9711
9711
|
}
|
|
9712
9712
|
for (const fieldName of Object.keys(inputValue)) {
|
|
@@ -9716,7 +9716,7 @@ var require_coerceInputValue = __commonJS({
|
|
|
9716
9716
|
Object.keys(type.getFields())
|
|
9717
9717
|
);
|
|
9718
9718
|
onError(
|
|
9719
|
-
(0, _Path.pathToArray)(
|
|
9719
|
+
(0, _Path.pathToArray)(path2),
|
|
9720
9720
|
inputValue,
|
|
9721
9721
|
new _GraphQLError.GraphQLError(
|
|
9722
9722
|
`Field "${fieldName}" is not defined by type "${type.name}".` + (0, _didYouMean.didYouMean)(suggestions)
|
|
@@ -9728,7 +9728,7 @@ var require_coerceInputValue = __commonJS({
|
|
|
9728
9728
|
const keys = Object.keys(coercedValue);
|
|
9729
9729
|
if (keys.length !== 1) {
|
|
9730
9730
|
onError(
|
|
9731
|
-
(0, _Path.pathToArray)(
|
|
9731
|
+
(0, _Path.pathToArray)(path2),
|
|
9732
9732
|
inputValue,
|
|
9733
9733
|
new _GraphQLError.GraphQLError(
|
|
9734
9734
|
`Exactly one key must be specified for OneOf type "${type.name}".`
|
|
@@ -9739,7 +9739,7 @@ var require_coerceInputValue = __commonJS({
|
|
|
9739
9739
|
const value = coercedValue[key];
|
|
9740
9740
|
if (value === null) {
|
|
9741
9741
|
onError(
|
|
9742
|
-
(0, _Path.pathToArray)(
|
|
9742
|
+
(0, _Path.pathToArray)(path2).concat(key),
|
|
9743
9743
|
value,
|
|
9744
9744
|
new _GraphQLError.GraphQLError(`Field "${key}" must be non-null.`)
|
|
9745
9745
|
);
|
|
@@ -9753,10 +9753,10 @@ var require_coerceInputValue = __commonJS({
|
|
|
9753
9753
|
parseResult = type.parseValue(inputValue);
|
|
9754
9754
|
} catch (error) {
|
|
9755
9755
|
if (error instanceof _GraphQLError.GraphQLError) {
|
|
9756
|
-
onError((0, _Path.pathToArray)(
|
|
9756
|
+
onError((0, _Path.pathToArray)(path2), inputValue, error);
|
|
9757
9757
|
} else {
|
|
9758
9758
|
onError(
|
|
9759
|
-
(0, _Path.pathToArray)(
|
|
9759
|
+
(0, _Path.pathToArray)(path2),
|
|
9760
9760
|
inputValue,
|
|
9761
9761
|
new _GraphQLError.GraphQLError(
|
|
9762
9762
|
`Expected type "${type.name}". ` + error.message,
|
|
@@ -9770,7 +9770,7 @@ var require_coerceInputValue = __commonJS({
|
|
|
9770
9770
|
}
|
|
9771
9771
|
if (parseResult === void 0) {
|
|
9772
9772
|
onError(
|
|
9773
|
-
(0, _Path.pathToArray)(
|
|
9773
|
+
(0, _Path.pathToArray)(path2),
|
|
9774
9774
|
inputValue,
|
|
9775
9775
|
new _GraphQLError.GraphQLError(`Expected type "${type.name}".`)
|
|
9776
9776
|
);
|
|
@@ -10011,11 +10011,11 @@ var require_values = __commonJS({
|
|
|
10011
10011
|
coercedValues[varName] = (0, _coerceInputValue.coerceInputValue)(
|
|
10012
10012
|
value,
|
|
10013
10013
|
varType,
|
|
10014
|
-
(
|
|
10014
|
+
(path2, invalidValue, error) => {
|
|
10015
10015
|
let prefix = `Variable "$${varName}" got invalid value ` + (0, _inspect.inspect)(invalidValue);
|
|
10016
|
-
if (
|
|
10016
|
+
if (path2.length > 0) {
|
|
10017
10017
|
prefix += ` at "${varName}${(0, _printPathArray.printPathArray)(
|
|
10018
|
-
|
|
10018
|
+
path2
|
|
10019
10019
|
)}"`;
|
|
10020
10020
|
}
|
|
10021
10021
|
onError(
|
|
@@ -11745,7 +11745,7 @@ var require_locatedError = __commonJS({
|
|
|
11745
11745
|
exports.locatedError = locatedError;
|
|
11746
11746
|
var _toError = require_toError();
|
|
11747
11747
|
var _GraphQLError = require_GraphQLError();
|
|
11748
|
-
function locatedError(rawOriginalError, nodes,
|
|
11748
|
+
function locatedError(rawOriginalError, nodes, path2) {
|
|
11749
11749
|
var _nodes;
|
|
11750
11750
|
const originalError = (0, _toError.toError)(rawOriginalError);
|
|
11751
11751
|
if (isLocatedGraphQLError(originalError)) {
|
|
@@ -11755,7 +11755,7 @@ var require_locatedError = __commonJS({
|
|
|
11755
11755
|
nodes: (_nodes = originalError.nodes) !== null && _nodes !== void 0 ? _nodes : nodes,
|
|
11756
11756
|
source: originalError.source,
|
|
11757
11757
|
positions: originalError.positions,
|
|
11758
|
-
path,
|
|
11758
|
+
path: path2,
|
|
11759
11759
|
originalError
|
|
11760
11760
|
});
|
|
11761
11761
|
}
|
|
@@ -11815,20 +11815,20 @@ var require_execute = __commonJS({
|
|
|
11815
11815
|
get errors() {
|
|
11816
11816
|
return this._errors;
|
|
11817
11817
|
}
|
|
11818
|
-
add(error,
|
|
11819
|
-
if (this._hasNulledPosition(
|
|
11818
|
+
add(error, path2) {
|
|
11819
|
+
if (this._hasNulledPosition(path2)) {
|
|
11820
11820
|
return;
|
|
11821
11821
|
}
|
|
11822
|
-
this._errorPositions.add(
|
|
11822
|
+
this._errorPositions.add(path2);
|
|
11823
11823
|
this._errors.push(error);
|
|
11824
11824
|
}
|
|
11825
11825
|
_hasNulledPosition(startPath) {
|
|
11826
|
-
let
|
|
11827
|
-
while (
|
|
11828
|
-
if (this._errorPositions.has(
|
|
11826
|
+
let path2 = startPath;
|
|
11827
|
+
while (path2 !== void 0) {
|
|
11828
|
+
if (this._errorPositions.has(path2)) {
|
|
11829
11829
|
return true;
|
|
11830
11830
|
}
|
|
11831
|
-
|
|
11831
|
+
path2 = path2.prev;
|
|
11832
11832
|
}
|
|
11833
11833
|
return this._errorPositions.has(void 0);
|
|
11834
11834
|
}
|
|
@@ -11977,27 +11977,27 @@ var require_execute = __commonJS({
|
|
|
11977
11977
|
rootType,
|
|
11978
11978
|
operation.selectionSet
|
|
11979
11979
|
);
|
|
11980
|
-
const
|
|
11980
|
+
const path2 = void 0;
|
|
11981
11981
|
switch (operation.operation) {
|
|
11982
11982
|
case _ast.OperationTypeNode.QUERY:
|
|
11983
|
-
return executeFields(exeContext, rootType, rootValue,
|
|
11983
|
+
return executeFields(exeContext, rootType, rootValue, path2, rootFields);
|
|
11984
11984
|
case _ast.OperationTypeNode.MUTATION:
|
|
11985
11985
|
return executeFieldsSerially(
|
|
11986
11986
|
exeContext,
|
|
11987
11987
|
rootType,
|
|
11988
11988
|
rootValue,
|
|
11989
|
-
|
|
11989
|
+
path2,
|
|
11990
11990
|
rootFields
|
|
11991
11991
|
);
|
|
11992
11992
|
case _ast.OperationTypeNode.SUBSCRIPTION:
|
|
11993
|
-
return executeFields(exeContext, rootType, rootValue,
|
|
11993
|
+
return executeFields(exeContext, rootType, rootValue, path2, rootFields);
|
|
11994
11994
|
}
|
|
11995
11995
|
}
|
|
11996
|
-
function executeFieldsSerially(exeContext, parentType, sourceValue,
|
|
11996
|
+
function executeFieldsSerially(exeContext, parentType, sourceValue, path2, fields) {
|
|
11997
11997
|
return (0, _promiseReduce.promiseReduce)(
|
|
11998
11998
|
fields.entries(),
|
|
11999
11999
|
(results, [responseName, fieldNodes]) => {
|
|
12000
|
-
const fieldPath = (0, _Path.addPath)(
|
|
12000
|
+
const fieldPath = (0, _Path.addPath)(path2, responseName, parentType.name);
|
|
12001
12001
|
const result = executeField(
|
|
12002
12002
|
exeContext,
|
|
12003
12003
|
parentType,
|
|
@@ -12020,12 +12020,12 @@ var require_execute = __commonJS({
|
|
|
12020
12020
|
/* @__PURE__ */ Object.create(null)
|
|
12021
12021
|
);
|
|
12022
12022
|
}
|
|
12023
|
-
function executeFields(exeContext, parentType, sourceValue,
|
|
12023
|
+
function executeFields(exeContext, parentType, sourceValue, path2, fields) {
|
|
12024
12024
|
const results = /* @__PURE__ */ Object.create(null);
|
|
12025
12025
|
let containsPromise = false;
|
|
12026
12026
|
try {
|
|
12027
12027
|
for (const [responseName, fieldNodes] of fields.entries()) {
|
|
12028
|
-
const fieldPath = (0, _Path.addPath)(
|
|
12028
|
+
const fieldPath = (0, _Path.addPath)(path2, responseName, parentType.name);
|
|
12029
12029
|
const result = executeField(
|
|
12030
12030
|
exeContext,
|
|
12031
12031
|
parentType,
|
|
@@ -12053,7 +12053,7 @@ var require_execute = __commonJS({
|
|
|
12053
12053
|
}
|
|
12054
12054
|
return (0, _promiseForObject.promiseForObject)(results);
|
|
12055
12055
|
}
|
|
12056
|
-
function executeField(exeContext, parentType, source, fieldNodes,
|
|
12056
|
+
function executeField(exeContext, parentType, source, fieldNodes, path2) {
|
|
12057
12057
|
var _fieldDef$resolve;
|
|
12058
12058
|
const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]);
|
|
12059
12059
|
if (!fieldDef) {
|
|
@@ -12066,7 +12066,7 @@ var require_execute = __commonJS({
|
|
|
12066
12066
|
fieldDef,
|
|
12067
12067
|
fieldNodes,
|
|
12068
12068
|
parentType,
|
|
12069
|
-
|
|
12069
|
+
path2
|
|
12070
12070
|
);
|
|
12071
12071
|
try {
|
|
12072
12072
|
const args = (0, _values.getArgumentValues)(
|
|
@@ -12079,7 +12079,7 @@ var require_execute = __commonJS({
|
|
|
12079
12079
|
let completed;
|
|
12080
12080
|
if ((0, _isPromise.isPromise)(result)) {
|
|
12081
12081
|
completed = result.then(
|
|
12082
|
-
(resolved) => completeValue(exeContext, returnType, fieldNodes, info,
|
|
12082
|
+
(resolved) => completeValue(exeContext, returnType, fieldNodes, info, path2, resolved)
|
|
12083
12083
|
);
|
|
12084
12084
|
} else {
|
|
12085
12085
|
completed = completeValue(
|
|
@@ -12087,7 +12087,7 @@ var require_execute = __commonJS({
|
|
|
12087
12087
|
returnType,
|
|
12088
12088
|
fieldNodes,
|
|
12089
12089
|
info,
|
|
12090
|
-
|
|
12090
|
+
path2,
|
|
12091
12091
|
result
|
|
12092
12092
|
);
|
|
12093
12093
|
}
|
|
@@ -12096,9 +12096,9 @@ var require_execute = __commonJS({
|
|
|
12096
12096
|
const error = (0, _locatedError.locatedError)(
|
|
12097
12097
|
rawError,
|
|
12098
12098
|
fieldNodes,
|
|
12099
|
-
(0, _Path.pathToArray)(
|
|
12099
|
+
(0, _Path.pathToArray)(path2)
|
|
12100
12100
|
);
|
|
12101
|
-
return handleFieldError(error, returnType,
|
|
12101
|
+
return handleFieldError(error, returnType, path2, exeContext);
|
|
12102
12102
|
});
|
|
12103
12103
|
}
|
|
12104
12104
|
return completed;
|
|
@@ -12106,18 +12106,18 @@ var require_execute = __commonJS({
|
|
|
12106
12106
|
const error = (0, _locatedError.locatedError)(
|
|
12107
12107
|
rawError,
|
|
12108
12108
|
fieldNodes,
|
|
12109
|
-
(0, _Path.pathToArray)(
|
|
12109
|
+
(0, _Path.pathToArray)(path2)
|
|
12110
12110
|
);
|
|
12111
|
-
return handleFieldError(error, returnType,
|
|
12111
|
+
return handleFieldError(error, returnType, path2, exeContext);
|
|
12112
12112
|
}
|
|
12113
12113
|
}
|
|
12114
|
-
function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType,
|
|
12114
|
+
function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2) {
|
|
12115
12115
|
return {
|
|
12116
12116
|
fieldName: fieldDef.name,
|
|
12117
12117
|
fieldNodes,
|
|
12118
12118
|
returnType: fieldDef.type,
|
|
12119
12119
|
parentType,
|
|
12120
|
-
path,
|
|
12120
|
+
path: path2,
|
|
12121
12121
|
schema: exeContext.schema,
|
|
12122
12122
|
fragments: exeContext.fragments,
|
|
12123
12123
|
rootValue: exeContext.rootValue,
|
|
@@ -12125,14 +12125,14 @@ var require_execute = __commonJS({
|
|
|
12125
12125
|
variableValues: exeContext.variableValues
|
|
12126
12126
|
};
|
|
12127
12127
|
}
|
|
12128
|
-
function handleFieldError(error, returnType,
|
|
12128
|
+
function handleFieldError(error, returnType, path2, exeContext) {
|
|
12129
12129
|
if ((0, _definition.isNonNullType)(returnType)) {
|
|
12130
12130
|
throw error;
|
|
12131
12131
|
}
|
|
12132
|
-
exeContext.collectedErrors.add(error,
|
|
12132
|
+
exeContext.collectedErrors.add(error, path2);
|
|
12133
12133
|
return null;
|
|
12134
12134
|
}
|
|
12135
|
-
function completeValue(exeContext, returnType, fieldNodes, info,
|
|
12135
|
+
function completeValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
12136
12136
|
if (result instanceof Error) {
|
|
12137
12137
|
throw result;
|
|
12138
12138
|
}
|
|
@@ -12142,7 +12142,7 @@ var require_execute = __commonJS({
|
|
|
12142
12142
|
returnType.ofType,
|
|
12143
12143
|
fieldNodes,
|
|
12144
12144
|
info,
|
|
12145
|
-
|
|
12145
|
+
path2,
|
|
12146
12146
|
result
|
|
12147
12147
|
);
|
|
12148
12148
|
if (completed === null) {
|
|
@@ -12161,7 +12161,7 @@ var require_execute = __commonJS({
|
|
|
12161
12161
|
returnType,
|
|
12162
12162
|
fieldNodes,
|
|
12163
12163
|
info,
|
|
12164
|
-
|
|
12164
|
+
path2,
|
|
12165
12165
|
result
|
|
12166
12166
|
);
|
|
12167
12167
|
}
|
|
@@ -12174,7 +12174,7 @@ var require_execute = __commonJS({
|
|
|
12174
12174
|
returnType,
|
|
12175
12175
|
fieldNodes,
|
|
12176
12176
|
info,
|
|
12177
|
-
|
|
12177
|
+
path2,
|
|
12178
12178
|
result
|
|
12179
12179
|
);
|
|
12180
12180
|
}
|
|
@@ -12184,7 +12184,7 @@ var require_execute = __commonJS({
|
|
|
12184
12184
|
returnType,
|
|
12185
12185
|
fieldNodes,
|
|
12186
12186
|
info,
|
|
12187
|
-
|
|
12187
|
+
path2,
|
|
12188
12188
|
result
|
|
12189
12189
|
);
|
|
12190
12190
|
}
|
|
@@ -12193,7 +12193,7 @@ var require_execute = __commonJS({
|
|
|
12193
12193
|
"Cannot complete value of unexpected output type: " + (0, _inspect.inspect)(returnType)
|
|
12194
12194
|
);
|
|
12195
12195
|
}
|
|
12196
|
-
function completeListValue(exeContext, returnType, fieldNodes, info,
|
|
12196
|
+
function completeListValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
12197
12197
|
if (!(0, _isIterableObject.isIterableObject)(result)) {
|
|
12198
12198
|
throw new _GraphQLError.GraphQLError(
|
|
12199
12199
|
`Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`
|
|
@@ -12202,7 +12202,7 @@ var require_execute = __commonJS({
|
|
|
12202
12202
|
const itemType = returnType.ofType;
|
|
12203
12203
|
let containsPromise = false;
|
|
12204
12204
|
const completedResults = Array.from(result, (item, index) => {
|
|
12205
|
-
const itemPath = (0, _Path.addPath)(
|
|
12205
|
+
const itemPath = (0, _Path.addPath)(path2, index, void 0);
|
|
12206
12206
|
try {
|
|
12207
12207
|
let completedItem;
|
|
12208
12208
|
if ((0, _isPromise.isPromise)(item)) {
|
|
@@ -12260,7 +12260,7 @@ var require_execute = __commonJS({
|
|
|
12260
12260
|
}
|
|
12261
12261
|
return serializedResult;
|
|
12262
12262
|
}
|
|
12263
|
-
function completeAbstractValue(exeContext, returnType, fieldNodes, info,
|
|
12263
|
+
function completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
12264
12264
|
var _returnType$resolveTy;
|
|
12265
12265
|
const resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver;
|
|
12266
12266
|
const contextValue = exeContext.contextValue;
|
|
@@ -12279,7 +12279,7 @@ var require_execute = __commonJS({
|
|
|
12279
12279
|
),
|
|
12280
12280
|
fieldNodes,
|
|
12281
12281
|
info,
|
|
12282
|
-
|
|
12282
|
+
path2,
|
|
12283
12283
|
result
|
|
12284
12284
|
)
|
|
12285
12285
|
);
|
|
@@ -12296,7 +12296,7 @@ var require_execute = __commonJS({
|
|
|
12296
12296
|
),
|
|
12297
12297
|
fieldNodes,
|
|
12298
12298
|
info,
|
|
12299
|
-
|
|
12299
|
+
path2,
|
|
12300
12300
|
result
|
|
12301
12301
|
);
|
|
12302
12302
|
}
|
|
@@ -12344,7 +12344,7 @@ var require_execute = __commonJS({
|
|
|
12344
12344
|
}
|
|
12345
12345
|
return runtimeType;
|
|
12346
12346
|
}
|
|
12347
|
-
function completeObjectValue(exeContext, returnType, fieldNodes, info,
|
|
12347
|
+
function completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
12348
12348
|
const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes);
|
|
12349
12349
|
if (returnType.isTypeOf) {
|
|
12350
12350
|
const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
|
|
@@ -12357,7 +12357,7 @@ var require_execute = __commonJS({
|
|
|
12357
12357
|
exeContext,
|
|
12358
12358
|
returnType,
|
|
12359
12359
|
result,
|
|
12360
|
-
|
|
12360
|
+
path2,
|
|
12361
12361
|
subFieldNodes
|
|
12362
12362
|
);
|
|
12363
12363
|
});
|
|
@@ -12366,7 +12366,7 @@ var require_execute = __commonJS({
|
|
|
12366
12366
|
throw invalidReturnTypeError(returnType, result, fieldNodes);
|
|
12367
12367
|
}
|
|
12368
12368
|
}
|
|
12369
|
-
return executeFields(exeContext, returnType, result,
|
|
12369
|
+
return executeFields(exeContext, returnType, result, path2, subFieldNodes);
|
|
12370
12370
|
}
|
|
12371
12371
|
function invalidReturnTypeError(returnType, result, fieldNodes) {
|
|
12372
12372
|
return new _GraphQLError.GraphQLError(
|
|
@@ -12448,7 +12448,7 @@ var require_graphql = __commonJS({
|
|
|
12448
12448
|
var _validate2 = require_validate2();
|
|
12449
12449
|
var _execute = require_execute();
|
|
12450
12450
|
function graphql(args) {
|
|
12451
|
-
return new Promise((
|
|
12451
|
+
return new Promise((resolve5) => resolve5(graphqlImpl(args)));
|
|
12452
12452
|
}
|
|
12453
12453
|
function graphqlSync(args) {
|
|
12454
12454
|
const result = graphqlImpl(args);
|
|
@@ -13450,13 +13450,13 @@ var require_subscribe = __commonJS({
|
|
|
13450
13450
|
}
|
|
13451
13451
|
);
|
|
13452
13452
|
}
|
|
13453
|
-
const
|
|
13453
|
+
const path2 = (0, _Path.addPath)(void 0, responseName, rootType.name);
|
|
13454
13454
|
const info = (0, _execute.buildResolveInfo)(
|
|
13455
13455
|
exeContext,
|
|
13456
13456
|
fieldDef,
|
|
13457
13457
|
fieldNodes,
|
|
13458
13458
|
rootType,
|
|
13459
|
-
|
|
13459
|
+
path2
|
|
13460
13460
|
);
|
|
13461
13461
|
try {
|
|
13462
13462
|
var _fieldDef$subscribe;
|
|
@@ -13476,7 +13476,7 @@ var require_subscribe = __commonJS({
|
|
|
13476
13476
|
throw (0, _locatedError.locatedError)(
|
|
13477
13477
|
error,
|
|
13478
13478
|
fieldNodes,
|
|
13479
|
-
(0, _Path.pathToArray)(
|
|
13479
|
+
(0, _Path.pathToArray)(path2)
|
|
13480
13480
|
);
|
|
13481
13481
|
}
|
|
13482
13482
|
}
|
|
@@ -17797,7 +17797,7 @@ var require_graphql2 = __commonJS({
|
|
|
17797
17797
|
});
|
|
17798
17798
|
|
|
17799
17799
|
// src/cli/index.ts
|
|
17800
|
-
import { Command as
|
|
17800
|
+
import { Command as Command15 } from "commander";
|
|
17801
17801
|
|
|
17802
17802
|
// src/cli/commands/bootstrap.ts
|
|
17803
17803
|
import { Command, Option as Option2 } from "commander";
|
|
@@ -18855,7 +18855,7 @@ var IntrinsicFunctionResolver = class {
|
|
|
18855
18855
|
this.logger.debug(
|
|
18856
18856
|
`VPC ${physicalId} IPv6 CIDR still associating (attempt ${attempt}/${maxAttempts}), waiting...`
|
|
18857
18857
|
);
|
|
18858
|
-
await new Promise((
|
|
18858
|
+
await new Promise((resolve5) => setTimeout(resolve5, 2e3));
|
|
18859
18859
|
}
|
|
18860
18860
|
this.logger.warn(
|
|
18861
18861
|
`VPC ${physicalId} IPv6 CIDR did not reach 'associated' state after ${maxAttempts} attempts`
|
|
@@ -19740,7 +19740,7 @@ var DagExecutor = class {
|
|
|
19740
19740
|
async execute(concurrency, fn, cancelled = () => false) {
|
|
19741
19741
|
let active = 0;
|
|
19742
19742
|
const errors = [];
|
|
19743
|
-
return new Promise((
|
|
19743
|
+
return new Promise((resolve5, reject) => {
|
|
19744
19744
|
const dispatch = () => {
|
|
19745
19745
|
let changed = true;
|
|
19746
19746
|
while (changed) {
|
|
@@ -19802,7 +19802,7 @@ var DagExecutor = class {
|
|
|
19802
19802
|
);
|
|
19803
19803
|
return;
|
|
19804
19804
|
}
|
|
19805
|
-
|
|
19805
|
+
resolve5();
|
|
19806
19806
|
}
|
|
19807
19807
|
};
|
|
19808
19808
|
dispatch();
|
|
@@ -20483,7 +20483,7 @@ Error: ${err.message || "Unknown error"}`,
|
|
|
20483
20483
|
* Sleep for specified milliseconds
|
|
20484
20484
|
*/
|
|
20485
20485
|
sleep(ms) {
|
|
20486
|
-
return new Promise((
|
|
20486
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
20487
20487
|
}
|
|
20488
20488
|
/**
|
|
20489
20489
|
* Check if a resource type is supported by Cloud Control API
|
|
@@ -21217,7 +21217,7 @@ var CustomResourceProvider = class _CustomResourceProvider {
|
|
|
21217
21217
|
return result;
|
|
21218
21218
|
}
|
|
21219
21219
|
sleep(ms) {
|
|
21220
|
-
return new Promise((
|
|
21220
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
21221
21221
|
}
|
|
21222
21222
|
/**
|
|
21223
21223
|
* Adopt an existing custom resource into cdkd state.
|
|
@@ -21647,7 +21647,7 @@ function isRetryableTransientError(error, message) {
|
|
|
21647
21647
|
}
|
|
21648
21648
|
|
|
21649
21649
|
// src/deployment/retry.ts
|
|
21650
|
-
var defaultSleep = (ms) => new Promise((
|
|
21650
|
+
var defaultSleep = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
21651
21651
|
async function withRetry(operation, logicalId, opts = {}) {
|
|
21652
21652
|
const maxRetries = opts.maxRetries ?? 8;
|
|
21653
21653
|
const initialDelayMs = opts.initialDelayMs ?? 1e3;
|
|
@@ -21664,15 +21664,15 @@ async function withRetry(operation, logicalId, opts = {}) {
|
|
|
21664
21664
|
if (!retryable || attempt >= maxRetries) {
|
|
21665
21665
|
throw error;
|
|
21666
21666
|
}
|
|
21667
|
-
const
|
|
21667
|
+
const delay2 = Math.min(initialDelayMs * Math.pow(2, attempt), maxDelayMs);
|
|
21668
21668
|
opts.logger?.debug(
|
|
21669
|
-
` \u23F3 Retrying ${logicalId} in ${
|
|
21669
|
+
` \u23F3 Retrying ${logicalId} in ${delay2 / 1e3}s (attempt ${attempt + 1}/${maxRetries}) - ${message}`
|
|
21670
21670
|
);
|
|
21671
|
-
for (let waited = 0; waited <
|
|
21671
|
+
for (let waited = 0; waited < delay2; waited += 1e3) {
|
|
21672
21672
|
if (opts.isInterrupted?.()) {
|
|
21673
21673
|
throw opts.onInterrupted ? opts.onInterrupted() : new Error("Interrupted");
|
|
21674
21674
|
}
|
|
21675
|
-
await sleep(Math.min(1e3,
|
|
21675
|
+
await sleep(Math.min(1e3, delay2 - waited));
|
|
21676
21676
|
}
|
|
21677
21677
|
}
|
|
21678
21678
|
}
|
|
@@ -21702,7 +21702,7 @@ function validateOptions(opts) {
|
|
|
21702
21702
|
async function withResourceDeadline(operation, opts) {
|
|
21703
21703
|
validateOptions(opts);
|
|
21704
21704
|
const startedAt = Date.now();
|
|
21705
|
-
return new Promise((
|
|
21705
|
+
return new Promise((resolve5, reject) => {
|
|
21706
21706
|
let settled = false;
|
|
21707
21707
|
let warnTimer;
|
|
21708
21708
|
let timeoutTimer;
|
|
@@ -21742,7 +21742,7 @@ async function withResourceDeadline(operation, opts) {
|
|
|
21742
21742
|
return;
|
|
21743
21743
|
settled = true;
|
|
21744
21744
|
cleanup();
|
|
21745
|
-
|
|
21745
|
+
resolve5(value);
|
|
21746
21746
|
},
|
|
21747
21747
|
(err) => {
|
|
21748
21748
|
if (settled)
|
|
@@ -23742,7 +23742,7 @@ var AppExecutor = class {
|
|
|
23742
23742
|
* Spawn subprocess and wait for completion
|
|
23743
23743
|
*/
|
|
23744
23744
|
spawn(commandLine, env) {
|
|
23745
|
-
return new Promise((
|
|
23745
|
+
return new Promise((resolve5, reject) => {
|
|
23746
23746
|
const proc = spawn(commandLine, {
|
|
23747
23747
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23748
23748
|
shell: true,
|
|
@@ -23768,7 +23768,7 @@ var AppExecutor = class {
|
|
|
23768
23768
|
});
|
|
23769
23769
|
proc.on("close", (code) => {
|
|
23770
23770
|
if (code === 0) {
|
|
23771
|
-
|
|
23771
|
+
resolve5();
|
|
23772
23772
|
} else {
|
|
23773
23773
|
const stderr = stderrChunks.join("\n");
|
|
23774
23774
|
reject(
|
|
@@ -24480,8 +24480,8 @@ var CcApiContextProvider = class {
|
|
|
24480
24480
|
/**
|
|
24481
24481
|
* Get nested property value using dot notation
|
|
24482
24482
|
*/
|
|
24483
|
-
getNestedProperty(obj,
|
|
24484
|
-
const parts =
|
|
24483
|
+
getNestedProperty(obj, path2) {
|
|
24484
|
+
const parts = path2.split(".");
|
|
24485
24485
|
let current = obj;
|
|
24486
24486
|
for (const part of parts) {
|
|
24487
24487
|
if (current === null || current === void 0 || typeof current !== "object") {
|
|
@@ -25290,11 +25290,11 @@ var FileAssetPublisher = class {
|
|
|
25290
25290
|
*/
|
|
25291
25291
|
async uploadZip(client, dirPath, bucket, key) {
|
|
25292
25292
|
const archiver = await import("archiver");
|
|
25293
|
-
const body = await new Promise((
|
|
25293
|
+
const body = await new Promise((resolve5, reject) => {
|
|
25294
25294
|
const chunks = [];
|
|
25295
25295
|
const archive = archiver.default("zip", { zlib: { level: 9 } });
|
|
25296
25296
|
archive.on("data", (chunk) => chunks.push(chunk));
|
|
25297
|
-
archive.on("end", () =>
|
|
25297
|
+
archive.on("end", () => resolve5(Buffer.concat(chunks)));
|
|
25298
25298
|
archive.on("error", reject);
|
|
25299
25299
|
const stat = statSync2(dirPath);
|
|
25300
25300
|
if (stat.isDirectory()) {
|
|
@@ -25457,7 +25457,7 @@ var DockerAssetPublisher = class {
|
|
|
25457
25457
|
const token = Buffer.from(authData.authorizationToken, "base64").toString();
|
|
25458
25458
|
const [username, password] = token.split(":");
|
|
25459
25459
|
const endpoint = authData.proxyEndpoint || `https://${accountId}.dkr.ecr.${region}.amazonaws.com`;
|
|
25460
|
-
await new Promise((
|
|
25460
|
+
await new Promise((resolve5, reject) => {
|
|
25461
25461
|
const proc = spawn2(
|
|
25462
25462
|
"docker",
|
|
25463
25463
|
["login", "--username", username, "--password-stdin", endpoint],
|
|
@@ -25471,7 +25471,7 @@ var DockerAssetPublisher = class {
|
|
|
25471
25471
|
});
|
|
25472
25472
|
proc.on("close", (code) => {
|
|
25473
25473
|
if (code === 0) {
|
|
25474
|
-
|
|
25474
|
+
resolve5();
|
|
25475
25475
|
} else {
|
|
25476
25476
|
reject(new AssetError(`ECR login failed: ${stderr.trim()}`));
|
|
25477
25477
|
}
|
|
@@ -25524,7 +25524,7 @@ var WorkGraph = class {
|
|
|
25524
25524
|
async execute(concurrency, fn) {
|
|
25525
25525
|
const active = { "asset-build": 0, "asset-publish": 0, stack: 0 };
|
|
25526
25526
|
const errors = [];
|
|
25527
|
-
return new Promise((
|
|
25527
|
+
return new Promise((resolve5, reject) => {
|
|
25528
25528
|
const dispatch = () => {
|
|
25529
25529
|
const ready = [];
|
|
25530
25530
|
for (const node of this.nodes.values()) {
|
|
@@ -25596,7 +25596,7 @@ ${msg}`
|
|
|
25596
25596
|
);
|
|
25597
25597
|
return;
|
|
25598
25598
|
}
|
|
25599
|
-
|
|
25599
|
+
resolve5();
|
|
25600
25600
|
}
|
|
25601
25601
|
};
|
|
25602
25602
|
dispatch();
|
|
@@ -26587,7 +26587,7 @@ var LockManager = class {
|
|
|
26587
26587
|
this.logger.info(
|
|
26588
26588
|
`Stack '${stackName}' (${region}) is locked by ${lockInfo2.owner}${lockInfo2.operation ? ` (operation: ${lockInfo2.operation})` : ""}. Lock expires in ${this.formatDuration(remainingMs)}. Retrying in ${this.formatDuration(retryDelay)}... (attempt ${attempt + 1}/${maxRetries})`
|
|
26589
26589
|
);
|
|
26590
|
-
await new Promise((
|
|
26590
|
+
await new Promise((resolve5) => setTimeout(resolve5, retryDelay));
|
|
26591
26591
|
continue;
|
|
26592
26592
|
}
|
|
26593
26593
|
}
|
|
@@ -26835,11 +26835,11 @@ var DagBuilder = class {
|
|
|
26835
26835
|
const cycles = [];
|
|
26836
26836
|
const visited = /* @__PURE__ */ new Set();
|
|
26837
26837
|
const recursionStack = /* @__PURE__ */ new Set();
|
|
26838
|
-
const
|
|
26838
|
+
const path2 = [];
|
|
26839
26839
|
const dfs = (node) => {
|
|
26840
26840
|
visited.add(node);
|
|
26841
26841
|
recursionStack.add(node);
|
|
26842
|
-
|
|
26842
|
+
path2.push(node);
|
|
26843
26843
|
const successors = graph.successors(node) || [];
|
|
26844
26844
|
for (const successor of successors) {
|
|
26845
26845
|
if (!visited.has(successor)) {
|
|
@@ -26847,14 +26847,14 @@ var DagBuilder = class {
|
|
|
26847
26847
|
return true;
|
|
26848
26848
|
}
|
|
26849
26849
|
} else if (recursionStack.has(successor)) {
|
|
26850
|
-
const cycleStart =
|
|
26851
|
-
const cycle =
|
|
26850
|
+
const cycleStart = path2.indexOf(successor);
|
|
26851
|
+
const cycle = path2.slice(cycleStart);
|
|
26852
26852
|
cycle.push(successor);
|
|
26853
26853
|
cycles.push(cycle);
|
|
26854
26854
|
return true;
|
|
26855
26855
|
}
|
|
26856
26856
|
}
|
|
26857
|
-
|
|
26857
|
+
path2.pop();
|
|
26858
26858
|
recursionStack.delete(node);
|
|
26859
26859
|
return false;
|
|
26860
26860
|
};
|
|
@@ -28882,13 +28882,13 @@ var IAMInstanceProfileProvider = class {
|
|
|
28882
28882
|
properties["InstanceProfileName"] || logicalId,
|
|
28883
28883
|
{ maxLength: 128 }
|
|
28884
28884
|
);
|
|
28885
|
-
const
|
|
28885
|
+
const path2 = properties["Path"] || "/";
|
|
28886
28886
|
const roles = properties["Roles"];
|
|
28887
28887
|
try {
|
|
28888
28888
|
const response = await this.iamClient.send(
|
|
28889
28889
|
new CreateInstanceProfileCommand({
|
|
28890
28890
|
InstanceProfileName: instanceProfileName,
|
|
28891
|
-
Path:
|
|
28891
|
+
Path: path2
|
|
28892
28892
|
})
|
|
28893
28893
|
);
|
|
28894
28894
|
this.logger.debug(`Created IAM instance profile: ${instanceProfileName}`);
|
|
@@ -34968,7 +34968,7 @@ var LambdaFunctionProvider = class {
|
|
|
34968
34968
|
*/
|
|
34969
34969
|
async waitForLambdaUpdateCompleted(functionName) {
|
|
34970
34970
|
const start = Date.now();
|
|
34971
|
-
let
|
|
34971
|
+
let delay2 = this.eniWaitInitialDelayMs;
|
|
34972
34972
|
for (; ; ) {
|
|
34973
34973
|
let status;
|
|
34974
34974
|
try {
|
|
@@ -34998,9 +34998,9 @@ var LambdaFunctionProvider = class {
|
|
|
34998
34998
|
return;
|
|
34999
34999
|
}
|
|
35000
35000
|
const remaining = this.eniWaitTimeoutMs - elapsed;
|
|
35001
|
-
const sleepMs = Math.min(
|
|
35001
|
+
const sleepMs = Math.min(delay2, remaining);
|
|
35002
35002
|
await this.sleep(sleepMs);
|
|
35003
|
-
|
|
35003
|
+
delay2 = Math.min(delay2 * 2, this.eniWaitMaxDelayMs);
|
|
35004
35004
|
}
|
|
35005
35005
|
}
|
|
35006
35006
|
async cleanupLambdaEnis(functionName) {
|
|
@@ -35081,7 +35081,7 @@ var LambdaFunctionProvider = class {
|
|
|
35081
35081
|
return enis;
|
|
35082
35082
|
}
|
|
35083
35083
|
sleep(ms) {
|
|
35084
|
-
return new Promise((
|
|
35084
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
35085
35085
|
}
|
|
35086
35086
|
/**
|
|
35087
35087
|
* Build Lambda Code parameter from CDK properties
|
|
@@ -36958,7 +36958,7 @@ var DynamoDBTableProvider = class {
|
|
|
36958
36958
|
if (status !== "CREATING") {
|
|
36959
36959
|
throw new Error(`Unexpected table status: ${status}`);
|
|
36960
36960
|
}
|
|
36961
|
-
await new Promise((
|
|
36961
|
+
await new Promise((resolve5) => setTimeout(resolve5, 1e3));
|
|
36962
36962
|
}
|
|
36963
36963
|
throw new Error(`Table ${tableName} did not reach ACTIVE status within ${maxAttempts} seconds`);
|
|
36964
36964
|
}
|
|
@@ -36978,7 +36978,7 @@ var DynamoDBTableProvider = class {
|
|
|
36978
36978
|
if (status === "ACTIVE") {
|
|
36979
36979
|
return;
|
|
36980
36980
|
}
|
|
36981
|
-
await new Promise((
|
|
36981
|
+
await new Promise((resolve5) => setTimeout(resolve5, 1e3));
|
|
36982
36982
|
}
|
|
36983
36983
|
throw new Error(
|
|
36984
36984
|
`Table ${tableName} did not reach ACTIVE status within ${maxAttempts} seconds after UpdateTable`
|
|
@@ -40158,7 +40158,7 @@ var EC2Provider = class {
|
|
|
40158
40158
|
this.logger.debug(
|
|
40159
40159
|
`VPC ${physicalId} has dependencies (attempt ${attempt}/${maxAttempts}), retrying in ${attempt * 5}s...`
|
|
40160
40160
|
);
|
|
40161
|
-
await new Promise((
|
|
40161
|
+
await new Promise((resolve5) => setTimeout(resolve5, attempt * 5e3));
|
|
40162
40162
|
continue;
|
|
40163
40163
|
}
|
|
40164
40164
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -40322,7 +40322,7 @@ var EC2Provider = class {
|
|
|
40322
40322
|
this.logger.debug(
|
|
40323
40323
|
`Subnet ${physicalId} has dependencies (attempt ${attempt}/${maxAttempts}), retrying in ${attempt * 5}s...`
|
|
40324
40324
|
);
|
|
40325
|
-
await new Promise((
|
|
40325
|
+
await new Promise((resolve5) => setTimeout(resolve5, attempt * 5e3));
|
|
40326
40326
|
continue;
|
|
40327
40327
|
}
|
|
40328
40328
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -41080,7 +41080,7 @@ var EC2Provider = class {
|
|
|
41080
41080
|
this.logger.debug(
|
|
41081
41081
|
`SecurityGroup ${physicalId} has dependent objects (attempt ${attempt}/${maxAttempts}), retrying in ${attempt * 5}s...`
|
|
41082
41082
|
);
|
|
41083
|
-
await new Promise((
|
|
41083
|
+
await new Promise((resolve5) => setTimeout(resolve5, attempt * 5e3));
|
|
41084
41084
|
continue;
|
|
41085
41085
|
}
|
|
41086
41086
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -41978,7 +41978,7 @@ var EC2Provider = class {
|
|
|
41978
41978
|
const maxDelayMs = 6e4;
|
|
41979
41979
|
const startedAt = Date.now();
|
|
41980
41980
|
let attempt = 0;
|
|
41981
|
-
let
|
|
41981
|
+
let delay2 = initialDelayMs;
|
|
41982
41982
|
while (true) {
|
|
41983
41983
|
try {
|
|
41984
41984
|
return await operation();
|
|
@@ -41991,13 +41991,13 @@ var EC2Provider = class {
|
|
|
41991
41991
|
throw error;
|
|
41992
41992
|
}
|
|
41993
41993
|
attempt += 1;
|
|
41994
|
-
const sleepMs = Math.min(
|
|
41994
|
+
const sleepMs = Math.min(delay2, totalBudgetMs - elapsed);
|
|
41995
41995
|
const message = error instanceof Error ? error.message : String(error);
|
|
41996
41996
|
this.logger.debug(
|
|
41997
41997
|
`${opts.description}: dependency still mapped (attempt ${attempt}, retrying in ${sleepMs}ms): ${message}`
|
|
41998
41998
|
);
|
|
41999
41999
|
await this.sleep(sleepMs);
|
|
42000
|
-
|
|
42000
|
+
delay2 = Math.min(delay2 * 2, maxDelayMs);
|
|
42001
42001
|
}
|
|
42002
42002
|
}
|
|
42003
42003
|
}
|
|
@@ -42024,7 +42024,7 @@ var EC2Provider = class {
|
|
|
42024
42024
|
* `setTimeout` globally.
|
|
42025
42025
|
*/
|
|
42026
42026
|
sleep(ms) {
|
|
42027
|
-
return new Promise((
|
|
42027
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
42028
42028
|
}
|
|
42029
42029
|
/**
|
|
42030
42030
|
* Check if an error indicates the resource was not found
|
|
@@ -43305,13 +43305,13 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
43305
43305
|
{ key: "IdentityValidationExpression", path: "/identityValidationExpression" },
|
|
43306
43306
|
{ key: "AuthorizerResultTtlInSeconds", path: "/authorizerResultTtlInSeconds" }
|
|
43307
43307
|
];
|
|
43308
|
-
for (const { key, path } of primitiveFields) {
|
|
43308
|
+
for (const { key, path: path2 } of primitiveFields) {
|
|
43309
43309
|
const newVal = properties[key];
|
|
43310
43310
|
const prevVal = previousProperties[key];
|
|
43311
43311
|
if (newVal !== prevVal) {
|
|
43312
43312
|
patchOperations.push({
|
|
43313
43313
|
op: "replace",
|
|
43314
|
-
path,
|
|
43314
|
+
path: path2,
|
|
43315
43315
|
value: newVal !== void 0 ? String(newVal) : ""
|
|
43316
43316
|
});
|
|
43317
43317
|
}
|
|
@@ -43947,13 +43947,13 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
43947
43947
|
{ key: "OperationName", path: "/operationName" },
|
|
43948
43948
|
{ key: "RequestValidatorId", path: "/requestValidatorId" }
|
|
43949
43949
|
];
|
|
43950
|
-
for (const { key, path } of primitiveFields) {
|
|
43950
|
+
for (const { key, path: path2 } of primitiveFields) {
|
|
43951
43951
|
const newVal = properties[key];
|
|
43952
43952
|
const prevVal = previousProperties[key];
|
|
43953
43953
|
if (newVal !== prevVal) {
|
|
43954
43954
|
patchOperations.push({
|
|
43955
43955
|
op: "replace",
|
|
43956
|
-
path,
|
|
43956
|
+
path: path2,
|
|
43957
43957
|
value: newVal !== void 0 ? String(newVal) : ""
|
|
43958
43958
|
});
|
|
43959
43959
|
}
|
|
@@ -44124,7 +44124,7 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
44124
44124
|
* Sleep for specified milliseconds
|
|
44125
44125
|
*/
|
|
44126
44126
|
sleep(ms) {
|
|
44127
|
-
return new Promise((
|
|
44127
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
44128
44128
|
}
|
|
44129
44129
|
/**
|
|
44130
44130
|
* Convert CloudFormation Tags (Array<{Key, Value}>) to SDK tags (Record<string, string>).
|
|
@@ -44326,12 +44326,12 @@ var ApiGatewayProvider = class _ApiGatewayProvider {
|
|
|
44326
44326
|
function appendMapPatchOps(ops, basePath, next, prev) {
|
|
44327
44327
|
const escape = (k) => k.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
44328
44328
|
for (const [key, val] of Object.entries(next)) {
|
|
44329
|
-
const
|
|
44329
|
+
const path2 = `${basePath}/${escape(key)}`;
|
|
44330
44330
|
const stringValue = String(val);
|
|
44331
44331
|
if (!(key in prev)) {
|
|
44332
|
-
ops.push({ op: "add", path, value: stringValue });
|
|
44332
|
+
ops.push({ op: "add", path: path2, value: stringValue });
|
|
44333
44333
|
} else if (String(prev[key]) !== stringValue) {
|
|
44334
|
-
ops.push({ op: "replace", path, value: stringValue });
|
|
44334
|
+
ops.push({ op: "replace", path: path2, value: stringValue });
|
|
44335
44335
|
}
|
|
44336
44336
|
}
|
|
44337
44337
|
for (const key of Object.keys(prev)) {
|
|
@@ -45984,7 +45984,7 @@ var CloudFrontDistributionProvider = class {
|
|
|
45984
45984
|
*/
|
|
45985
45985
|
async waitForDistributionStable(distributionId, expectedEnabled) {
|
|
45986
45986
|
const maxAttempts = 60;
|
|
45987
|
-
let
|
|
45987
|
+
let delay2 = 5e3;
|
|
45988
45988
|
const maxDelay = 3e4;
|
|
45989
45989
|
let interrupted = false;
|
|
45990
45990
|
const sigintHandler = () => {
|
|
@@ -46014,11 +46014,11 @@ var CloudFrontDistributionProvider = class {
|
|
|
46014
46014
|
this.logger.debug(
|
|
46015
46015
|
`Distribution ${distributionId} status: ${status}, enabled: ${enabled}` + (expectedEnabled === void 0 ? "" : ` (waiting for Enabled=${expectedEnabled})`) + ` (attempt ${attempt}/${maxAttempts})`
|
|
46016
46016
|
);
|
|
46017
|
-
const sleepEnd = Date.now() +
|
|
46017
|
+
const sleepEnd = Date.now() + delay2;
|
|
46018
46018
|
while (Date.now() < sleepEnd && !interrupted) {
|
|
46019
|
-
await new Promise((
|
|
46019
|
+
await new Promise((resolve5) => setTimeout(resolve5, 1e3));
|
|
46020
46020
|
}
|
|
46021
|
-
|
|
46021
|
+
delay2 = Math.min(delay2 * 1.5, maxDelay);
|
|
46022
46022
|
}
|
|
46023
46023
|
this.logger.debug(
|
|
46024
46024
|
`Distribution ${distributionId} did not reach stable state within timeout, proceeding with next step`
|
|
@@ -46136,17 +46136,17 @@ var CloudFrontDistributionProvider = class {
|
|
|
46136
46136
|
/**
|
|
46137
46137
|
* Apply Quantity wrapping at a nested path (e.g., "ForwardedValues.Headers").
|
|
46138
46138
|
*/
|
|
46139
|
-
applyQuantityAtPath(obj,
|
|
46140
|
-
if (
|
|
46139
|
+
applyQuantityAtPath(obj, path2) {
|
|
46140
|
+
if (path2.length === 0)
|
|
46141
46141
|
return;
|
|
46142
|
-
if (
|
|
46143
|
-
const key =
|
|
46142
|
+
if (path2.length === 1) {
|
|
46143
|
+
const key = path2[0];
|
|
46144
46144
|
if (obj[key] !== void 0) {
|
|
46145
46145
|
obj[key] = this.wrapWithQuantity(obj[key]);
|
|
46146
46146
|
}
|
|
46147
46147
|
return;
|
|
46148
46148
|
}
|
|
46149
|
-
const [head, ...rest] =
|
|
46149
|
+
const [head, ...rest] = path2;
|
|
46150
46150
|
const headKey = head;
|
|
46151
46151
|
if (obj[headKey] && typeof obj[headKey] === "object") {
|
|
46152
46152
|
const nested = { ...obj[headKey] };
|
|
@@ -49750,15 +49750,15 @@ var RDSProvider = class {
|
|
|
49750
49750
|
*/
|
|
49751
49751
|
async waitForClusterAvailable(dbClusterIdentifier, maxWaitMs = 6e5) {
|
|
49752
49752
|
const startTime = Date.now();
|
|
49753
|
-
let
|
|
49753
|
+
let delay2 = 5e3;
|
|
49754
49754
|
while (Date.now() - startTime < maxWaitMs) {
|
|
49755
49755
|
const cluster = await this.describeDBCluster(dbClusterIdentifier);
|
|
49756
49756
|
const status = cluster?.Status;
|
|
49757
49757
|
this.logger.debug(`DBCluster ${dbClusterIdentifier} status: ${status}`);
|
|
49758
49758
|
if (status === "available")
|
|
49759
49759
|
return;
|
|
49760
|
-
await this.sleep(
|
|
49761
|
-
|
|
49760
|
+
await this.sleep(delay2);
|
|
49761
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
49762
49762
|
}
|
|
49763
49763
|
throw new Error(`Timed out waiting for DBCluster ${dbClusterIdentifier} to become available`);
|
|
49764
49764
|
}
|
|
@@ -49767,7 +49767,7 @@ var RDSProvider = class {
|
|
|
49767
49767
|
*/
|
|
49768
49768
|
async waitForClusterDeleted(dbClusterIdentifier, maxWaitMs = 6e5) {
|
|
49769
49769
|
const startTime = Date.now();
|
|
49770
|
-
let
|
|
49770
|
+
let delay2 = 5e3;
|
|
49771
49771
|
while (Date.now() - startTime < maxWaitMs) {
|
|
49772
49772
|
try {
|
|
49773
49773
|
const cluster = await this.describeDBCluster(dbClusterIdentifier);
|
|
@@ -49781,8 +49781,8 @@ var RDSProvider = class {
|
|
|
49781
49781
|
}
|
|
49782
49782
|
throw error;
|
|
49783
49783
|
}
|
|
49784
|
-
await this.sleep(
|
|
49785
|
-
|
|
49784
|
+
await this.sleep(delay2);
|
|
49785
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
49786
49786
|
}
|
|
49787
49787
|
throw new Error(`Timed out waiting for DBCluster ${dbClusterIdentifier} to be deleted`);
|
|
49788
49788
|
}
|
|
@@ -49791,15 +49791,15 @@ var RDSProvider = class {
|
|
|
49791
49791
|
*/
|
|
49792
49792
|
async waitForInstanceAvailable(dbInstanceIdentifier, maxWaitMs = 6e5) {
|
|
49793
49793
|
const startTime = Date.now();
|
|
49794
|
-
let
|
|
49794
|
+
let delay2 = 1e4;
|
|
49795
49795
|
while (Date.now() - startTime < maxWaitMs) {
|
|
49796
49796
|
const instance = await this.describeDBInstance(dbInstanceIdentifier);
|
|
49797
49797
|
const status = instance?.DBInstanceStatus;
|
|
49798
49798
|
this.logger.debug(`DBInstance ${dbInstanceIdentifier} status: ${status}`);
|
|
49799
49799
|
if (status === "available")
|
|
49800
49800
|
return;
|
|
49801
|
-
await this.sleep(
|
|
49802
|
-
|
|
49801
|
+
await this.sleep(delay2);
|
|
49802
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
49803
49803
|
}
|
|
49804
49804
|
throw new Error(`Timed out waiting for DBInstance ${dbInstanceIdentifier} to become available`);
|
|
49805
49805
|
}
|
|
@@ -49808,7 +49808,7 @@ var RDSProvider = class {
|
|
|
49808
49808
|
*/
|
|
49809
49809
|
async waitForInstanceDeleted(dbInstanceIdentifier, maxWaitMs = 6e5) {
|
|
49810
49810
|
const startTime = Date.now();
|
|
49811
|
-
let
|
|
49811
|
+
let delay2 = 1e4;
|
|
49812
49812
|
while (Date.now() - startTime < maxWaitMs) {
|
|
49813
49813
|
try {
|
|
49814
49814
|
const instance = await this.describeDBInstance(dbInstanceIdentifier);
|
|
@@ -49822,13 +49822,13 @@ var RDSProvider = class {
|
|
|
49822
49822
|
}
|
|
49823
49823
|
throw error;
|
|
49824
49824
|
}
|
|
49825
|
-
await this.sleep(
|
|
49826
|
-
|
|
49825
|
+
await this.sleep(delay2);
|
|
49826
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
49827
49827
|
}
|
|
49828
49828
|
throw new Error(`Timed out waiting for DBInstance ${dbInstanceIdentifier} to be deleted`);
|
|
49829
49829
|
}
|
|
49830
49830
|
sleep(ms) {
|
|
49831
|
-
return new Promise((
|
|
49831
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
49832
49832
|
}
|
|
49833
49833
|
/**
|
|
49834
49834
|
* Adopt an existing RDS resource into cdkd state.
|
|
@@ -50734,15 +50734,15 @@ var DocDBProvider = class {
|
|
|
50734
50734
|
*/
|
|
50735
50735
|
async waitForClusterAvailable(dbClusterIdentifier, maxWaitMs = 18e5) {
|
|
50736
50736
|
const startTime = Date.now();
|
|
50737
|
-
let
|
|
50737
|
+
let delay2 = 5e3;
|
|
50738
50738
|
while (Date.now() - startTime < maxWaitMs) {
|
|
50739
50739
|
const cluster = await this.describeDBCluster(dbClusterIdentifier);
|
|
50740
50740
|
const status = cluster?.Status;
|
|
50741
50741
|
this.logger.debug(`DocDB DBCluster ${dbClusterIdentifier} status: ${status}`);
|
|
50742
50742
|
if (status === "available")
|
|
50743
50743
|
return;
|
|
50744
|
-
await this.sleep(
|
|
50745
|
-
|
|
50744
|
+
await this.sleep(delay2);
|
|
50745
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
50746
50746
|
}
|
|
50747
50747
|
throw new Error(
|
|
50748
50748
|
`Timed out waiting for DocDB DBCluster ${dbClusterIdentifier} to become available`
|
|
@@ -50753,7 +50753,7 @@ var DocDBProvider = class {
|
|
|
50753
50753
|
*/
|
|
50754
50754
|
async waitForClusterDeleted(dbClusterIdentifier, maxWaitMs = 18e5) {
|
|
50755
50755
|
const startTime = Date.now();
|
|
50756
|
-
let
|
|
50756
|
+
let delay2 = 5e3;
|
|
50757
50757
|
while (Date.now() - startTime < maxWaitMs) {
|
|
50758
50758
|
try {
|
|
50759
50759
|
const cluster = await this.describeDBCluster(dbClusterIdentifier);
|
|
@@ -50767,8 +50767,8 @@ var DocDBProvider = class {
|
|
|
50767
50767
|
}
|
|
50768
50768
|
throw error;
|
|
50769
50769
|
}
|
|
50770
|
-
await this.sleep(
|
|
50771
|
-
|
|
50770
|
+
await this.sleep(delay2);
|
|
50771
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
50772
50772
|
}
|
|
50773
50773
|
throw new Error(`Timed out waiting for DocDB DBCluster ${dbClusterIdentifier} to be deleted`);
|
|
50774
50774
|
}
|
|
@@ -50777,15 +50777,15 @@ var DocDBProvider = class {
|
|
|
50777
50777
|
*/
|
|
50778
50778
|
async waitForInstanceAvailable(dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
50779
50779
|
const startTime = Date.now();
|
|
50780
|
-
let
|
|
50780
|
+
let delay2 = 1e4;
|
|
50781
50781
|
while (Date.now() - startTime < maxWaitMs) {
|
|
50782
50782
|
const instance = await this.describeDBInstance(dbInstanceIdentifier);
|
|
50783
50783
|
const status = instance?.DBInstanceStatus;
|
|
50784
50784
|
this.logger.debug(`DocDB DBInstance ${dbInstanceIdentifier} status: ${status}`);
|
|
50785
50785
|
if (status === "available")
|
|
50786
50786
|
return;
|
|
50787
|
-
await this.sleep(
|
|
50788
|
-
|
|
50787
|
+
await this.sleep(delay2);
|
|
50788
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
50789
50789
|
}
|
|
50790
50790
|
throw new Error(
|
|
50791
50791
|
`Timed out waiting for DocDB DBInstance ${dbInstanceIdentifier} to become available`
|
|
@@ -50793,7 +50793,7 @@ var DocDBProvider = class {
|
|
|
50793
50793
|
}
|
|
50794
50794
|
async waitForInstanceDeleted(dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
50795
50795
|
const startTime = Date.now();
|
|
50796
|
-
let
|
|
50796
|
+
let delay2 = 1e4;
|
|
50797
50797
|
while (Date.now() - startTime < maxWaitMs) {
|
|
50798
50798
|
try {
|
|
50799
50799
|
const instance = await this.describeDBInstance(dbInstanceIdentifier);
|
|
@@ -50807,13 +50807,13 @@ var DocDBProvider = class {
|
|
|
50807
50807
|
}
|
|
50808
50808
|
throw error;
|
|
50809
50809
|
}
|
|
50810
|
-
await this.sleep(
|
|
50811
|
-
|
|
50810
|
+
await this.sleep(delay2);
|
|
50811
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
50812
50812
|
}
|
|
50813
50813
|
throw new Error(`Timed out waiting for DocDB DBInstance ${dbInstanceIdentifier} to be deleted`);
|
|
50814
50814
|
}
|
|
50815
50815
|
sleep(ms) {
|
|
50816
|
-
return new Promise((
|
|
50816
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
50817
50817
|
}
|
|
50818
50818
|
/**
|
|
50819
50819
|
* Adopt an existing DocDB resource into cdkd state.
|
|
@@ -51722,15 +51722,15 @@ var NeptuneProvider = class {
|
|
|
51722
51722
|
*/
|
|
51723
51723
|
async waitForClusterAvailable(dbClusterIdentifier, maxWaitMs = 18e5) {
|
|
51724
51724
|
const startTime = Date.now();
|
|
51725
|
-
let
|
|
51725
|
+
let delay2 = 5e3;
|
|
51726
51726
|
while (Date.now() - startTime < maxWaitMs) {
|
|
51727
51727
|
const cluster = await this.describeDBCluster(dbClusterIdentifier);
|
|
51728
51728
|
const status = cluster?.Status;
|
|
51729
51729
|
this.logger.debug(`Neptune DBCluster ${dbClusterIdentifier} status: ${status}`);
|
|
51730
51730
|
if (status === "available")
|
|
51731
51731
|
return;
|
|
51732
|
-
await this.sleep(
|
|
51733
|
-
|
|
51732
|
+
await this.sleep(delay2);
|
|
51733
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
51734
51734
|
}
|
|
51735
51735
|
throw new Error(
|
|
51736
51736
|
`Timed out waiting for Neptune DBCluster ${dbClusterIdentifier} to become available`
|
|
@@ -51741,7 +51741,7 @@ var NeptuneProvider = class {
|
|
|
51741
51741
|
*/
|
|
51742
51742
|
async waitForClusterDeleted(dbClusterIdentifier, maxWaitMs = 18e5) {
|
|
51743
51743
|
const startTime = Date.now();
|
|
51744
|
-
let
|
|
51744
|
+
let delay2 = 5e3;
|
|
51745
51745
|
while (Date.now() - startTime < maxWaitMs) {
|
|
51746
51746
|
try {
|
|
51747
51747
|
const cluster = await this.describeDBCluster(dbClusterIdentifier);
|
|
@@ -51755,8 +51755,8 @@ var NeptuneProvider = class {
|
|
|
51755
51755
|
}
|
|
51756
51756
|
throw error;
|
|
51757
51757
|
}
|
|
51758
|
-
await this.sleep(
|
|
51759
|
-
|
|
51758
|
+
await this.sleep(delay2);
|
|
51759
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
51760
51760
|
}
|
|
51761
51761
|
throw new Error(`Timed out waiting for Neptune DBCluster ${dbClusterIdentifier} to be deleted`);
|
|
51762
51762
|
}
|
|
@@ -51765,15 +51765,15 @@ var NeptuneProvider = class {
|
|
|
51765
51765
|
*/
|
|
51766
51766
|
async waitForInstanceAvailable(dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
51767
51767
|
const startTime = Date.now();
|
|
51768
|
-
let
|
|
51768
|
+
let delay2 = 1e4;
|
|
51769
51769
|
while (Date.now() - startTime < maxWaitMs) {
|
|
51770
51770
|
const instance = await this.describeDBInstance(dbInstanceIdentifier);
|
|
51771
51771
|
const status = instance?.DBInstanceStatus;
|
|
51772
51772
|
this.logger.debug(`Neptune DBInstance ${dbInstanceIdentifier} status: ${status}`);
|
|
51773
51773
|
if (status === "available")
|
|
51774
51774
|
return;
|
|
51775
|
-
await this.sleep(
|
|
51776
|
-
|
|
51775
|
+
await this.sleep(delay2);
|
|
51776
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
51777
51777
|
}
|
|
51778
51778
|
throw new Error(
|
|
51779
51779
|
`Timed out waiting for Neptune DBInstance ${dbInstanceIdentifier} to become available`
|
|
@@ -51781,7 +51781,7 @@ var NeptuneProvider = class {
|
|
|
51781
51781
|
}
|
|
51782
51782
|
async waitForInstanceDeleted(dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
51783
51783
|
const startTime = Date.now();
|
|
51784
|
-
let
|
|
51784
|
+
let delay2 = 1e4;
|
|
51785
51785
|
while (Date.now() - startTime < maxWaitMs) {
|
|
51786
51786
|
try {
|
|
51787
51787
|
const instance = await this.describeDBInstance(dbInstanceIdentifier);
|
|
@@ -51795,15 +51795,15 @@ var NeptuneProvider = class {
|
|
|
51795
51795
|
}
|
|
51796
51796
|
throw error;
|
|
51797
51797
|
}
|
|
51798
|
-
await this.sleep(
|
|
51799
|
-
|
|
51798
|
+
await this.sleep(delay2);
|
|
51799
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
51800
51800
|
}
|
|
51801
51801
|
throw new Error(
|
|
51802
51802
|
`Timed out waiting for Neptune DBInstance ${dbInstanceIdentifier} to be deleted`
|
|
51803
51803
|
);
|
|
51804
51804
|
}
|
|
51805
51805
|
sleep(ms) {
|
|
51806
|
-
return new Promise((
|
|
51806
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
51807
51807
|
}
|
|
51808
51808
|
/**
|
|
51809
51809
|
* Adopt an existing Neptune resource into cdkd state.
|
|
@@ -54306,15 +54306,15 @@ var ElastiCacheProvider = class {
|
|
|
54306
54306
|
*/
|
|
54307
54307
|
async waitForClusterAvailable(cacheClusterId, maxWaitMs = 6e5) {
|
|
54308
54308
|
const startTime = Date.now();
|
|
54309
|
-
let
|
|
54309
|
+
let delay2 = 1e4;
|
|
54310
54310
|
while (Date.now() - startTime < maxWaitMs) {
|
|
54311
54311
|
const cluster = await this.describeCacheCluster(cacheClusterId);
|
|
54312
54312
|
const status = cluster?.CacheClusterStatus;
|
|
54313
54313
|
this.logger.debug(`CacheCluster ${cacheClusterId} status: ${status}`);
|
|
54314
54314
|
if (status === "available")
|
|
54315
54315
|
return;
|
|
54316
|
-
await this.sleep(
|
|
54317
|
-
|
|
54316
|
+
await this.sleep(delay2);
|
|
54317
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
54318
54318
|
}
|
|
54319
54319
|
throw new Error(`Timed out waiting for CacheCluster ${cacheClusterId} to become available`);
|
|
54320
54320
|
}
|
|
@@ -54323,7 +54323,7 @@ var ElastiCacheProvider = class {
|
|
|
54323
54323
|
*/
|
|
54324
54324
|
async waitForClusterDeleted(cacheClusterId, maxWaitMs = 6e5) {
|
|
54325
54325
|
const startTime = Date.now();
|
|
54326
|
-
let
|
|
54326
|
+
let delay2 = 1e4;
|
|
54327
54327
|
while (Date.now() - startTime < maxWaitMs) {
|
|
54328
54328
|
try {
|
|
54329
54329
|
const cluster = await this.describeCacheCluster(cacheClusterId);
|
|
@@ -54337,13 +54337,13 @@ var ElastiCacheProvider = class {
|
|
|
54337
54337
|
}
|
|
54338
54338
|
throw error;
|
|
54339
54339
|
}
|
|
54340
|
-
await this.sleep(
|
|
54341
|
-
|
|
54340
|
+
await this.sleep(delay2);
|
|
54341
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
54342
54342
|
}
|
|
54343
54343
|
throw new Error(`Timed out waiting for CacheCluster ${cacheClusterId} to be deleted`);
|
|
54344
54344
|
}
|
|
54345
54345
|
sleep(ms) {
|
|
54346
|
-
return new Promise((
|
|
54346
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
54347
54347
|
}
|
|
54348
54348
|
/**
|
|
54349
54349
|
* Read the AWS-current ElastiCache resource configuration in CFn-property shape.
|
|
@@ -55039,7 +55039,7 @@ var ServiceDiscoveryProvider = class {
|
|
|
55039
55039
|
async pollOperation(operationId, logicalId, resourceType) {
|
|
55040
55040
|
const client = this.getClient();
|
|
55041
55041
|
const maxAttempts = 60;
|
|
55042
|
-
let
|
|
55042
|
+
let delay2 = 1e3;
|
|
55043
55043
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
55044
55044
|
const result = await client.send(new GetOperationCommand({ OperationId: operationId }));
|
|
55045
55045
|
const status = result.Operation?.Status;
|
|
@@ -55058,8 +55058,8 @@ var ServiceDiscoveryProvider = class {
|
|
|
55058
55058
|
logicalId
|
|
55059
55059
|
);
|
|
55060
55060
|
}
|
|
55061
|
-
await new Promise((
|
|
55062
|
-
|
|
55061
|
+
await new Promise((resolve5) => setTimeout(resolve5, delay2));
|
|
55062
|
+
delay2 = Math.min(delay2 * 2, 1e4);
|
|
55063
55063
|
}
|
|
55064
55064
|
throw new ProvisioningError(
|
|
55065
55065
|
`Operation timed out for ${logicalId} (operationId: ${operationId})`,
|
|
@@ -59583,7 +59583,7 @@ var KinesisStreamProvider = class {
|
|
|
59583
59583
|
if (status !== "CREATING" && status !== "UPDATING") {
|
|
59584
59584
|
throw new Error(`Unexpected stream status: ${status}`);
|
|
59585
59585
|
}
|
|
59586
|
-
await new Promise((
|
|
59586
|
+
await new Promise((resolve5) => setTimeout(resolve5, 2e3));
|
|
59587
59587
|
}
|
|
59588
59588
|
throw new Error(
|
|
59589
59589
|
`Stream ${streamName} did not reach ACTIVE status within ${maxAttempts * 2} seconds`
|
|
@@ -59916,7 +59916,7 @@ var KinesisStreamConsumerProvider = class {
|
|
|
59916
59916
|
if (status !== "CREATING") {
|
|
59917
59917
|
throw new Error(`Unexpected consumer status: ${status}`);
|
|
59918
59918
|
}
|
|
59919
|
-
await new Promise((
|
|
59919
|
+
await new Promise((resolve5) => setTimeout(resolve5, 1e3));
|
|
59920
59920
|
}
|
|
59921
59921
|
throw new Error(
|
|
59922
59922
|
`Consumer ${consumerArn} did not reach ACTIVE status within ${maxAttempts} seconds`
|
|
@@ -60221,7 +60221,7 @@ var EFSProvider = class {
|
|
|
60221
60221
|
this.logger.debug(
|
|
60222
60222
|
`FileSystem ${fileSystemId} state: ${fs?.LifeCycleState ?? "unknown"}, waiting...`
|
|
60223
60223
|
);
|
|
60224
|
-
await new Promise((
|
|
60224
|
+
await new Promise((resolve5) => setTimeout(resolve5, pollIntervalMs));
|
|
60225
60225
|
}
|
|
60226
60226
|
throw new ProvisioningError(
|
|
60227
60227
|
`Timed out waiting for EFS FileSystem ${fileSystemId} to become available (60s)`,
|
|
@@ -60299,7 +60299,7 @@ var EFSProvider = class {
|
|
|
60299
60299
|
this.logger.debug(
|
|
60300
60300
|
`MountTarget ${mountTargetId} state: ${mountTarget?.LifeCycleState ?? "unknown"}, waiting...`
|
|
60301
60301
|
);
|
|
60302
|
-
await new Promise((
|
|
60302
|
+
await new Promise((resolve5) => setTimeout(resolve5, pollIntervalMs));
|
|
60303
60303
|
}
|
|
60304
60304
|
throw new ProvisioningError(
|
|
60305
60305
|
`Timed out waiting for EFS MountTarget ${mountTargetId} to become available (120s)`,
|
|
@@ -60365,7 +60365,7 @@ var EFSProvider = class {
|
|
|
60365
60365
|
}
|
|
60366
60366
|
throw error;
|
|
60367
60367
|
}
|
|
60368
|
-
await new Promise((
|
|
60368
|
+
await new Promise((resolve5) => setTimeout(resolve5, pollIntervalMs));
|
|
60369
60369
|
}
|
|
60370
60370
|
this.logger.warn(
|
|
60371
60371
|
`Timed out waiting for EFS MountTarget ${mountTargetId} deletion for ${logicalId} (120s)`
|
|
@@ -61323,7 +61323,7 @@ var FirehoseProvider = class {
|
|
|
61323
61323
|
this.logger.debug(
|
|
61324
61324
|
`Firehose ${logicalId} status: ${status} (attempt ${attempt}/${maxAttempts})`
|
|
61325
61325
|
);
|
|
61326
|
-
await new Promise((
|
|
61326
|
+
await new Promise((resolve5) => setTimeout(resolve5, 2e3));
|
|
61327
61327
|
}
|
|
61328
61328
|
this.logger.warn(`Firehose ${logicalId} did not reach ACTIVE after ${maxAttempts} attempts`);
|
|
61329
61329
|
}
|
|
@@ -64774,7 +64774,7 @@ var ASGProvider = class {
|
|
|
64774
64774
|
}
|
|
64775
64775
|
async waitForGroupDeleted(groupName, maxWaitMs = 9e5) {
|
|
64776
64776
|
const startTime = Date.now();
|
|
64777
|
-
let
|
|
64777
|
+
let delay2 = 5e3;
|
|
64778
64778
|
while (Date.now() - startTime < maxWaitMs) {
|
|
64779
64779
|
try {
|
|
64780
64780
|
const group = await this.describeGroup(groupName);
|
|
@@ -64785,15 +64785,15 @@ var ASGProvider = class {
|
|
|
64785
64785
|
return;
|
|
64786
64786
|
throw error;
|
|
64787
64787
|
}
|
|
64788
|
-
await this.sleep(
|
|
64789
|
-
|
|
64788
|
+
await this.sleep(delay2);
|
|
64789
|
+
delay2 = Math.min(delay2 * 2, 3e4);
|
|
64790
64790
|
}
|
|
64791
64791
|
throw new Error(
|
|
64792
64792
|
`Timed out waiting for AutoScalingGroup ${groupName} to be deleted (15 minute cap)`
|
|
64793
64793
|
);
|
|
64794
64794
|
}
|
|
64795
64795
|
sleep(ms) {
|
|
64796
|
-
return new Promise((
|
|
64796
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
64797
64797
|
}
|
|
64798
64798
|
// ─── Sub-shape diff helpers ───────────────────────────────────────
|
|
64799
64799
|
// Each helper is a no-op when before/after JSON is identical (the cheap
|
|
@@ -65714,29 +65714,29 @@ function calculateResourceDrift(stateProperties, awsProperties, options) {
|
|
|
65714
65714
|
}
|
|
65715
65715
|
return drifts;
|
|
65716
65716
|
}
|
|
65717
|
-
function isIgnoredPath(
|
|
65717
|
+
function isIgnoredPath(path2, ignorePaths) {
|
|
65718
65718
|
for (const entry of ignorePaths) {
|
|
65719
|
-
if (
|
|
65719
|
+
if (path2 === entry)
|
|
65720
65720
|
return true;
|
|
65721
|
-
if (
|
|
65721
|
+
if (path2.startsWith(`${entry}.`))
|
|
65722
65722
|
return true;
|
|
65723
65723
|
}
|
|
65724
65724
|
return false;
|
|
65725
65725
|
}
|
|
65726
|
-
function diffAt(
|
|
65726
|
+
function diffAt(path2, stateValue, awsValue, out, ignorePaths, unionWalkObjects) {
|
|
65727
65727
|
if (deepEqual(stateValue, awsValue))
|
|
65728
65728
|
return;
|
|
65729
65729
|
if (isPlainObject(stateValue) && isPlainObject(awsValue) && !Array.isArray(stateValue) && !Array.isArray(awsValue)) {
|
|
65730
65730
|
const keys = unionWalkObjects ? /* @__PURE__ */ new Set([...Object.keys(stateValue), ...Object.keys(awsValue)]) : Object.keys(stateValue);
|
|
65731
65731
|
for (const key of keys) {
|
|
65732
|
-
const childPath = `${
|
|
65732
|
+
const childPath = `${path2}.${key}`;
|
|
65733
65733
|
if (isIgnoredPath(childPath, ignorePaths))
|
|
65734
65734
|
continue;
|
|
65735
65735
|
diffAt(childPath, stateValue[key], awsValue[key], out, ignorePaths, unionWalkObjects);
|
|
65736
65736
|
}
|
|
65737
65737
|
return;
|
|
65738
65738
|
}
|
|
65739
|
-
out.push({ path, stateValue, awsValue });
|
|
65739
|
+
out.push({ path: path2, stateValue, awsValue });
|
|
65740
65740
|
}
|
|
65741
65741
|
function deepEqual(a, b) {
|
|
65742
65742
|
if (a === b)
|
|
@@ -66139,11 +66139,11 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
|
|
|
66139
66139
|
};
|
|
66140
66140
|
});
|
|
66141
66141
|
}
|
|
66142
|
-
function setAtPath(target,
|
|
66143
|
-
if (
|
|
66142
|
+
function setAtPath(target, path2, value) {
|
|
66143
|
+
if (path2.length === 0) {
|
|
66144
66144
|
return;
|
|
66145
66145
|
}
|
|
66146
|
-
const segments =
|
|
66146
|
+
const segments = path2.split(".");
|
|
66147
66147
|
let cursor = target;
|
|
66148
66148
|
for (let i = 0; i < segments.length - 1; i++) {
|
|
66149
66149
|
const key = segments[i];
|
|
@@ -66729,11 +66729,11 @@ Acquiring lock for stack ${stackName}...`);
|
|
|
66729
66729
|
const isRetryable = msg.includes("Too Many Requests") || msg.includes("has dependencies") || msg.includes("can't be deleted since") || msg.includes("DependencyViolation");
|
|
66730
66730
|
if (!isRetryable || attempt >= maxAttempts)
|
|
66731
66731
|
break;
|
|
66732
|
-
const
|
|
66732
|
+
const delay2 = 5e3 * Math.pow(2, attempt);
|
|
66733
66733
|
logger.debug(
|
|
66734
|
-
` \u23F3 Retrying delete ${logicalId} in ${
|
|
66734
|
+
` \u23F3 Retrying delete ${logicalId} in ${delay2 / 1e3}s (attempt ${attempt + 1}/${maxAttempts})`
|
|
66735
66735
|
);
|
|
66736
|
-
await new Promise((
|
|
66736
|
+
await new Promise((resolve5) => setTimeout(resolve5, delay2));
|
|
66737
66737
|
}
|
|
66738
66738
|
}
|
|
66739
66739
|
if (lastDeleteError)
|
|
@@ -67043,19 +67043,19 @@ function buildCdkPathIndex(template) {
|
|
|
67043
67043
|
for (const [logicalId, resource] of Object.entries(template.Resources)) {
|
|
67044
67044
|
if (resource.Type === "AWS::CDK::Metadata")
|
|
67045
67045
|
continue;
|
|
67046
|
-
const
|
|
67047
|
-
if (
|
|
67048
|
-
index.set(
|
|
67046
|
+
const path2 = readCdkPath(resource);
|
|
67047
|
+
if (path2)
|
|
67048
|
+
index.set(path2, logicalId);
|
|
67049
67049
|
}
|
|
67050
67050
|
return index;
|
|
67051
67051
|
}
|
|
67052
67052
|
function resolveCdkPathToLogicalIds(input, index) {
|
|
67053
67053
|
const seen = /* @__PURE__ */ new Map();
|
|
67054
67054
|
const prefix = `${input}/`;
|
|
67055
|
-
for (const [
|
|
67056
|
-
if (
|
|
67055
|
+
for (const [path2, logicalId] of index) {
|
|
67056
|
+
if (path2 === input || path2.startsWith(prefix)) {
|
|
67057
67057
|
if (!seen.has(logicalId))
|
|
67058
|
-
seen.set(logicalId,
|
|
67058
|
+
seen.set(logicalId, path2);
|
|
67059
67059
|
}
|
|
67060
67060
|
}
|
|
67061
67061
|
return [...seen.entries()].map(([logicalId, cdkPath]) => ({ logicalId, cdkPath }));
|
|
@@ -69962,6 +69962,718 @@ async function captureObservedForImportedResources(stackState, providerRegistry,
|
|
|
69962
69962
|
);
|
|
69963
69963
|
}
|
|
69964
69964
|
|
|
69965
|
+
// src/cli/commands/local-invoke.ts
|
|
69966
|
+
import { mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
|
|
69967
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
69968
|
+
import * as path from "node:path";
|
|
69969
|
+
import { Command as Command14, Option as Option7 } from "commander";
|
|
69970
|
+
|
|
69971
|
+
// src/local-invoke/lambda-resolver.ts
|
|
69972
|
+
import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
|
|
69973
|
+
import { dirname, isAbsolute, resolve as resolve4 } from "node:path";
|
|
69974
|
+
var LocalInvokeResolutionError = class _LocalInvokeResolutionError extends Error {
|
|
69975
|
+
constructor(message) {
|
|
69976
|
+
super(message);
|
|
69977
|
+
this.name = "LocalInvokeResolutionError";
|
|
69978
|
+
Object.setPrototypeOf(this, _LocalInvokeResolutionError.prototype);
|
|
69979
|
+
}
|
|
69980
|
+
};
|
|
69981
|
+
function parseTarget(target) {
|
|
69982
|
+
if (typeof target !== "string" || target.length === 0) {
|
|
69983
|
+
throw new LocalInvokeResolutionError(
|
|
69984
|
+
"Empty target. Pass a CDK display path (e.g. 'MyStack/MyApi/Handler') or stack-qualified logical ID (e.g. 'MyStack:MyApiHandler1234ABCD')."
|
|
69985
|
+
);
|
|
69986
|
+
}
|
|
69987
|
+
const colonIdx = target.indexOf(":");
|
|
69988
|
+
const slashIdx = target.indexOf("/");
|
|
69989
|
+
if (colonIdx > 0 && (slashIdx === -1 || colonIdx < slashIdx)) {
|
|
69990
|
+
const stackPattern = target.substring(0, colonIdx);
|
|
69991
|
+
const pathOrId = target.substring(colonIdx + 1);
|
|
69992
|
+
if (pathOrId.length === 0) {
|
|
69993
|
+
throw new LocalInvokeResolutionError(`Target '${target}' has no logical ID after ':'.`);
|
|
69994
|
+
}
|
|
69995
|
+
return { stackPattern, pathOrId, isPath: pathOrId.includes("/") };
|
|
69996
|
+
}
|
|
69997
|
+
if (slashIdx > 0) {
|
|
69998
|
+
return { stackPattern: target.substring(0, slashIdx), pathOrId: target, isPath: true };
|
|
69999
|
+
}
|
|
70000
|
+
return { stackPattern: null, pathOrId: target, isPath: false };
|
|
70001
|
+
}
|
|
70002
|
+
function resolveLambdaTarget(target, stacks) {
|
|
70003
|
+
if (stacks.length === 0) {
|
|
70004
|
+
throw new LocalInvokeResolutionError("No stacks found in the synthesized assembly.");
|
|
70005
|
+
}
|
|
70006
|
+
const parsed = parseTarget(target);
|
|
70007
|
+
const stack = pickStack(parsed, stacks);
|
|
70008
|
+
const template = stack.template;
|
|
70009
|
+
const resources = template.Resources ?? {};
|
|
70010
|
+
let match;
|
|
70011
|
+
if (parsed.isPath) {
|
|
70012
|
+
const index = buildCdkPathIndex(template);
|
|
70013
|
+
const resolvedPaths = resolveCdkPathToLogicalIds(parsed.pathOrId, index);
|
|
70014
|
+
const lambdaMatches = resolvedPaths.filter(
|
|
70015
|
+
({ logicalId: logicalId2 }) => resources[logicalId2]?.Type === "AWS::Lambda::Function"
|
|
70016
|
+
);
|
|
70017
|
+
if (lambdaMatches.length === 0) {
|
|
70018
|
+
throw notFoundError(target, stack, resources);
|
|
70019
|
+
}
|
|
70020
|
+
if (lambdaMatches.length > 1) {
|
|
70021
|
+
throw new LocalInvokeResolutionError(
|
|
70022
|
+
`Target '${target}' matches ${lambdaMatches.length} Lambda functions in ${stack.stackName}: ` + lambdaMatches.map((m2) => m2.logicalId).join(", ") + ". Refine the path or use the stack:LogicalId form."
|
|
70023
|
+
);
|
|
70024
|
+
}
|
|
70025
|
+
const m = lambdaMatches[0];
|
|
70026
|
+
match = { logicalId: m.logicalId, resource: resources[m.logicalId] };
|
|
70027
|
+
} else {
|
|
70028
|
+
const resource2 = resources[parsed.pathOrId];
|
|
70029
|
+
if (!resource2) {
|
|
70030
|
+
throw notFoundError(target, stack, resources);
|
|
70031
|
+
}
|
|
70032
|
+
match = { logicalId: parsed.pathOrId, resource: resource2 };
|
|
70033
|
+
}
|
|
70034
|
+
const { logicalId, resource } = match;
|
|
70035
|
+
if (resource.Type !== "AWS::Lambda::Function") {
|
|
70036
|
+
if (resource.Type.startsWith("Custom::")) {
|
|
70037
|
+
throw new LocalInvokeResolutionError(
|
|
70038
|
+
`Resource '${logicalId}' in ${stack.stackName} is a Custom Resource (${resource.Type}), not a Lambda function. Custom Resources are invoked by the deploy framework, not by users. If you want to test the underlying handler, target the ServiceToken Lambda directly.`
|
|
70039
|
+
);
|
|
70040
|
+
}
|
|
70041
|
+
throw new LocalInvokeResolutionError(
|
|
70042
|
+
`Resource '${logicalId}' in ${stack.stackName} is ${resource.Type}, not a Lambda function. cdkd local invoke only works on AWS::Lambda::Function resources in v1.`
|
|
70043
|
+
);
|
|
70044
|
+
}
|
|
70045
|
+
return extractLambdaProperties(stack, logicalId, resource);
|
|
70046
|
+
}
|
|
70047
|
+
function pickStack(parsed, stacks) {
|
|
70048
|
+
if (parsed.stackPattern === null) {
|
|
70049
|
+
if (stacks.length === 1)
|
|
70050
|
+
return stacks[0];
|
|
70051
|
+
throw new LocalInvokeResolutionError(
|
|
70052
|
+
`Multiple stacks in app, target '${parsed.pathOrId}' is missing a stack prefix. Use 'StackName:${parsed.pathOrId}' or 'StackName/...' (path form). Available stacks: ${stacks.map((s) => s.stackName).join(", ")}.`
|
|
70053
|
+
);
|
|
70054
|
+
}
|
|
70055
|
+
const matched = matchStacks(stacks, [parsed.stackPattern]);
|
|
70056
|
+
if (matched.length === 0) {
|
|
70057
|
+
throw new LocalInvokeResolutionError(
|
|
70058
|
+
`Stack '${parsed.stackPattern}' not found. Available stacks: ${stacks.map((s) => s.stackName).join(", ")}.`
|
|
70059
|
+
);
|
|
70060
|
+
}
|
|
70061
|
+
if (matched.length > 1) {
|
|
70062
|
+
throw new LocalInvokeResolutionError(
|
|
70063
|
+
`Stack pattern '${parsed.stackPattern}' matched ${matched.length} stacks: ` + matched.map((s) => s.stackName).join(", ") + ". Use a more specific pattern."
|
|
70064
|
+
);
|
|
70065
|
+
}
|
|
70066
|
+
return matched[0];
|
|
70067
|
+
}
|
|
70068
|
+
function extractLambdaProperties(stack, logicalId, resource) {
|
|
70069
|
+
const props = resource.Properties ?? {};
|
|
70070
|
+
const runtime = typeof props["Runtime"] === "string" ? props["Runtime"] : "";
|
|
70071
|
+
const handler = typeof props["Handler"] === "string" ? props["Handler"] : "";
|
|
70072
|
+
const memoryMb = typeof props["MemorySize"] === "number" ? props["MemorySize"] : 128;
|
|
70073
|
+
const timeoutSec = typeof props["Timeout"] === "number" ? props["Timeout"] : 3;
|
|
70074
|
+
if (!runtime) {
|
|
70075
|
+
throw new LocalInvokeResolutionError(
|
|
70076
|
+
`Lambda '${logicalId}' has no Runtime property. Container-image Lambdas (Code.ImageUri) are not supported in cdkd local invoke v1.`
|
|
70077
|
+
);
|
|
70078
|
+
}
|
|
70079
|
+
if (!handler) {
|
|
70080
|
+
throw new LocalInvokeResolutionError(`Lambda '${logicalId}' has no Handler property.`);
|
|
70081
|
+
}
|
|
70082
|
+
const code = props["Code"] ?? {};
|
|
70083
|
+
const inlineCode = typeof code["ZipFile"] === "string" ? code["ZipFile"] : void 0;
|
|
70084
|
+
let codePath = null;
|
|
70085
|
+
if (!inlineCode) {
|
|
70086
|
+
codePath = resolveAssetCodePath(stack, logicalId, resource);
|
|
70087
|
+
}
|
|
70088
|
+
return {
|
|
70089
|
+
stack,
|
|
70090
|
+
logicalId,
|
|
70091
|
+
resource,
|
|
70092
|
+
runtime,
|
|
70093
|
+
handler,
|
|
70094
|
+
memoryMb,
|
|
70095
|
+
timeoutSec,
|
|
70096
|
+
codePath,
|
|
70097
|
+
...inlineCode !== void 0 && { inlineCode }
|
|
70098
|
+
};
|
|
70099
|
+
}
|
|
70100
|
+
function resolveAssetCodePath(stack, logicalId, resource) {
|
|
70101
|
+
const meta = resource.Metadata;
|
|
70102
|
+
const assetPath = meta?.["aws:asset:path"];
|
|
70103
|
+
if (typeof assetPath !== "string" || assetPath.length === 0) {
|
|
70104
|
+
throw new LocalInvokeResolutionError(
|
|
70105
|
+
`Lambda '${logicalId}' has no Metadata['aws:asset:path']. cdkd local invoke needs this hint to find the local asset directory. Re-synthesize the app (without \`--output <stale-dir>\`) and retry.`
|
|
70106
|
+
);
|
|
70107
|
+
}
|
|
70108
|
+
const cdkOutDir = stack.assetManifestPath ? dirname(stack.assetManifestPath) : process.cwd();
|
|
70109
|
+
const abs = isAbsolute(assetPath) ? assetPath : resolve4(cdkOutDir, assetPath);
|
|
70110
|
+
if (!existsSync4(abs) || !statSync3(abs).isDirectory()) {
|
|
70111
|
+
throw new LocalInvokeResolutionError(
|
|
70112
|
+
`Lambda '${logicalId}' asset directory '${abs}' does not exist or is not a directory. Re-synthesize the app and retry.`
|
|
70113
|
+
);
|
|
70114
|
+
}
|
|
70115
|
+
return abs;
|
|
70116
|
+
}
|
|
70117
|
+
function notFoundError(target, stack, resources) {
|
|
70118
|
+
const lambdas = [];
|
|
70119
|
+
for (const [logicalId, resource] of Object.entries(resources)) {
|
|
70120
|
+
if (resource.Type !== "AWS::Lambda::Function")
|
|
70121
|
+
continue;
|
|
70122
|
+
const meta = resource.Metadata;
|
|
70123
|
+
const cdkPath = typeof meta?.["aws:cdk:path"] === "string" ? meta["aws:cdk:path"] : "";
|
|
70124
|
+
lambdas.push({ displayPath: cdkPath || logicalId, logicalId });
|
|
70125
|
+
}
|
|
70126
|
+
let msg = `target '${target}' did not match any Lambda function in ${stack.stackName}.
|
|
70127
|
+
|
|
70128
|
+
`;
|
|
70129
|
+
if (lambdas.length === 0) {
|
|
70130
|
+
msg += `Stack ${stack.stackName} has no Lambda functions.`;
|
|
70131
|
+
} else {
|
|
70132
|
+
const width = Math.max(...lambdas.map((l) => l.displayPath.length));
|
|
70133
|
+
msg += `Available Lambda functions in ${stack.stackName}:
|
|
70134
|
+
`;
|
|
70135
|
+
for (const l of lambdas) {
|
|
70136
|
+
msg += ` ${l.displayPath.padEnd(width)} (${l.logicalId})
|
|
70137
|
+
`;
|
|
70138
|
+
}
|
|
70139
|
+
}
|
|
70140
|
+
return new LocalInvokeResolutionError(msg.trimEnd());
|
|
70141
|
+
}
|
|
70142
|
+
|
|
70143
|
+
// src/local-invoke/env-resolver.ts
|
|
70144
|
+
function resolveEnvVars(logicalId, templateEnv, overrides) {
|
|
70145
|
+
const resolved = {};
|
|
70146
|
+
const unresolved = [];
|
|
70147
|
+
if (templateEnv) {
|
|
70148
|
+
for (const [key, value] of Object.entries(templateEnv)) {
|
|
70149
|
+
if (isLiteralEnvValue(value)) {
|
|
70150
|
+
resolved[key] = String(value);
|
|
70151
|
+
} else {
|
|
70152
|
+
unresolved.push(key);
|
|
70153
|
+
}
|
|
70154
|
+
}
|
|
70155
|
+
}
|
|
70156
|
+
if (overrides) {
|
|
70157
|
+
applyOverrideMap(resolved, overrides.Parameters);
|
|
70158
|
+
const fnOverrides = overrides[logicalId];
|
|
70159
|
+
if (fnOverrides && typeof fnOverrides === "object") {
|
|
70160
|
+
applyOverrideMap(resolved, fnOverrides);
|
|
70161
|
+
}
|
|
70162
|
+
}
|
|
70163
|
+
return { resolved, unresolved };
|
|
70164
|
+
}
|
|
70165
|
+
function applyOverrideMap(acc, map) {
|
|
70166
|
+
if (!map)
|
|
70167
|
+
return;
|
|
70168
|
+
for (const [key, value] of Object.entries(map)) {
|
|
70169
|
+
if (value === null) {
|
|
70170
|
+
delete acc[key];
|
|
70171
|
+
} else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
70172
|
+
acc[key] = String(value);
|
|
70173
|
+
}
|
|
70174
|
+
}
|
|
70175
|
+
}
|
|
70176
|
+
function isLiteralEnvValue(value) {
|
|
70177
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
70178
|
+
}
|
|
70179
|
+
|
|
70180
|
+
// src/local-invoke/runtime-image.ts
|
|
70181
|
+
var SUPPORTED_RUNTIMES = {
|
|
70182
|
+
"nodejs18.x": { image: "public.ecr.aws/lambda/nodejs:18", fileExtension: ".js" },
|
|
70183
|
+
"nodejs20.x": { image: "public.ecr.aws/lambda/nodejs:20", fileExtension: ".js" },
|
|
70184
|
+
"nodejs22.x": { image: "public.ecr.aws/lambda/nodejs:22", fileExtension: ".js" },
|
|
70185
|
+
"python3.11": { image: "public.ecr.aws/lambda/python:3.11", fileExtension: ".py" },
|
|
70186
|
+
"python3.12": { image: "public.ecr.aws/lambda/python:3.12", fileExtension: ".py" },
|
|
70187
|
+
"python3.13": { image: "public.ecr.aws/lambda/python:3.13", fileExtension: ".py" }
|
|
70188
|
+
};
|
|
70189
|
+
var UnsupportedRuntimeError = class _UnsupportedRuntimeError extends Error {
|
|
70190
|
+
constructor(runtime, message) {
|
|
70191
|
+
super(message);
|
|
70192
|
+
this.runtime = runtime;
|
|
70193
|
+
this.name = "UnsupportedRuntimeError";
|
|
70194
|
+
Object.setPrototypeOf(this, _UnsupportedRuntimeError.prototype);
|
|
70195
|
+
}
|
|
70196
|
+
};
|
|
70197
|
+
function resolveRuntimeImage(runtime) {
|
|
70198
|
+
return resolveRuntimeSpec(runtime).image;
|
|
70199
|
+
}
|
|
70200
|
+
function resolveRuntimeFileExtension(runtime) {
|
|
70201
|
+
return resolveRuntimeSpec(runtime).fileExtension;
|
|
70202
|
+
}
|
|
70203
|
+
function resolveRuntimeSpec(runtime) {
|
|
70204
|
+
if (typeof runtime !== "string" || runtime.length === 0) {
|
|
70205
|
+
throw new UnsupportedRuntimeError(
|
|
70206
|
+
String(runtime),
|
|
70207
|
+
"Lambda function has no Runtime property. Container-image Lambdas (Code.ImageUri) are not supported in cdkd local invoke v1."
|
|
70208
|
+
);
|
|
70209
|
+
}
|
|
70210
|
+
const spec = SUPPORTED_RUNTIMES[runtime];
|
|
70211
|
+
if (spec)
|
|
70212
|
+
return spec;
|
|
70213
|
+
if (runtime.startsWith("java") || runtime.startsWith("dotnet") || runtime.startsWith("ruby") || runtime.startsWith("go") || runtime.startsWith("provided")) {
|
|
70214
|
+
throw new UnsupportedRuntimeError(
|
|
70215
|
+
runtime,
|
|
70216
|
+
`Runtime '${runtime}' is not supported in cdkd local invoke v1. Only Node.js (nodejs18.x / nodejs20.x / nodejs22.x) and Python (python3.11 / python3.12 / python3.13) runtimes are supported. Other runtimes follow in subsequent PRs.`
|
|
70217
|
+
);
|
|
70218
|
+
}
|
|
70219
|
+
throw new UnsupportedRuntimeError(
|
|
70220
|
+
runtime,
|
|
70221
|
+
`Unknown runtime '${runtime}'. cdkd local invoke v1 supports nodejs18.x / nodejs20.x / nodejs22.x / python3.11 / python3.12 / python3.13.`
|
|
70222
|
+
);
|
|
70223
|
+
}
|
|
70224
|
+
|
|
70225
|
+
// src/local-invoke/docker-runner.ts
|
|
70226
|
+
import { execFile as execFile2, spawn as spawn3 } from "node:child_process";
|
|
70227
|
+
import { createServer } from "node:net";
|
|
70228
|
+
import { promisify as promisify2 } from "node:util";
|
|
70229
|
+
var execFileAsync2 = promisify2(execFile2);
|
|
70230
|
+
var DockerRunnerError = class _DockerRunnerError extends Error {
|
|
70231
|
+
constructor(message) {
|
|
70232
|
+
super(message);
|
|
70233
|
+
this.name = "DockerRunnerError";
|
|
70234
|
+
Object.setPrototypeOf(this, _DockerRunnerError.prototype);
|
|
70235
|
+
}
|
|
70236
|
+
};
|
|
70237
|
+
async function pullImage(image, skipPull) {
|
|
70238
|
+
const logger = getLogger().child("docker");
|
|
70239
|
+
if (skipPull) {
|
|
70240
|
+
logger.debug(`Skipping docker pull for ${image} (--no-pull)`);
|
|
70241
|
+
return;
|
|
70242
|
+
}
|
|
70243
|
+
logger.info(`Pulling ${image}...`);
|
|
70244
|
+
await runForeground("docker", ["pull", image]);
|
|
70245
|
+
}
|
|
70246
|
+
async function runDetached(opts) {
|
|
70247
|
+
const args = ["run", "-d", "--rm"];
|
|
70248
|
+
const host = opts.host ?? "127.0.0.1";
|
|
70249
|
+
args.push("-p", `${host}:${opts.hostPort}:8080`);
|
|
70250
|
+
if (opts.debugPort !== void 0) {
|
|
70251
|
+
args.push("-p", `${host}:${opts.debugPort}:${opts.debugPort}`);
|
|
70252
|
+
}
|
|
70253
|
+
for (const mount of opts.mounts) {
|
|
70254
|
+
const ro = mount.readOnly ? ":ro" : "";
|
|
70255
|
+
args.push("-v", `${mount.hostPath}:${mount.containerPath}${ro}`);
|
|
70256
|
+
}
|
|
70257
|
+
for (const [k, v] of Object.entries(opts.env)) {
|
|
70258
|
+
args.push("-e", `${k}=${v}`);
|
|
70259
|
+
}
|
|
70260
|
+
args.push(opts.image, ...opts.cmd);
|
|
70261
|
+
const logger = getLogger().child("docker");
|
|
70262
|
+
logger.debug(`docker ${args.join(" ")}`);
|
|
70263
|
+
try {
|
|
70264
|
+
const { stdout } = await execFileAsync2("docker", args, {
|
|
70265
|
+
maxBuffer: 10 * 1024 * 1024
|
|
70266
|
+
});
|
|
70267
|
+
return stdout.trim();
|
|
70268
|
+
} catch (error) {
|
|
70269
|
+
const err = error;
|
|
70270
|
+
throw new DockerRunnerError(
|
|
70271
|
+
`docker run failed: ${err.stderr?.trim() || err.message || String(error)}`
|
|
70272
|
+
);
|
|
70273
|
+
}
|
|
70274
|
+
}
|
|
70275
|
+
function streamLogs(containerId) {
|
|
70276
|
+
const proc = spawn3("docker", ["logs", "-f", containerId], {
|
|
70277
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
70278
|
+
});
|
|
70279
|
+
proc.stdout?.on("data", (chunk) => process.stdout.write(chunk));
|
|
70280
|
+
proc.stderr?.on("data", (chunk) => process.stderr.write(chunk));
|
|
70281
|
+
proc.on("error", () => {
|
|
70282
|
+
});
|
|
70283
|
+
return () => {
|
|
70284
|
+
if (!proc.killed)
|
|
70285
|
+
proc.kill("SIGTERM");
|
|
70286
|
+
};
|
|
70287
|
+
}
|
|
70288
|
+
async function removeContainer(containerId) {
|
|
70289
|
+
if (!containerId)
|
|
70290
|
+
return;
|
|
70291
|
+
const logger = getLogger().child("docker");
|
|
70292
|
+
try {
|
|
70293
|
+
await execFileAsync2("docker", ["rm", "-f", containerId]);
|
|
70294
|
+
logger.debug(`Removed container ${containerId}`);
|
|
70295
|
+
} catch (error) {
|
|
70296
|
+
const err = error;
|
|
70297
|
+
logger.debug(
|
|
70298
|
+
`docker rm -f ${containerId} failed: ${err.stderr || err.message || String(error)}`
|
|
70299
|
+
);
|
|
70300
|
+
}
|
|
70301
|
+
}
|
|
70302
|
+
async function ensureDockerAvailable() {
|
|
70303
|
+
try {
|
|
70304
|
+
await execFileAsync2("docker", ["version", "--format", "{{.Server.Version}}"]);
|
|
70305
|
+
} catch (error) {
|
|
70306
|
+
const err = error;
|
|
70307
|
+
if (err.code === "ENOENT") {
|
|
70308
|
+
throw new DockerRunnerError(
|
|
70309
|
+
"docker is not installed or not on PATH. cdkd local invoke needs Docker \u2014 install Docker Desktop or the docker CLI and retry."
|
|
70310
|
+
);
|
|
70311
|
+
}
|
|
70312
|
+
throw new DockerRunnerError(
|
|
70313
|
+
`docker daemon is not reachable: ${err.stderr?.trim() || err.message || String(error)}. Start Docker Desktop / the docker daemon and retry.`
|
|
70314
|
+
);
|
|
70315
|
+
}
|
|
70316
|
+
}
|
|
70317
|
+
function pickFreePort() {
|
|
70318
|
+
return new Promise((resolvePort, rejectPort) => {
|
|
70319
|
+
const server = createServer();
|
|
70320
|
+
server.unref();
|
|
70321
|
+
server.on("error", rejectPort);
|
|
70322
|
+
server.listen(0, "127.0.0.1", () => {
|
|
70323
|
+
const address = server.address();
|
|
70324
|
+
if (!address || typeof address === "string") {
|
|
70325
|
+
server.close();
|
|
70326
|
+
rejectPort(new Error("Could not allocate a host port"));
|
|
70327
|
+
return;
|
|
70328
|
+
}
|
|
70329
|
+
const port = address.port;
|
|
70330
|
+
server.close(() => resolvePort(port));
|
|
70331
|
+
});
|
|
70332
|
+
});
|
|
70333
|
+
}
|
|
70334
|
+
function runForeground(cmd, args) {
|
|
70335
|
+
return new Promise((resolveProc, rejectProc) => {
|
|
70336
|
+
const proc = spawn3(cmd, args, { stdio: "inherit" });
|
|
70337
|
+
proc.on("error", (err) => rejectProc(new DockerRunnerError(`${cmd} failed: ${err.message}`)));
|
|
70338
|
+
proc.on("close", (code) => {
|
|
70339
|
+
if (code === 0)
|
|
70340
|
+
resolveProc();
|
|
70341
|
+
else
|
|
70342
|
+
rejectProc(new DockerRunnerError(`${cmd} exited with code ${code}`));
|
|
70343
|
+
});
|
|
70344
|
+
});
|
|
70345
|
+
}
|
|
70346
|
+
|
|
70347
|
+
// src/local-invoke/rie-client.ts
|
|
70348
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
70349
|
+
var INVOKE_PATH = "/2015-03-31/functions/function/invocations";
|
|
70350
|
+
async function waitForRieReady(host, port, timeoutMs = 5e3) {
|
|
70351
|
+
const deadline = Date.now() + timeoutMs;
|
|
70352
|
+
let lastError;
|
|
70353
|
+
while (Date.now() < deadline) {
|
|
70354
|
+
try {
|
|
70355
|
+
const ok = await httpProbe(host, port, 500);
|
|
70356
|
+
if (ok)
|
|
70357
|
+
return;
|
|
70358
|
+
} catch (err) {
|
|
70359
|
+
lastError = err;
|
|
70360
|
+
}
|
|
70361
|
+
await delay(100);
|
|
70362
|
+
}
|
|
70363
|
+
const tail = lastError instanceof Error ? `: ${lastError.message}` : "";
|
|
70364
|
+
throw new Error(
|
|
70365
|
+
`RIE did not become ready on ${host}:${port} within ${timeoutMs}ms${tail}. The container may have exited early \u2014 check 'docker logs' output.`
|
|
70366
|
+
);
|
|
70367
|
+
}
|
|
70368
|
+
async function httpProbe(host, port, timeoutMs) {
|
|
70369
|
+
const controller = new AbortController();
|
|
70370
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
70371
|
+
try {
|
|
70372
|
+
const response = await fetch(`http://${host}:${port}/`, {
|
|
70373
|
+
method: "POST",
|
|
70374
|
+
headers: { "Content-Type": "application/json" },
|
|
70375
|
+
body: "{}",
|
|
70376
|
+
signal: controller.signal
|
|
70377
|
+
});
|
|
70378
|
+
await response.text().catch(() => void 0);
|
|
70379
|
+
return true;
|
|
70380
|
+
} catch (err) {
|
|
70381
|
+
if (isTransientNetworkError(err))
|
|
70382
|
+
return false;
|
|
70383
|
+
throw err;
|
|
70384
|
+
} finally {
|
|
70385
|
+
clearTimeout(timer);
|
|
70386
|
+
}
|
|
70387
|
+
}
|
|
70388
|
+
function isTransientNetworkError(err) {
|
|
70389
|
+
if (!(err instanceof Error))
|
|
70390
|
+
return false;
|
|
70391
|
+
if (err.name === "AbortError")
|
|
70392
|
+
return true;
|
|
70393
|
+
if (err.name === "TypeError" && err.message === "fetch failed")
|
|
70394
|
+
return true;
|
|
70395
|
+
const cause = err.cause;
|
|
70396
|
+
if (cause?.code === "ECONNRESET")
|
|
70397
|
+
return true;
|
|
70398
|
+
if (cause?.code === "ECONNREFUSED")
|
|
70399
|
+
return true;
|
|
70400
|
+
if (cause?.code === "UND_ERR_SOCKET")
|
|
70401
|
+
return true;
|
|
70402
|
+
return false;
|
|
70403
|
+
}
|
|
70404
|
+
async function invokeRie(host, port, event, timeoutMs) {
|
|
70405
|
+
const url = `http://${host}:${port}${INVOKE_PATH}`;
|
|
70406
|
+
const body = JSON.stringify(event ?? {});
|
|
70407
|
+
const controller = new AbortController();
|
|
70408
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
70409
|
+
let response;
|
|
70410
|
+
try {
|
|
70411
|
+
response = await fetch(url, {
|
|
70412
|
+
method: "POST",
|
|
70413
|
+
headers: { "Content-Type": "application/json" },
|
|
70414
|
+
body,
|
|
70415
|
+
signal: controller.signal
|
|
70416
|
+
});
|
|
70417
|
+
} catch (err) {
|
|
70418
|
+
if (err.name === "AbortError") {
|
|
70419
|
+
throw new Error(
|
|
70420
|
+
`RIE invoke at ${url} timed out after ${timeoutMs}ms. The handler may be hung; check container logs.`
|
|
70421
|
+
);
|
|
70422
|
+
}
|
|
70423
|
+
throw err;
|
|
70424
|
+
} finally {
|
|
70425
|
+
clearTimeout(timer);
|
|
70426
|
+
}
|
|
70427
|
+
const raw = await response.text();
|
|
70428
|
+
let payload = raw;
|
|
70429
|
+
try {
|
|
70430
|
+
payload = JSON.parse(raw);
|
|
70431
|
+
} catch {
|
|
70432
|
+
}
|
|
70433
|
+
return { payload, raw };
|
|
70434
|
+
}
|
|
70435
|
+
|
|
70436
|
+
// src/cli/commands/local-invoke.ts
|
|
70437
|
+
async function localInvokeCommand(target, options) {
|
|
70438
|
+
const logger = getLogger();
|
|
70439
|
+
if (options.verbose) {
|
|
70440
|
+
logger.setLevel("debug");
|
|
70441
|
+
}
|
|
70442
|
+
warnIfDeprecatedRegion(options);
|
|
70443
|
+
await applyRoleArnIfSet({ roleArn: options.roleArn, region: options.region });
|
|
70444
|
+
await ensureDockerAvailable();
|
|
70445
|
+
const appCmd = resolveApp(options.app);
|
|
70446
|
+
if (!appCmd) {
|
|
70447
|
+
throw new Error('No CDK app specified. Pass --app, set CDKD_APP, or add "app" to cdk.json.');
|
|
70448
|
+
}
|
|
70449
|
+
logger.info("Synthesizing CDK app...");
|
|
70450
|
+
const synthesizer = new Synthesizer();
|
|
70451
|
+
const context = parseContextOptions(options.context);
|
|
70452
|
+
const synthOpts = {
|
|
70453
|
+
app: appCmd,
|
|
70454
|
+
output: options.output,
|
|
70455
|
+
...options.region && { region: options.region },
|
|
70456
|
+
...options.profile && { profile: options.profile },
|
|
70457
|
+
...Object.keys(context).length > 0 && { context }
|
|
70458
|
+
};
|
|
70459
|
+
const { stacks } = await synthesizer.synthesize(synthOpts);
|
|
70460
|
+
const lambda = resolveLambdaTarget(target, stacks);
|
|
70461
|
+
logger.info(`Target: ${lambda.stack.stackName}/${lambda.logicalId} (${lambda.runtime})`);
|
|
70462
|
+
const codeDir = lambda.codePath ?? materializeInlineCode(
|
|
70463
|
+
lambda.handler,
|
|
70464
|
+
lambda.inlineCode ?? "",
|
|
70465
|
+
resolveRuntimeFileExtension(lambda.runtime)
|
|
70466
|
+
);
|
|
70467
|
+
const overrides = readEnvOverridesFile(options.envVars);
|
|
70468
|
+
const envResult = resolveEnvVars(lambda.logicalId, getTemplateEnv(lambda.resource), overrides);
|
|
70469
|
+
for (const key of envResult.unresolved) {
|
|
70470
|
+
logger.warn(
|
|
70471
|
+
`Environment variable ${key} contains a CloudFormation intrinsic and was dropped. Override it with --env-vars (e.g. {"${lambda.logicalId}":{"${key}":"<literal>"}}) or wait for --from-state in PR 2.`
|
|
70472
|
+
);
|
|
70473
|
+
}
|
|
70474
|
+
const event = await readEvent(options);
|
|
70475
|
+
const image = resolveRuntimeImage(lambda.runtime);
|
|
70476
|
+
const dockerEnv = {
|
|
70477
|
+
AWS_LAMBDA_FUNCTION_NAME: lambda.logicalId,
|
|
70478
|
+
AWS_LAMBDA_FUNCTION_MEMORY_SIZE: String(lambda.memoryMb),
|
|
70479
|
+
AWS_LAMBDA_FUNCTION_TIMEOUT: String(lambda.timeoutSec),
|
|
70480
|
+
AWS_LAMBDA_FUNCTION_VERSION: "$LATEST",
|
|
70481
|
+
AWS_LAMBDA_LOG_GROUP_NAME: `/aws/lambda/${lambda.logicalId}`,
|
|
70482
|
+
AWS_LAMBDA_LOG_STREAM_NAME: "local",
|
|
70483
|
+
...envResult.resolved
|
|
70484
|
+
};
|
|
70485
|
+
if (options.assumeRole) {
|
|
70486
|
+
const stsRegion = options.region ?? process.env["AWS_REGION"] ?? process.env["AWS_DEFAULT_REGION"];
|
|
70487
|
+
const creds = await assumeLambdaExecutionRole(options.assumeRole, stsRegion);
|
|
70488
|
+
dockerEnv["AWS_ACCESS_KEY_ID"] = creds.accessKeyId;
|
|
70489
|
+
dockerEnv["AWS_SECRET_ACCESS_KEY"] = creds.secretAccessKey;
|
|
70490
|
+
dockerEnv["AWS_SESSION_TOKEN"] = creds.sessionToken;
|
|
70491
|
+
if (stsRegion)
|
|
70492
|
+
dockerEnv["AWS_REGION"] = stsRegion;
|
|
70493
|
+
} else {
|
|
70494
|
+
forwardAwsEnv(dockerEnv);
|
|
70495
|
+
}
|
|
70496
|
+
let debugPort;
|
|
70497
|
+
if (options.debugPort) {
|
|
70498
|
+
debugPort = Number(options.debugPort);
|
|
70499
|
+
if (!Number.isInteger(debugPort) || debugPort <= 0 || debugPort > 65535) {
|
|
70500
|
+
throw new Error(`--debug-port must be an integer in 1..65535, got '${options.debugPort}'`);
|
|
70501
|
+
}
|
|
70502
|
+
dockerEnv["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${debugPort}`;
|
|
70503
|
+
}
|
|
70504
|
+
await pullImage(image, options.pull === false);
|
|
70505
|
+
const hostPort = await pickFreePort();
|
|
70506
|
+
const containerHost = options.containerHost || "127.0.0.1";
|
|
70507
|
+
logger.info(`Starting container (image=${image}, port=${hostPort})...`);
|
|
70508
|
+
const containerId = await runDetached({
|
|
70509
|
+
image,
|
|
70510
|
+
mounts: [{ hostPath: codeDir, containerPath: "/var/task", readOnly: true }],
|
|
70511
|
+
env: dockerEnv,
|
|
70512
|
+
cmd: [lambda.handler],
|
|
70513
|
+
hostPort,
|
|
70514
|
+
host: containerHost,
|
|
70515
|
+
...debugPort !== void 0 && { debugPort }
|
|
70516
|
+
});
|
|
70517
|
+
const stopLogs = streamLogs(containerId);
|
|
70518
|
+
const sigintHandler = () => {
|
|
70519
|
+
stopLogs();
|
|
70520
|
+
void removeContainer(containerId).then(() => {
|
|
70521
|
+
process.exit(130);
|
|
70522
|
+
});
|
|
70523
|
+
};
|
|
70524
|
+
process.on("SIGINT", sigintHandler);
|
|
70525
|
+
try {
|
|
70526
|
+
await waitForRieReady(containerHost, hostPort, 5e3);
|
|
70527
|
+
const invokeTimeoutMs = Math.max(3e4, lambda.timeoutSec * 2 * 1e3);
|
|
70528
|
+
const result = await invokeRie(containerHost, hostPort, event, invokeTimeoutMs);
|
|
70529
|
+
await new Promise((resolveDelay) => setTimeout(resolveDelay, 250));
|
|
70530
|
+
process.stdout.write(`${result.raw}
|
|
70531
|
+
`);
|
|
70532
|
+
} finally {
|
|
70533
|
+
process.off("SIGINT", sigintHandler);
|
|
70534
|
+
stopLogs();
|
|
70535
|
+
await removeContainer(containerId);
|
|
70536
|
+
}
|
|
70537
|
+
}
|
|
70538
|
+
function getTemplateEnv(resource) {
|
|
70539
|
+
const props = resource.Properties ?? {};
|
|
70540
|
+
const env = props["Environment"];
|
|
70541
|
+
if (!env || typeof env !== "object")
|
|
70542
|
+
return void 0;
|
|
70543
|
+
const vars = env["Variables"];
|
|
70544
|
+
if (!vars || typeof vars !== "object")
|
|
70545
|
+
return void 0;
|
|
70546
|
+
return vars;
|
|
70547
|
+
}
|
|
70548
|
+
function readEnvOverridesFile(filePath) {
|
|
70549
|
+
if (!filePath)
|
|
70550
|
+
return void 0;
|
|
70551
|
+
let raw;
|
|
70552
|
+
try {
|
|
70553
|
+
raw = readFileSync6(filePath, "utf-8");
|
|
70554
|
+
} catch (err) {
|
|
70555
|
+
throw new Error(
|
|
70556
|
+
`Failed to read --env-vars file '${filePath}': ${err instanceof Error ? err.message : String(err)}`
|
|
70557
|
+
);
|
|
70558
|
+
}
|
|
70559
|
+
let parsed;
|
|
70560
|
+
try {
|
|
70561
|
+
parsed = JSON.parse(raw);
|
|
70562
|
+
} catch (err) {
|
|
70563
|
+
throw new Error(
|
|
70564
|
+
`Failed to parse --env-vars file '${filePath}' as JSON: ${err instanceof Error ? err.message : String(err)}`
|
|
70565
|
+
);
|
|
70566
|
+
}
|
|
70567
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
70568
|
+
throw new Error(`--env-vars file '${filePath}' must contain a JSON object at the top level.`);
|
|
70569
|
+
}
|
|
70570
|
+
return parsed;
|
|
70571
|
+
}
|
|
70572
|
+
async function readEvent(options) {
|
|
70573
|
+
if (options.event && options.eventStdin) {
|
|
70574
|
+
throw new Error("--event and --event-stdin are mutually exclusive.");
|
|
70575
|
+
}
|
|
70576
|
+
if (options.eventStdin) {
|
|
70577
|
+
const raw = await readStdin();
|
|
70578
|
+
return parseEvent(raw, "<stdin>");
|
|
70579
|
+
}
|
|
70580
|
+
if (options.event) {
|
|
70581
|
+
const raw = readFileSync6(options.event, "utf-8");
|
|
70582
|
+
return parseEvent(raw, options.event);
|
|
70583
|
+
}
|
|
70584
|
+
return {};
|
|
70585
|
+
}
|
|
70586
|
+
function parseEvent(raw, source) {
|
|
70587
|
+
try {
|
|
70588
|
+
return JSON.parse(raw);
|
|
70589
|
+
} catch (err) {
|
|
70590
|
+
throw new Error(
|
|
70591
|
+
`Failed to parse event payload from ${source} as JSON: ${err instanceof Error ? err.message : String(err)}`
|
|
70592
|
+
);
|
|
70593
|
+
}
|
|
70594
|
+
}
|
|
70595
|
+
async function readStdin() {
|
|
70596
|
+
const chunks = [];
|
|
70597
|
+
for await (const chunk of process.stdin) {
|
|
70598
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
70599
|
+
}
|
|
70600
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
70601
|
+
}
|
|
70602
|
+
async function assumeLambdaExecutionRole(roleArn, region) {
|
|
70603
|
+
const { STSClient: STSClient10, AssumeRoleCommand: AssumeRoleCommand2 } = await import("@aws-sdk/client-sts");
|
|
70604
|
+
const sts = new STSClient10({ ...region && { region } });
|
|
70605
|
+
try {
|
|
70606
|
+
const response = await sts.send(
|
|
70607
|
+
new AssumeRoleCommand2({
|
|
70608
|
+
RoleArn: roleArn,
|
|
70609
|
+
RoleSessionName: `cdkd-local-invoke-${Date.now()}`,
|
|
70610
|
+
DurationSeconds: 3600
|
|
70611
|
+
})
|
|
70612
|
+
);
|
|
70613
|
+
const creds = response.Credentials;
|
|
70614
|
+
if (!creds?.AccessKeyId || !creds.SecretAccessKey || !creds.SessionToken) {
|
|
70615
|
+
throw new Error(`AssumeRole(${roleArn}) returned no usable credentials.`);
|
|
70616
|
+
}
|
|
70617
|
+
return {
|
|
70618
|
+
accessKeyId: creds.AccessKeyId,
|
|
70619
|
+
secretAccessKey: creds.SecretAccessKey,
|
|
70620
|
+
sessionToken: creds.SessionToken
|
|
70621
|
+
};
|
|
70622
|
+
} finally {
|
|
70623
|
+
sts.destroy();
|
|
70624
|
+
}
|
|
70625
|
+
}
|
|
70626
|
+
function forwardAwsEnv(env) {
|
|
70627
|
+
const passThrough = [
|
|
70628
|
+
"AWS_ACCESS_KEY_ID",
|
|
70629
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
70630
|
+
"AWS_SESSION_TOKEN",
|
|
70631
|
+
"AWS_REGION",
|
|
70632
|
+
"AWS_DEFAULT_REGION"
|
|
70633
|
+
];
|
|
70634
|
+
for (const key of passThrough) {
|
|
70635
|
+
const value = process.env[key];
|
|
70636
|
+
if (value !== void 0)
|
|
70637
|
+
env[key] = value;
|
|
70638
|
+
}
|
|
70639
|
+
}
|
|
70640
|
+
function materializeInlineCode(handler, source, fileExtension) {
|
|
70641
|
+
const lastDot = handler.lastIndexOf(".");
|
|
70642
|
+
if (lastDot <= 0) {
|
|
70643
|
+
throw new Error(`Handler '${handler}' is malformed: expected '<modulePath>.<exportName>'.`);
|
|
70644
|
+
}
|
|
70645
|
+
const modulePath = handler.substring(0, lastDot);
|
|
70646
|
+
const dir = mkdtempSync2(path.join(tmpdir2(), "cdkd-local-invoke-"));
|
|
70647
|
+
const filePath = path.join(dir, `${modulePath}${fileExtension}`);
|
|
70648
|
+
mkdirSync2(path.dirname(filePath), { recursive: true });
|
|
70649
|
+
writeFileSync5(filePath, source, "utf-8");
|
|
70650
|
+
return dir;
|
|
70651
|
+
}
|
|
70652
|
+
function createLocalCommand() {
|
|
70653
|
+
const local = new Command14("local").description(
|
|
70654
|
+
"Local Lambda execution against the AWS Lambda Runtime Interface Emulator (Docker required)"
|
|
70655
|
+
);
|
|
70656
|
+
const invoke = new Command14("invoke").description(
|
|
70657
|
+
"Run a Lambda function locally in a Docker container (RIE-backed). Target accepts a CDK display path (MyStack/MyApi/Handler) or stack-qualified logical ID (MyStack:MyApiHandler1234ABCD). Single-stack apps may omit the stack prefix."
|
|
70658
|
+
).argument("<target>", "CDK display path or stack-qualified logical ID of the Lambda to invoke").addOption(new Option7("-e, --event <file>", "JSON event payload file (default: {})")).addOption(new Option7("--event-stdin", "Read event JSON from stdin").default(false)).addOption(
|
|
70659
|
+
new Option7(
|
|
70660
|
+
"--env-vars <file>",
|
|
70661
|
+
'JSON env-var overrides (SAM-compatible: {"LogicalId":{"KEY":"VALUE"}})'
|
|
70662
|
+
)
|
|
70663
|
+
).addOption(new Option7("--no-pull", "Skip docker pull (use cached image)")).addOption(new Option7("--debug-port <port>", "Node --inspect-brk port (default: off)")).addOption(
|
|
70664
|
+
new Option7("--container-host <host>", "Host to bind the RIE port to").default("127.0.0.1")
|
|
70665
|
+
).addOption(
|
|
70666
|
+
new Option7(
|
|
70667
|
+
"--assume-role <arn>",
|
|
70668
|
+
`Assume the Lambda's deployed execution role and forward STS-issued temp credentials to the container so the handler runs with the deployed function's narrow permissions (closes the "developer admin / function narrow" skew). Off by default \u2014 when omitted, the developer's shell credentials are forwarded unchanged (SAM-compatible default).`
|
|
70669
|
+
)
|
|
70670
|
+
).action(withErrorHandling(localInvokeCommand));
|
|
70671
|
+
[...commonOptions, ...appOptions, ...contextOptions].forEach((opt) => invoke.addOption(opt));
|
|
70672
|
+
invoke.addOption(deprecatedRegionOption);
|
|
70673
|
+
local.addCommand(invoke);
|
|
70674
|
+
return local;
|
|
70675
|
+
}
|
|
70676
|
+
|
|
69965
70677
|
// src/cli/index.ts
|
|
69966
70678
|
var SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
69967
70679
|
"bootstrap",
|
|
@@ -69976,7 +70688,8 @@ var SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
|
69976
70688
|
"import",
|
|
69977
70689
|
"publish-assets",
|
|
69978
70690
|
"force-unlock",
|
|
69979
|
-
"state"
|
|
70691
|
+
"state",
|
|
70692
|
+
"local"
|
|
69980
70693
|
]);
|
|
69981
70694
|
function reorderArgs(argv) {
|
|
69982
70695
|
const prefix = argv.slice(0, 2);
|
|
@@ -69989,8 +70702,8 @@ function reorderArgs(argv) {
|
|
|
69989
70702
|
return [...prefix, ...cmdAndAfter, ...beforeCmd];
|
|
69990
70703
|
}
|
|
69991
70704
|
async function main() {
|
|
69992
|
-
const program = new
|
|
69993
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
70705
|
+
const program = new Command15();
|
|
70706
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.68.0");
|
|
69994
70707
|
program.addCommand(createBootstrapCommand());
|
|
69995
70708
|
program.addCommand(createSynthCommand());
|
|
69996
70709
|
program.addCommand(createListCommand());
|
|
@@ -70003,6 +70716,7 @@ async function main() {
|
|
|
70003
70716
|
program.addCommand(createPublishAssetsCommand());
|
|
70004
70717
|
program.addCommand(createForceUnlockCommand());
|
|
70005
70718
|
program.addCommand(createStateCommand());
|
|
70719
|
+
program.addCommand(createLocalCommand());
|
|
70006
70720
|
const args = reorderArgs(process.argv);
|
|
70007
70721
|
await program.parseAsync(args);
|
|
70008
70722
|
}
|