aws-cdk 2.1135.1 → 2.1137.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/lib/index.js CHANGED
@@ -3695,7 +3695,7 @@ var require_semver2 = __commonJS({
3695
3695
  // ../@aws-cdk/cloud-assembly-schema/cli-version.json
3696
3696
  var require_cli_version = __commonJS({
3697
3697
  "../@aws-cdk/cloud-assembly-schema/cli-version.json"(exports2, module2) {
3698
- module2.exports = { version: "2.1135.1" };
3698
+ module2.exports = { version: "2.1137.0" };
3699
3699
  }
3700
3700
  });
3701
3701
 
@@ -35739,7 +35739,7 @@ var init_package = __esm({
35739
35739
  "../../node_modules/@aws-sdk/nested-clients/package.json"() {
35740
35740
  package_default = {
35741
35741
  name: "@aws-sdk/nested-clients",
35742
- version: "3.997.38",
35742
+ version: "3.997.41",
35743
35743
  description: "Nested clients for AWS SDK packages.",
35744
35744
  homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",
35745
35745
  license: "Apache-2.0",
@@ -35839,7 +35839,7 @@ var init_package = __esm({
35839
35839
  "test:watch": "yarn g:vitest watch"
35840
35840
  },
35841
35841
  dependencies: {
35842
- "@aws-sdk/core": "^3.977.3",
35842
+ "@aws-sdk/core": "^3.977.6",
35843
35843
  "@aws-sdk/signature-v4-multi-region": "^3.996.43",
35844
35844
  "@aws-sdk/types": "^3.974.2",
35845
35845
  "@smithy/core": "^3.31.1",
@@ -37558,30 +37558,54 @@ var init_UnionSerde = __esm({
37558
37558
  }
37559
37559
  });
37560
37560
 
37561
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js
37562
+ function detectBufferParsing() {
37563
+ if (canParseBuffer === void 0) {
37564
+ try {
37565
+ if (typeof Buffer !== "function") {
37566
+ canParseBuffer = false;
37567
+ } else {
37568
+ const result2 = JSON.parse(Buffer.from([123, 125]));
37569
+ canParseBuffer = result2 !== null && typeof result2 === "object";
37570
+ }
37571
+ } catch {
37572
+ canParseBuffer = false;
37573
+ }
37574
+ }
37575
+ return canParseBuffer;
37576
+ }
37577
+ var canParseBuffer;
37578
+ var init_detectBufferParsing = __esm({
37579
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js"() {
37580
+ __name(detectBufferParsing, "detectBufferParsing");
37581
+ }
37582
+ });
37583
+
37561
37584
  // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
37562
37585
  function jsonReviver(key, value2, context) {
37563
37586
  if (context?.source) {
37564
37587
  const numericString = context.source;
37565
37588
  if (typeof value2 === "number") {
37566
37589
  const inSafeRange = value2 <= Number.MAX_SAFE_INTEGER && value2 >= Number.MIN_SAFE_INTEGER;
37567
- if (!inSafeRange || numericString !== String(value2)) {
37568
- if (inSafeRange && /[eE]/.test(numericString) && String(Number(numericString)) === String(value2)) {
37590
+ if (inSafeRange) {
37591
+ if (isRepresentable(numericString, value2)) {
37569
37592
  return value2;
37570
37593
  }
37571
- if (isFractionalNumeric(numericString)) {
37594
+ return new NumericValue(numericString, "bigDecimal");
37595
+ } else {
37596
+ if (isFractionalBigNumeric(numericString)) {
37572
37597
  return new NumericValue(numericString, "bigDecimal");
37573
- } else {
37574
- if (/[eE]/.test(numericString)) {
37575
- return BigInt(Number(numericString));
37576
- }
37577
- return BigInt(numericString);
37578
37598
  }
37599
+ if (/[eE]/.test(numericString)) {
37600
+ return expandExponentToBigInt(numericString);
37601
+ }
37602
+ return BigInt(numericString);
37579
37603
  }
37580
37604
  }
37581
37605
  }
37582
37606
  return value2;
37583
37607
  }
37584
- function isFractionalNumeric(s2) {
37608
+ function isFractionalBigNumeric(s2) {
37585
37609
  const dotIndex = s2.indexOf(".");
37586
37610
  if (dotIndex === -1) {
37587
37611
  return false;
@@ -37594,11 +37618,91 @@ function isFractionalNumeric(s2) {
37594
37618
  const exp = parseInt(s2.slice(eIndex + 1), 10);
37595
37619
  return exp < fracDigits;
37596
37620
  }
37621
+ function isRepresentable(numericString, value2) {
37622
+ if (numericString === String(value2)) {
37623
+ return true;
37624
+ }
37625
+ if (Object.is(value2, -0)) {
37626
+ return true;
37627
+ }
37628
+ if (/[eE]/.test(numericString)) {
37629
+ return expandToDecimal(numericString) === expandToDecimal(String(value2));
37630
+ }
37631
+ const normalized = numericString.replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
37632
+ const canonical = String(value2);
37633
+ if (normalized === canonical) {
37634
+ return true;
37635
+ }
37636
+ if (/[eE]/.test(canonical)) {
37637
+ return normalized === expandToDecimal(canonical);
37638
+ }
37639
+ return false;
37640
+ }
37641
+ function expandToDecimal(s2) {
37642
+ const negative = s2.startsWith("-");
37643
+ const abs = negative ? s2.slice(1) : s2;
37644
+ const eIndex = abs.search(/[eE]/);
37645
+ let result2;
37646
+ if (eIndex === -1) {
37647
+ result2 = abs;
37648
+ } else {
37649
+ const exp = parseInt(abs.slice(eIndex + 1), 10);
37650
+ const mantissa = abs.slice(0, eIndex);
37651
+ const dotIndex = mantissa.indexOf(".");
37652
+ let digits;
37653
+ let intLen;
37654
+ if (dotIndex === -1) {
37655
+ digits = mantissa;
37656
+ intLen = mantissa.length;
37657
+ } else {
37658
+ digits = mantissa.slice(0, dotIndex) + mantissa.slice(dotIndex + 1);
37659
+ intLen = dotIndex;
37660
+ }
37661
+ digits = digits.replace(/0+$/, "") || "0";
37662
+ const newDotPos = intLen + exp;
37663
+ if (digits === "0") {
37664
+ result2 = "0";
37665
+ } else if (newDotPos <= 0) {
37666
+ result2 = "0." + "0".repeat(-newDotPos) + digits;
37667
+ } else if (newDotPos >= digits.length) {
37668
+ result2 = digits + "0".repeat(newDotPos - digits.length);
37669
+ } else {
37670
+ result2 = digits.slice(0, newDotPos) + "." + digits.slice(newDotPos);
37671
+ }
37672
+ }
37673
+ if (result2.includes(".")) {
37674
+ result2 = result2.replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
37675
+ }
37676
+ return (negative ? "-" : "") + result2;
37677
+ }
37678
+ function expandExponentToBigInt(s2) {
37679
+ const eIndex = s2.search(/[eE]/);
37680
+ const exp = parseInt(s2.slice(eIndex + 1), 10);
37681
+ const negative = s2.startsWith("-");
37682
+ const mantissa = s2.slice(negative ? 1 : 0, eIndex);
37683
+ const dotIndex = mantissa.indexOf(".");
37684
+ let digits;
37685
+ let shift;
37686
+ if (dotIndex === -1) {
37687
+ digits = mantissa;
37688
+ shift = exp;
37689
+ } else {
37690
+ digits = mantissa.slice(0, dotIndex) + mantissa.slice(dotIndex + 1);
37691
+ const fracDigits = mantissa.length - dotIndex - 1;
37692
+ shift = exp - fracDigits;
37693
+ }
37694
+ digits = digits.replace(/0+$/, "") || "0";
37695
+ const result2 = BigInt(digits) * 10n ** BigInt(shift + (mantissa.replace(".", "").length - digits.length));
37696
+ return negative ? -result2 : result2;
37697
+ }
37597
37698
  var init_jsonReviver = __esm({
37598
37699
  "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js"() {
37599
37700
  init_serde();
37600
37701
  __name(jsonReviver, "jsonReviver");
37601
- __name(isFractionalNumeric, "isFractionalNumeric");
37702
+ __name(isFractionalBigNumeric, "isFractionalBigNumeric");
37703
+ __name(isRepresentable, "isRepresentable");
37704
+ __name(expandToDecimal, "expandToDecimal");
37705
+ __name(expandExponentToBigInt, "expandExponentToBigInt");
37602
37706
  }
37603
37707
  });
37604
37708
 
@@ -37660,29 +37764,6 @@ var init_common2 = __esm({
37660
37764
  }
37661
37765
  });
37662
37766
 
37663
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js
37664
- function detectBufferParsing() {
37665
- if (canParseBuffer === void 0) {
37666
- try {
37667
- if (typeof Buffer !== "function") {
37668
- canParseBuffer = false;
37669
- } else {
37670
- const result2 = JSON.parse(Buffer.from([123, 125]));
37671
- canParseBuffer = result2 !== null && typeof result2 === "object";
37672
- }
37673
- } catch {
37674
- canParseBuffer = false;
37675
- }
37676
- }
37677
- return canParseBuffer;
37678
- }
37679
- var canParseBuffer;
37680
- var init_detectBufferParsing = __esm({
37681
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js"() {
37682
- __name(detectBufferParsing, "detectBufferParsing");
37683
- }
37684
- });
37685
-
37686
37767
  // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js
37687
37768
  async function parseJsonBody(streamBody, context, schema) {
37688
37769
  let parsingInput;
@@ -37788,23 +37869,23 @@ var init_writeKey = __esm({
37788
37869
  }
37789
37870
  });
37790
37871
 
37791
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js
37792
- var JsonShapeDeserializer;
37793
- var init_JsonShapeDeserializer = __esm({
37794
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js"() {
37872
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js
37873
+ var JsonShapeDeserializer2;
37874
+ var init_JsonShapeDeserializer2 = __esm({
37875
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js"() {
37795
37876
  init_protocols();
37796
37877
  init_schema4();
37797
37878
  init_serde();
37798
- init_serde();
37799
37879
  init_ConfigurableSerdeContext();
37800
37880
  init_UnionSerde();
37881
+ init_detectBufferParsing();
37801
37882
  init_jsonReviver();
37802
37883
  init_needsReviver();
37803
37884
  init_parseJsonBody();
37804
37885
  init_writeKey();
37805
- JsonShapeDeserializer = class extends SerdeContextConfig {
37886
+ JsonShapeDeserializer2 = class extends SerdeContextConfig {
37806
37887
  static {
37807
- __name(this, "JsonShapeDeserializer");
37888
+ __name(this, "JsonShapeDeserializer2");
37808
37889
  }
37809
37890
  settings;
37810
37891
  constructor(settings) {
@@ -37813,7 +37894,22 @@ var init_JsonShapeDeserializer = __esm({
37813
37894
  }
37814
37895
  async read(schema, data) {
37815
37896
  const reviver = needsReviver(schema) ? jsonReviver : void 0;
37816
- return this._read(schema, typeof data === "string" ? JSON.parse(data, reviver) : await parseJsonBody(data, this.serdeContext, schema));
37897
+ let parsed;
37898
+ if (typeof data === "string") {
37899
+ if (data.length === 0) {
37900
+ return {};
37901
+ }
37902
+ parsed = JSON.parse(data, reviver);
37903
+ } else if (data instanceof Uint8Array && detectBufferParsing()) {
37904
+ if (data.byteLength === 0) {
37905
+ return {};
37906
+ }
37907
+ const buf2 = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
37908
+ parsed = JSON.parse(buf2, reviver);
37909
+ } else {
37910
+ parsed = await parseJsonBody(data, this.serdeContext, schema);
37911
+ }
37912
+ return this._read(schema, parsed);
37817
37913
  }
37818
37914
  readObject(schema, data) {
37819
37915
  return this._read(schema, data);
@@ -37823,62 +37919,29 @@ var init_JsonShapeDeserializer = __esm({
37823
37919
  const ns = NormalizedSchema.of(schema);
37824
37920
  if (isObject3) {
37825
37921
  if (ns.isStructSchema()) {
37826
- const record = value2;
37827
- const union = ns.isUnionSchema();
37828
- const out = {};
37829
- let nameMap = void 0;
37830
- const { jsonName } = this.settings;
37831
- if (jsonName) {
37832
- nameMap = {};
37833
- }
37834
- let unionSerde;
37835
- if (union) {
37836
- unionSerde = new UnionSerde(record, out);
37837
- }
37838
- for (const [memberName, memberSchema] of ns.structIterator()) {
37839
- let fromKey = memberName;
37840
- if (jsonName) {
37841
- fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
37842
- nameMap[fromKey] = memberName;
37843
- }
37844
- if (union) {
37845
- unionSerde.mark(fromKey);
37846
- }
37847
- if (record[fromKey] != null) {
37848
- out[memberName] = this._read(memberSchema, record[fromKey]);
37849
- }
37850
- }
37851
- if (union) {
37852
- unionSerde.writeUnknown();
37853
- } else if (typeof record.__type === "string") {
37854
- for (const k6 in record) {
37855
- const v = record[k6];
37856
- const t = jsonName ? nameMap[k6] ?? k6 : k6;
37857
- if (!(t in out)) {
37858
- out[t] = v;
37859
- }
37860
- }
37861
- }
37862
- return out;
37922
+ return this._readStruct(ns, value2);
37863
37923
  }
37864
37924
  if (Array.isArray(value2) && ns.isListSchema()) {
37865
37925
  const listMember = ns.getValueSchema();
37866
- const out = [];
37867
- for (const item of value2) {
37868
- out.push(this._read(listMember, item));
37926
+ if (this.needsTransform(listMember)) {
37927
+ for (let i6 = 0; i6 < value2.length; ++i6) {
37928
+ value2[i6] = this._read(listMember, value2[i6]);
37929
+ }
37869
37930
  }
37870
- return out;
37931
+ return value2;
37871
37932
  }
37872
37933
  if (ns.isMapSchema()) {
37873
37934
  const mapMember = ns.getValueSchema();
37874
- const out = {};
37875
- for (const _k in value2) {
37876
- if (_k === "__proto__") {
37877
- writeKey(out);
37935
+ const map3 = value2;
37936
+ if (this.needsTransform(mapMember)) {
37937
+ for (const k6 in map3) {
37938
+ if (k6 === "__proto__") {
37939
+ writeKey(map3);
37940
+ }
37941
+ map3[k6] = this._read(mapMember, map3[k6]);
37878
37942
  }
37879
- out[_k] = this._read(mapMember, value2[_k]);
37880
37943
  }
37881
- return out;
37944
+ return map3;
37882
37945
  }
37883
37946
  }
37884
37947
  if (ns.isBlobSchema() && typeof value2 === "string") {
@@ -37932,292 +37995,723 @@ var init_JsonShapeDeserializer = __esm({
37932
37995
  }
37933
37996
  if (ns.isDocumentSchema()) {
37934
37997
  if (isObject3) {
37935
- const out = Array.isArray(value2) ? [] : {};
37936
- for (const k6 in value2) {
37937
- if (k6 === "__proto__") {
37938
- writeKey(out);
37998
+ if (Array.isArray(value2)) {
37999
+ for (let i6 = 0; i6 < value2.length; ++i6) {
38000
+ const v = value2[i6];
38001
+ if (!(v instanceof NumericValue)) {
38002
+ value2[i6] = this._read(ns, v);
38003
+ }
37939
38004
  }
37940
- const v = value2[k6];
37941
- if (v instanceof NumericValue) {
37942
- out[k6] = v;
37943
- } else {
37944
- out[k6] = this._read(ns, v);
38005
+ } else {
38006
+ const doc = value2;
38007
+ for (const k6 in doc) {
38008
+ if (k6 === "__proto__") {
38009
+ writeKey(doc);
38010
+ }
38011
+ const v = doc[k6];
38012
+ if (!(v instanceof NumericValue)) {
38013
+ doc[k6] = this._read(ns, v);
38014
+ }
37945
38015
  }
37946
38016
  }
37947
- return out;
37948
- } else {
37949
- return structuredClone(value2);
37950
38017
  }
37951
38018
  }
37952
38019
  return value2;
37953
38020
  }
38021
+ _readStruct(ns, record) {
38022
+ const union = ns.isUnionSchema();
38023
+ const out = {};
38024
+ let nameMap;
38025
+ const hasType = typeof record.__type === "string";
38026
+ const { jsonName } = this.settings;
38027
+ if (jsonName && hasType) {
38028
+ nameMap = {};
38029
+ }
38030
+ let unionSerde;
38031
+ if (union) {
38032
+ unionSerde = new UnionSerde(record, out);
38033
+ }
38034
+ for (const [memberName, memberSchema] of ns.structIterator()) {
38035
+ let fromKey = memberName;
38036
+ if (jsonName) {
38037
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
38038
+ if (hasType) {
38039
+ nameMap[fromKey] = memberName;
38040
+ }
38041
+ }
38042
+ if (union) {
38043
+ unionSerde.mark(fromKey);
38044
+ }
38045
+ if (record[fromKey] != null) {
38046
+ out[memberName] = this._read(memberSchema, record[fromKey]);
38047
+ }
38048
+ }
38049
+ if (union) {
38050
+ unionSerde.writeUnknown();
38051
+ } else if (hasType) {
38052
+ for (const k6 in record) {
38053
+ const v = record[k6];
38054
+ const t = jsonName ? nameMap[k6] ?? k6 : k6;
38055
+ if (!(t in out)) {
38056
+ out[t] = v;
38057
+ }
38058
+ }
38059
+ }
38060
+ return out;
38061
+ }
38062
+ needsTransform(ns) {
38063
+ if (ns.isBlobSchema() || ns.isTimestampSchema() || ns.isBigIntegerSchema() || ns.isBigDecimalSchema()) {
38064
+ return true;
38065
+ }
38066
+ if (ns.isDocumentSchema() || ns.isStructSchema() || ns.isListSchema() || ns.isMapSchema()) {
38067
+ return true;
38068
+ }
38069
+ if (ns.isStringSchema() && ns.getMergedTraits().mediaType) {
38070
+ return true;
38071
+ }
38072
+ return false;
38073
+ }
37954
38074
  };
37955
38075
  }
37956
38076
  });
37957
38077
 
37958
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js
37959
- var NUMERIC_CONTROL_CHAR, JsonReplacer;
37960
- var init_jsonReplacer = __esm({
37961
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js"() {
38078
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js
38079
+ var JsonBytesStringAdapter, warned;
38080
+ var init_JsonBytesStringAdapter = __esm({
38081
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js"() {
37962
38082
  init_serde();
37963
- NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
37964
- JsonReplacer = class {
38083
+ JsonBytesStringAdapter = class _JsonBytesStringAdapter extends Uint8Array {
37965
38084
  static {
37966
- __name(this, "JsonReplacer");
38085
+ __name(this, "JsonBytesStringAdapter");
37967
38086
  }
37968
- values = /* @__PURE__ */ new Map();
37969
- counter = 0;
37970
- stage = 0;
37971
- createReplacer() {
37972
- if (this.stage === 1) {
37973
- throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
38087
+ string = null;
38088
+ static allocUnsafe(bytes) {
38089
+ if (typeof Buffer === "function") {
38090
+ const buffer = Buffer.allocUnsafe(bytes);
38091
+ return new _JsonBytesStringAdapter(buffer.buffer, buffer.byteOffset, buffer.byteLength);
37974
38092
  }
37975
- if (this.stage === 2) {
37976
- throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
38093
+ return new _JsonBytesStringAdapter(bytes);
38094
+ }
38095
+ toString() {
38096
+ return this.s();
38097
+ }
38098
+ valueOf() {
38099
+ return this.s();
38100
+ }
38101
+ includes(searchString, position) {
38102
+ if (typeof searchString === "string") {
38103
+ return this.s().includes(searchString, position);
37977
38104
  }
37978
- this.stage = 1;
37979
- return (key, value2) => {
37980
- if (value2 instanceof NumericValue) {
37981
- const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value2.string;
37982
- this.values.set(`"${v}"`, value2.string);
37983
- return v;
37984
- }
37985
- if (typeof value2 === "bigint") {
37986
- const s2 = value2.toString();
37987
- const v = `${NUMERIC_CONTROL_CHAR + "b" + this.counter++}_` + s2;
37988
- this.values.set(`"${v}"`, s2);
37989
- return v;
37990
- }
37991
- return value2;
37992
- };
38105
+ return Uint8Array.prototype.includes.call(this, searchString, position);
37993
38106
  }
37994
- replaceInJson(json) {
37995
- if (this.stage === 0) {
37996
- throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
38107
+ indexOf(searchString, position) {
38108
+ if (typeof searchString === "string") {
38109
+ return this.s().indexOf(searchString, position);
37997
38110
  }
37998
- if (this.stage === 2) {
37999
- throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
38111
+ return Uint8Array.prototype.indexOf.call(this, searchString, position);
38112
+ }
38113
+ lastIndexOf(searchString, position) {
38114
+ if (typeof searchString === "string") {
38115
+ return this.s().lastIndexOf(searchString, position);
38000
38116
  }
38001
- this.stage = 2;
38002
- if (this.counter === 0) {
38003
- return json;
38117
+ const fn = Uint8Array.prototype.lastIndexOf;
38118
+ if (position !== void 0) {
38119
+ return fn.call(this, searchString, position);
38004
38120
  }
38005
- for (const [key, value2] of this.values) {
38006
- json = json.replace(key, value2);
38121
+ return fn.call(this, searchString);
38122
+ }
38123
+ startsWith(searchString, position) {
38124
+ return this.s().startsWith(searchString, position);
38125
+ }
38126
+ endsWith(searchString, endPosition) {
38127
+ return this.s().endsWith(searchString, endPosition);
38128
+ }
38129
+ match(regexp) {
38130
+ return this.s().match(regexp);
38131
+ }
38132
+ replace(searchValue, replaceValue) {
38133
+ return this.s().replace(searchValue, replaceValue);
38134
+ }
38135
+ search(regexp) {
38136
+ return this.s().search(regexp);
38137
+ }
38138
+ split(separator, limit) {
38139
+ return this.s().split(separator, limit);
38140
+ }
38141
+ substring(start, end2) {
38142
+ return this.s().substring(start, end2);
38143
+ }
38144
+ trim() {
38145
+ return this.s().trim();
38146
+ }
38147
+ trimStart() {
38148
+ return this.s().trimStart();
38149
+ }
38150
+ trimEnd() {
38151
+ return this.s().trimEnd();
38152
+ }
38153
+ charAt(pos2) {
38154
+ return this.s().charAt(pos2);
38155
+ }
38156
+ charCodeAt(index) {
38157
+ return this.s().charCodeAt(index);
38158
+ }
38159
+ padStart(maxLength, fillString) {
38160
+ return this.s().padStart(maxLength, fillString);
38161
+ }
38162
+ padEnd(maxLength, fillString) {
38163
+ return this.s().padEnd(maxLength, fillString);
38164
+ }
38165
+ repeat(count) {
38166
+ return this.s().repeat(count);
38167
+ }
38168
+ toUpperCase() {
38169
+ return this.s().toUpperCase();
38170
+ }
38171
+ toLowerCase() {
38172
+ return this.s().toLowerCase();
38173
+ }
38174
+ s() {
38175
+ if (this.string == null) {
38176
+ const n3 = Date.now();
38177
+ if (n3 > warned + 6e4) {
38178
+ console.warn("@aws-sdk/core/protocols - WARN - JsonCodec2: you have called a string method on a Uint8Array request body. It has been automatically converted to string. In a future version this will throw an error.");
38179
+ warned = n3;
38180
+ }
38181
+ this.string = toUtf8(this);
38007
38182
  }
38008
- return json;
38183
+ return this.string;
38009
38184
  }
38010
38185
  };
38186
+ warned = 0;
38011
38187
  }
38012
38188
  });
38013
38189
 
38014
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js
38015
- var JsonShapeSerializer;
38016
- var init_JsonShapeSerializer = __esm({
38017
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js"() {
38190
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js
38191
+ function alloc(size) {
38192
+ return JsonBytesStringAdapter.allocUnsafe(size);
38193
+ }
38194
+ var encoder, OPEN_BRACE, CLOSE_BRACE, OPEN_BRACKET, CLOSE_BRACKET, QUOTE, COLON, COMMA, BACKSLASH, TRUE, FALSE, NULL, ESCAPE_TABLE, INITIAL_BUFFER_SIZE2, JsonShapeSerializer2;
38195
+ var init_JsonShapeSerializer2 = __esm({
38196
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js"() {
38018
38197
  init_protocols();
38019
38198
  init_schema4();
38020
38199
  init_serde();
38021
38200
  init_ConfigurableSerdeContext();
38022
- init_jsonReplacer();
38023
- init_writeKey();
38024
- JsonShapeSerializer = class extends SerdeContextConfig {
38201
+ init_JsonBytesStringAdapter();
38202
+ encoder = new TextEncoder();
38203
+ OPEN_BRACE = 123;
38204
+ CLOSE_BRACE = 125;
38205
+ OPEN_BRACKET = 91;
38206
+ CLOSE_BRACKET = 93;
38207
+ QUOTE = 34;
38208
+ COLON = 58;
38209
+ COMMA = 44;
38210
+ BACKSLASH = 92;
38211
+ TRUE = new Uint8Array([116, 114, 117, 101]);
38212
+ FALSE = new Uint8Array([102, 97, 108, 115, 101]);
38213
+ NULL = new Uint8Array([110, 117, 108, 108]);
38214
+ ESCAPE_TABLE = new Array(128).fill(null);
38215
+ ESCAPE_TABLE[8] = "b";
38216
+ ESCAPE_TABLE[9] = "t";
38217
+ ESCAPE_TABLE[10] = "n";
38218
+ ESCAPE_TABLE[12] = "f";
38219
+ ESCAPE_TABLE[13] = "r";
38220
+ ESCAPE_TABLE[34] = '"';
38221
+ ESCAPE_TABLE[92] = "\\";
38222
+ for (let i6 = 0; i6 < 32; i6++) {
38223
+ if (ESCAPE_TABLE[i6] === null) {
38224
+ ESCAPE_TABLE[i6] = "u00" + i6.toString(16).padStart(2, "0");
38225
+ }
38226
+ }
38227
+ INITIAL_BUFFER_SIZE2 = 2048;
38228
+ __name(alloc, "alloc");
38229
+ JsonShapeSerializer2 = class _JsonShapeSerializer2 extends SerdeContextConfig {
38025
38230
  static {
38026
- __name(this, "JsonShapeSerializer");
38231
+ __name(this, "JsonShapeSerializer2");
38027
38232
  }
38028
38233
  settings;
38029
- buffer;
38030
- useReplacer = false;
38234
+ json;
38235
+ i = 0;
38031
38236
  rootSchema;
38237
+ rawValue;
38238
+ passthrough = false;
38032
38239
  constructor(settings) {
38033
38240
  super();
38034
38241
  this.settings = settings;
38242
+ this.json = alloc(INITIAL_BUFFER_SIZE2);
38035
38243
  }
38036
38244
  write(schema, value2) {
38245
+ this.i = 0;
38246
+ this.rawValue = value2;
38037
38247
  this.rootSchema = NormalizedSchema.of(schema);
38038
- this.buffer = this._write(this.rootSchema, value2);
38248
+ this.passthrough = this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema();
38249
+ if (!this.passthrough) {
38250
+ this.writeValue(this.rootSchema, value2, void 0);
38251
+ }
38252
+ }
38253
+ writeDiscriminatedDocument(schema, value2) {
38254
+ this.i = 0;
38255
+ this.rootSchema = NormalizedSchema.of(schema);
38256
+ const ns = this.rootSchema;
38257
+ if (ns.isStructSchema() && value2 != null && typeof value2 === "object") {
38258
+ this.writeValue(ns, value2, void 0);
38259
+ const prefix = `"__type":"${ns.getName(true) ?? "Unknown"}",`;
38260
+ const z = prefix.length;
38261
+ this.ensure(z);
38262
+ this.json.copyWithin(1 + z, 1, this.i);
38263
+ encoder.encodeInto(prefix, this.json.subarray(1));
38264
+ this.i += z;
38265
+ } else {
38266
+ this.writeValue(ns, value2, void 0);
38267
+ }
38039
38268
  }
38040
38269
  flush() {
38041
- const { rootSchema, useReplacer } = this;
38042
38270
  this.rootSchema = void 0;
38043
- this.useReplacer = false;
38044
- if (rootSchema?.isStructSchema() || rootSchema?.isDocumentSchema()) {
38045
- if (!useReplacer) {
38046
- return JSON.stringify(this.buffer);
38271
+ const finalPosition = this.i;
38272
+ this.i = 0;
38273
+ const raw = this.rawValue;
38274
+ this.rawValue = void 0;
38275
+ if (finalPosition === 0) {
38276
+ return raw;
38277
+ }
38278
+ const result2 = this.json.subarray(0, finalPosition);
38279
+ this.json = alloc(INITIAL_BUFFER_SIZE2);
38280
+ return result2;
38281
+ }
38282
+ ensure(byteCount) {
38283
+ const { i: i6, json } = this;
38284
+ if (i6 + byteCount > json.length) {
38285
+ let newSize = json.length * 2;
38286
+ while (newSize < i6 + byteCount) {
38287
+ newSize *= 2;
38047
38288
  }
38048
- const replacer = new JsonReplacer();
38049
- return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
38289
+ const next = alloc(newSize);
38290
+ next.set(this.json);
38291
+ this.json = next;
38050
38292
  }
38051
- return this.buffer;
38052
38293
  }
38053
- writeDiscriminatedDocument(schema, value2) {
38054
- this.write(schema, value2);
38055
- if (typeof this.buffer === "object") {
38056
- this.buffer.__type = NormalizedSchema.of(schema).getName(true);
38294
+ writeAscii(s2) {
38295
+ const z = s2.length;
38296
+ this.ensure(z);
38297
+ let { i: i6, json } = this;
38298
+ for (let j6 = 0; j6 < z; ++j6) {
38299
+ json[i6] = s2.charCodeAt(j6);
38300
+ i6 += 1;
38057
38301
  }
38302
+ this.i = i6;
38058
38303
  }
38059
- _write(schema, value2, container) {
38060
- const isObject3 = value2 !== null && typeof value2 === "object";
38061
- const ns = NormalizedSchema.of(schema);
38062
- if (isObject3) {
38063
- if (ns.isStructSchema()) {
38064
- const record = value2;
38065
- const out = {};
38066
- const { jsonName } = this.settings;
38067
- let nameMap = void 0;
38068
- if (jsonName) {
38069
- nameMap = {};
38070
- }
38071
- let outCount = 0;
38072
- for (const [memberName, memberSchema] of ns.structIterator()) {
38073
- const serializableValue = this._write(memberSchema, record[memberName], ns);
38074
- if (serializableValue !== void 0) {
38075
- let targetKey = memberName;
38076
- if (jsonName) {
38077
- targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
38078
- nameMap[memberName] = targetKey;
38079
- }
38080
- out[targetKey] = serializableValue;
38081
- outCount++;
38304
+ writeAsciiQuoted(s2) {
38305
+ const z = s2.length;
38306
+ this.ensure(z + 4);
38307
+ let { json, i: i6 } = this;
38308
+ json[i6++] = QUOTE;
38309
+ for (let j6 = 0; j6 < z; ++j6) {
38310
+ json[i6++] = s2.charCodeAt(j6);
38311
+ }
38312
+ json[i6++] = QUOTE;
38313
+ this.i = i6;
38314
+ }
38315
+ writeJsonString(s2) {
38316
+ this.ensure(s2.length * 3 + 2);
38317
+ this.json[this.i++] = QUOTE;
38318
+ const z = s2.length;
38319
+ for (let j6 = 0; j6 < z; ++j6) {
38320
+ const c6 = s2.charCodeAt(j6);
38321
+ if (c6 > 34 && c6 < 92) {
38322
+ this.json[this.i++] = c6;
38323
+ } else if (c6 < 128) {
38324
+ const esc = ESCAPE_TABLE[c6];
38325
+ if (esc !== null) {
38326
+ this.ensure(esc.length + 1);
38327
+ this.json[this.i++] = BACKSLASH;
38328
+ for (let k6 = 0; k6 < esc.length; k6++) {
38329
+ this.json[this.i++] = esc.charCodeAt(k6);
38082
38330
  }
38331
+ } else {
38332
+ this.json[this.i++] = c6;
38083
38333
  }
38084
- if (ns.isUnionSchema() && outCount === 0) {
38085
- const { $unknown } = record;
38086
- if (Array.isArray($unknown)) {
38087
- const [k6, v] = $unknown;
38088
- if (k6 === "__proto__") {
38089
- writeKey(out);
38090
- }
38091
- out[k6] = this._write(15, v);
38092
- }
38093
- } else if (typeof record.__type === "string") {
38094
- for (const k6 in record) {
38095
- const v = record[k6];
38096
- const targetKey = jsonName ? nameMap[k6] ?? k6 : k6;
38097
- if (!(targetKey in out)) {
38098
- out[targetKey] = this._write(15, v);
38099
- }
38100
- }
38334
+ } else if (c6 >= 55296 && c6 <= 56319) {
38335
+ const next = j6 + 1 < z ? s2.charCodeAt(j6 + 1) : 0;
38336
+ if (next >= 56320 && next <= 57343) {
38337
+ this.ensure(4);
38338
+ const { written } = encoder.encodeInto(s2.substring(j6, j6 + 2), this.json.subarray(this.i));
38339
+ this.i += written;
38340
+ ++j6;
38341
+ } else {
38342
+ this.ensure(6);
38343
+ this.writeUnicodeEscape(c6);
38101
38344
  }
38102
- return out;
38345
+ } else if (c6 >= 56320 && c6 <= 57343) {
38346
+ this.ensure(6);
38347
+ this.writeUnicodeEscape(c6);
38348
+ } else {
38349
+ let { i: i6, json } = this;
38350
+ if (c6 < 2048) {
38351
+ json[i6++] = 192 | c6 >> 6;
38352
+ json[i6++] = 128 | c6 & 63;
38353
+ } else {
38354
+ json[i6++] = 224 | c6 >> 12;
38355
+ json[i6++] = 128 | c6 >> 6 & 63;
38356
+ json[i6++] = 128 | c6 & 63;
38357
+ }
38358
+ this.i = i6;
38103
38359
  }
38104
- if (Array.isArray(value2) && ns.isListSchema()) {
38105
- const listMember = ns.getValueSchema();
38106
- const out = [];
38107
- const sparse = !!ns.getMergedTraits().sparse;
38108
- for (const item of value2) {
38109
- if (sparse || item != null) {
38110
- out.push(this._write(listMember, item));
38360
+ }
38361
+ this.json[this.i++] = QUOTE;
38362
+ }
38363
+ writeUnicodeEscape(code) {
38364
+ let { json, i: i6 } = this;
38365
+ json[i6++] = BACKSLASH;
38366
+ json[i6++] = 117;
38367
+ const hex = code.toString(16).padStart(4, "0");
38368
+ for (let j6 = 0; j6 < 4; ++j6) {
38369
+ json[i6++] = hex.charCodeAt(j6);
38370
+ }
38371
+ this.i = i6;
38372
+ }
38373
+ static B64 = (() => {
38374
+ const chars3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
38375
+ const table3 = new Uint8Array(64);
38376
+ for (let i6 = 0; i6 < 64; ++i6) {
38377
+ table3[i6] = chars3.charCodeAt(i6);
38378
+ }
38379
+ return table3;
38380
+ })();
38381
+ writeBase64(data) {
38382
+ const b64Len = Math.ceil(data.length / 3) * 4;
38383
+ this.ensure(b64Len + 2);
38384
+ const json = this.json;
38385
+ const B64 = _JsonShapeSerializer2.B64;
38386
+ let i6 = this.i;
38387
+ json[i6++] = QUOTE;
38388
+ const len = data.length;
38389
+ const remainder = len % 3;
38390
+ const mainLen = len - remainder;
38391
+ for (let j6 = 0; j6 < mainLen; j6 += 3) {
38392
+ const a6 = data[j6];
38393
+ const b6 = data[j6 + 1];
38394
+ const c6 = data[j6 + 2];
38395
+ json[i6++] = B64[a6 >> 2];
38396
+ json[i6++] = B64[(a6 & 3) << 4 | b6 >> 4];
38397
+ json[i6++] = B64[(b6 & 15) << 2 | c6 >> 6];
38398
+ json[i6++] = B64[c6 & 63];
38399
+ }
38400
+ if (remainder === 2) {
38401
+ const a6 = data[mainLen];
38402
+ const b6 = data[mainLen + 1];
38403
+ json[i6++] = B64[a6 >> 2];
38404
+ json[i6++] = B64[(a6 & 3) << 4 | b6 >> 4];
38405
+ json[i6++] = B64[(b6 & 15) << 2];
38406
+ json[i6++] = 61;
38407
+ } else if (remainder === 1) {
38408
+ const a6 = data[mainLen];
38409
+ json[i6++] = B64[a6 >> 2];
38410
+ json[i6++] = B64[(a6 & 3) << 4];
38411
+ json[i6++] = 61;
38412
+ json[i6++] = 61;
38413
+ }
38414
+ json[i6++] = QUOTE;
38415
+ this.i = i6;
38416
+ }
38417
+ writeValue(schema, value2, container) {
38418
+ if (value2 == null) {
38419
+ if (container?.isStructSchema()) {
38420
+ if (value2 === void 0) {
38421
+ const ns2 = NormalizedSchema.of(schema);
38422
+ if (ns2.isIdempotencyToken()) {
38423
+ this.writeAsciiQuoted(generateIdempotencyToken());
38424
+ return;
38111
38425
  }
38112
38426
  }
38113
- return out;
38427
+ return;
38114
38428
  }
38115
- if (ns.isMapSchema()) {
38116
- const mapMember = ns.getValueSchema();
38117
- const out = {};
38118
- const sparse = !!ns.getMergedTraits().sparse;
38119
- for (const _k in value2) {
38120
- const _v = value2[_k];
38121
- if (sparse || _v != null) {
38122
- if (_k === "__proto__") {
38123
- writeKey(out);
38124
- }
38125
- out[_k] = this._write(mapMember, _v);
38126
- }
38429
+ this.ensure(4);
38430
+ this.json.set(NULL, this.i);
38431
+ this.i += 4;
38432
+ return;
38433
+ }
38434
+ const ns = NormalizedSchema.of(schema);
38435
+ const isObject3 = typeof value2 === "object";
38436
+ if (ns.isStringSchema()) {
38437
+ const mediaType = ns.getMergedTraits().mediaType;
38438
+ if (mediaType) {
38439
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
38440
+ if (isJson) {
38441
+ this.writeJsonString(LazyJsonString.from(value2).toString());
38442
+ return;
38127
38443
  }
38128
- return out;
38444
+ }
38445
+ }
38446
+ if (isObject3) {
38447
+ if (ns.isStructSchema()) {
38448
+ this.writeStruct(ns, value2);
38449
+ return;
38450
+ }
38451
+ if (Array.isArray(value2) && (ns.isListSchema() || ns.isDocumentSchema())) {
38452
+ this.writeList(ns, value2, ns.isDocumentSchema());
38453
+ return;
38454
+ }
38455
+ if (ns.isMapSchema()) {
38456
+ this.writeMap(ns, value2, false);
38457
+ return;
38129
38458
  }
38130
38459
  if (value2 instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
38131
- if (ns === this.rootSchema) {
38132
- return value2;
38133
- }
38134
- return (this.serdeContext?.base64Encoder ?? toBase64)(value2);
38460
+ this.writeBase64(value2);
38461
+ return;
38135
38462
  }
38136
38463
  if (value2 instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
38137
- const format30 = determineTimestampFormat(ns, this.settings);
38138
- switch (format30) {
38139
- case 5:
38140
- return value2.toISOString().replace(".000Z", "Z");
38141
- case 6:
38142
- return dateToUtcString(value2);
38143
- case 7:
38144
- return value2.getTime() / 1e3;
38145
- default:
38146
- console.warn("Missing timestamp format, using epoch seconds", value2);
38147
- return value2.getTime() / 1e3;
38148
- }
38464
+ this.writeTimestamp(ns, value2);
38465
+ return;
38149
38466
  }
38150
38467
  if (value2 instanceof NumericValue) {
38151
- this.useReplacer = true;
38468
+ this.writeAscii(value2.string);
38469
+ return;
38152
38470
  }
38471
+ if (ns.isDocumentSchema()) {
38472
+ if (Array.isArray(value2)) {
38473
+ this.writeList(ns, value2, true);
38474
+ } else {
38475
+ this.writeMap(ns, value2, true);
38476
+ }
38477
+ return;
38478
+ }
38479
+ const json = JSON.stringify(value2);
38480
+ this.writeAscii(json);
38481
+ return;
38153
38482
  }
38154
- if (value2 === null && container?.isStructSchema()) {
38155
- return void 0;
38483
+ if (typeof value2 === "string") {
38484
+ if (ns.isBlobSchema()) {
38485
+ const b64 = (this.serdeContext?.base64Encoder ?? toBase64)(value2);
38486
+ this.writeAsciiQuoted(b64);
38487
+ return;
38488
+ }
38489
+ this.writeJsonString(value2);
38490
+ return;
38156
38491
  }
38157
- if (ns.isStringSchema()) {
38158
- if (typeof value2 === "undefined" && ns.isIdempotencyToken()) {
38159
- return generateIdempotencyToken();
38492
+ if (typeof value2 === "number") {
38493
+ if (Math.abs(value2) === Infinity || Number.isNaN(value2)) {
38494
+ this.writeAsciiQuoted(String(value2));
38495
+ return;
38160
38496
  }
38161
- const mediaType = ns.getMergedTraits().mediaType;
38162
- if (value2 != null && mediaType) {
38163
- const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
38164
- if (isJson) {
38165
- return LazyJsonString.from(value2);
38166
- }
38497
+ const numStr = String(value2);
38498
+ this.writeAscii(numStr);
38499
+ return;
38500
+ }
38501
+ if (typeof value2 === "boolean") {
38502
+ this.ensure(5);
38503
+ let { i: i6, json } = this;
38504
+ if (value2) {
38505
+ json.set(TRUE, i6);
38506
+ i6 += 4;
38507
+ } else {
38508
+ json.set(FALSE, i6);
38509
+ i6 += 5;
38167
38510
  }
38168
- return value2;
38511
+ this.i = i6;
38512
+ return;
38169
38513
  }
38170
- if (typeof value2 === "number" && ns.isNumericSchema()) {
38171
- if (Math.abs(value2) === Infinity || isNaN(value2)) {
38172
- return String(value2);
38514
+ if (typeof value2 === "bigint") {
38515
+ this.writeAscii(value2.toString());
38516
+ return;
38517
+ }
38518
+ this.writeAscii(String(value2));
38519
+ }
38520
+ writeStruct(ns, value2) {
38521
+ this.ensure(2);
38522
+ this.json[this.i++] = OPEN_BRACE;
38523
+ let wroteAny = false;
38524
+ const hasType = typeof value2.__type === "string";
38525
+ let writtenKeys;
38526
+ if (hasType) {
38527
+ writtenKeys = /* @__PURE__ */ new Set();
38528
+ }
38529
+ for (const [memberName, memberSchema] of ns.structIterator()) {
38530
+ const item = value2[memberName];
38531
+ if (item == null && !memberSchema.isIdempotencyToken()) {
38532
+ continue;
38173
38533
  }
38174
- return value2;
38534
+ if (wroteAny) {
38535
+ this.ensure(1);
38536
+ this.json[this.i++] = COMMA;
38537
+ }
38538
+ wroteAny = true;
38539
+ const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
38540
+ if (writtenKeys) {
38541
+ writtenKeys.add(memberName);
38542
+ writtenKeys.add(targetKey);
38543
+ }
38544
+ this.writeAsciiQuoted(targetKey);
38545
+ this.json[this.i++] = COLON;
38546
+ this.writeValue(memberSchema, item, ns);
38175
38547
  }
38176
- if (typeof value2 === "string" && ns.isBlobSchema()) {
38177
- if (ns === this.rootSchema) {
38178
- return value2;
38548
+ if (!wroteAny && ns.isUnionSchema()) {
38549
+ const { $unknown } = value2;
38550
+ if (Array.isArray($unknown)) {
38551
+ const [k6, v] = $unknown;
38552
+ this.writeAsciiQuoted(k6);
38553
+ this.ensure(1);
38554
+ this.json[this.i++] = COLON;
38555
+ this.writeValue(15, v, ns);
38556
+ }
38557
+ } else if (hasType) {
38558
+ for (const k6 in value2) {
38559
+ if (writtenKeys.has(k6)) {
38560
+ continue;
38561
+ }
38562
+ writtenKeys.add(k6);
38563
+ const v = value2[k6];
38564
+ if (wroteAny) {
38565
+ this.ensure(1);
38566
+ this.json[this.i++] = COMMA;
38567
+ }
38568
+ wroteAny = true;
38569
+ this.writeAsciiQuoted(k6);
38570
+ this.ensure(1);
38571
+ this.json[this.i++] = COLON;
38572
+ this.writeValue(15, v, void 0);
38179
38573
  }
38180
- return (this.serdeContext?.base64Encoder ?? toBase64)(value2);
38181
38574
  }
38182
- if (typeof value2 === "bigint") {
38183
- this.useReplacer = true;
38575
+ this.ensure(1);
38576
+ this.json[this.i++] = CLOSE_BRACE;
38577
+ }
38578
+ writeList(ns, value2, isDocument) {
38579
+ const sparse = !!ns.getMergedTraits().sparse;
38580
+ const valueSchema = ns.getValueSchema();
38581
+ if (!isDocument) {
38582
+ if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
38583
+ let hasSpecials = false;
38584
+ for (let i6 = 0; i6 < value2.length; ++i6) {
38585
+ const v = value2[i6];
38586
+ if (Number.isNaN(v) || v === Infinity || v === -Infinity || v == null && !sparse) {
38587
+ hasSpecials = true;
38588
+ break;
38589
+ }
38590
+ }
38591
+ let json;
38592
+ if (!hasSpecials) {
38593
+ json = JSON.stringify(value2);
38594
+ } else {
38595
+ const out = [];
38596
+ for (let i6 = 0; i6 < value2.length; ++i6) {
38597
+ const v = value2[i6];
38598
+ if (v == null && !sparse)
38599
+ continue;
38600
+ if (Number.isNaN(v) || v === Infinity || v === -Infinity) {
38601
+ out.push(String(v));
38602
+ } else {
38603
+ out.push(v);
38604
+ }
38605
+ }
38606
+ json = JSON.stringify(out);
38607
+ }
38608
+ this.ensure(json.length * 3);
38609
+ this.i += encoder.encodeInto(json, this.json.subarray(this.i)).written;
38610
+ return;
38611
+ }
38184
38612
  }
38185
- if (ns.isDocumentSchema()) {
38186
- if (isObject3) {
38187
- const out = Array.isArray(value2) ? [] : {};
38613
+ this.ensure(2);
38614
+ this.json[this.i++] = OPEN_BRACKET;
38615
+ let wroteFirstItem = false;
38616
+ for (let i6 = 0; i6 < value2.length; ++i6) {
38617
+ const item = value2[i6];
38618
+ if (isDocument ? item === void 0 : item == null && !sparse) {
38619
+ continue;
38620
+ }
38621
+ if (wroteFirstItem) {
38622
+ this.ensure(1);
38623
+ this.json[this.i++] = COMMA;
38624
+ }
38625
+ this.writeValue(valueSchema, item, void 0);
38626
+ wroteFirstItem = true;
38627
+ }
38628
+ this.ensure(1);
38629
+ this.json[this.i++] = CLOSE_BRACKET;
38630
+ }
38631
+ writeMap(ns, value2, isDocument) {
38632
+ const sparse = !!ns.getMergedTraits().sparse;
38633
+ const valueSchema = ns.getValueSchema();
38634
+ if (!isDocument) {
38635
+ if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
38636
+ let modifications;
38188
38637
  for (const k6 in value2) {
38189
38638
  const v = value2[k6];
38190
- if (k6 === "__proto__") {
38191
- writeKey(out);
38192
- }
38193
- if (v instanceof NumericValue) {
38194
- this.useReplacer = true;
38195
- out[k6] = v;
38196
- } else {
38197
- out[k6] = this._write(ns, v);
38639
+ if (Number.isNaN(v) || v === Infinity || v === -Infinity) {
38640
+ (modifications ??= {})[k6] = v;
38641
+ value2[k6] = String(v);
38642
+ } else if (v === null && !sparse) {
38643
+ (modifications ??= {})[k6] = null;
38644
+ value2[k6] = void 0;
38198
38645
  }
38199
38646
  }
38200
- return out;
38201
- } else {
38202
- return structuredClone(value2);
38647
+ const json = JSON.stringify(value2);
38648
+ if (modifications) {
38649
+ Object.assign(value2, modifications);
38650
+ }
38651
+ this.ensure(json.length * 3);
38652
+ this.i += encoder.encodeInto(json, this.json.subarray(this.i)).written;
38653
+ return;
38654
+ }
38655
+ }
38656
+ this.ensure(2);
38657
+ this.json[this.i++] = OPEN_BRACE;
38658
+ let first = true;
38659
+ for (const k6 in value2) {
38660
+ const v = value2[k6];
38661
+ if (isDocument ? v === void 0 : v == null && !sparse) {
38662
+ continue;
38663
+ }
38664
+ if (!first) {
38665
+ this.ensure(1);
38666
+ this.json[this.i++] = COMMA;
38667
+ }
38668
+ first = false;
38669
+ this.writeJsonString(k6);
38670
+ this.ensure(1);
38671
+ this.json[this.i++] = COLON;
38672
+ this.writeValue(valueSchema, v, void 0);
38673
+ }
38674
+ this.ensure(1);
38675
+ this.json[this.i++] = CLOSE_BRACE;
38676
+ }
38677
+ writeTimestamp(ns, value2) {
38678
+ const format30 = determineTimestampFormat(ns, this.settings);
38679
+ switch (format30) {
38680
+ case 5: {
38681
+ const iso = value2.toISOString().replace(".000Z", "Z");
38682
+ this.writeAsciiQuoted(iso);
38683
+ return;
38684
+ }
38685
+ case 6: {
38686
+ this.writeAsciiQuoted(dateToUtcString(value2));
38687
+ return;
38688
+ }
38689
+ case 7: {
38690
+ const epochSecs = String(value2.getTime() / 1e3);
38691
+ this.writeAscii(epochSecs);
38692
+ return;
38693
+ }
38694
+ default: {
38695
+ const epochSecs = String(value2.getTime() / 1e3);
38696
+ this.writeAscii(epochSecs);
38697
+ return;
38203
38698
  }
38204
38699
  }
38205
- return value2;
38206
38700
  }
38207
38701
  };
38208
38702
  }
38209
38703
  });
38210
38704
 
38211
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js
38212
- var JsonCodec;
38213
- var init_JsonCodec = __esm({
38214
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js"() {
38705
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js
38706
+ var JsonCodec2;
38707
+ var init_JsonCodec2 = __esm({
38708
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js"() {
38215
38709
  init_ConfigurableSerdeContext();
38216
- init_JsonShapeDeserializer();
38217
- init_JsonShapeSerializer();
38218
- JsonCodec = class extends SerdeContextConfig {
38710
+ init_JsonShapeDeserializer2();
38711
+ init_JsonShapeSerializer2();
38712
+ JsonCodec2 = class extends SerdeContextConfig {
38219
38713
  static {
38220
- __name(this, "JsonCodec");
38714
+ __name(this, "JsonCodec2");
38221
38715
  }
38222
38716
  settings;
38223
38717
  constructor(settings) {
@@ -38225,12 +38719,12 @@ var init_JsonCodec = __esm({
38225
38719
  this.settings = settings;
38226
38720
  }
38227
38721
  createSerializer() {
38228
- const serializer = new JsonShapeSerializer(this.settings);
38722
+ const serializer = new JsonShapeSerializer2(this.settings);
38229
38723
  serializer.setSerdeContext(this.serdeContext);
38230
38724
  return serializer;
38231
38725
  }
38232
38726
  createDeserializer() {
38233
- const deserializer = new JsonShapeDeserializer(this.settings);
38727
+ const deserializer = new JsonShapeDeserializer2(this.settings);
38234
38728
  deserializer.setSerdeContext(this.serdeContext);
38235
38729
  return deserializer;
38236
38730
  }
@@ -38245,7 +38739,7 @@ var init_AwsJsonRpcProtocol = __esm({
38245
38739
  init_protocols();
38246
38740
  init_schema4();
38247
38741
  init_ProtocolLib();
38248
- init_JsonCodec();
38742
+ init_JsonCodec2();
38249
38743
  init_parseJsonBody();
38250
38744
  AwsJsonRpcProtocol = class extends RpcProtocol {
38251
38745
  static {
@@ -38263,7 +38757,7 @@ var init_AwsJsonRpcProtocol = __esm({
38263
38757
  errorTypeRegistries: errorTypeRegistries6
38264
38758
  });
38265
38759
  this.serviceTarget = serviceTarget;
38266
- this.codec = jsonCodec ?? new JsonCodec({
38760
+ this.codec = jsonCodec ?? new JsonCodec2({
38267
38761
  timestampFormat: {
38268
38762
  useTrait: true,
38269
38763
  default: 7
@@ -38393,7 +38887,7 @@ var init_AwsRestJsonProtocol = __esm({
38393
38887
  init_protocols();
38394
38888
  init_schema4();
38395
38889
  init_ProtocolLib();
38396
- init_JsonCodec();
38890
+ init_JsonCodec2();
38397
38891
  init_parseJsonBody();
38398
38892
  AwsRestJsonProtocol = class extends HttpBindingProtocol {
38399
38893
  static {
@@ -38403,7 +38897,7 @@ var init_AwsRestJsonProtocol = __esm({
38403
38897
  deserializer;
38404
38898
  codec;
38405
38899
  mixin = new ProtocolLib();
38406
- constructor({ defaultNamespace, errorTypeRegistries: errorTypeRegistries6 }) {
38900
+ constructor({ defaultNamespace, errorTypeRegistries: errorTypeRegistries6, jsonCodec }) {
38407
38901
  super({
38408
38902
  defaultNamespace,
38409
38903
  errorTypeRegistries: errorTypeRegistries6
@@ -38416,7 +38910,7 @@ var init_AwsRestJsonProtocol = __esm({
38416
38910
  httpBindings: true,
38417
38911
  jsonName: true
38418
38912
  };
38419
- this.codec = new JsonCodec(settings);
38913
+ this.codec = jsonCodec ?? new JsonCodec2(settings);
38420
38914
  this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
38421
38915
  this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
38422
38916
  }
@@ -38481,24 +38975,23 @@ var init_AwsRestJsonProtocol = __esm({
38481
38975
  }
38482
38976
  });
38483
38977
 
38484
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js
38485
- var JsonShapeDeserializer2;
38486
- var init_JsonShapeDeserializer2 = __esm({
38487
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js"() {
38978
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js
38979
+ var JsonShapeDeserializer;
38980
+ var init_JsonShapeDeserializer = __esm({
38981
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js"() {
38488
38982
  init_protocols();
38489
38983
  init_schema4();
38490
38984
  init_serde();
38491
38985
  init_serde();
38492
38986
  init_ConfigurableSerdeContext();
38493
38987
  init_UnionSerde();
38494
- init_detectBufferParsing();
38495
38988
  init_jsonReviver();
38496
38989
  init_needsReviver();
38497
38990
  init_parseJsonBody();
38498
38991
  init_writeKey();
38499
- JsonShapeDeserializer2 = class extends SerdeContextConfig {
38992
+ JsonShapeDeserializer = class extends SerdeContextConfig {
38500
38993
  static {
38501
- __name(this, "JsonShapeDeserializer2");
38994
+ __name(this, "JsonShapeDeserializer");
38502
38995
  }
38503
38996
  settings;
38504
38997
  constructor(settings) {
@@ -38507,16 +39000,7 @@ var init_JsonShapeDeserializer2 = __esm({
38507
39000
  }
38508
39001
  async read(schema, data) {
38509
39002
  const reviver = needsReviver(schema) ? jsonReviver : void 0;
38510
- let parsed;
38511
- if (typeof data === "string") {
38512
- parsed = JSON.parse(data, reviver);
38513
- } else if (data instanceof Uint8Array && detectBufferParsing()) {
38514
- const buf2 = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
38515
- parsed = JSON.parse(buf2, reviver);
38516
- } else {
38517
- parsed = await parseJsonBody(data, this.serdeContext);
38518
- }
38519
- return this._read(schema, parsed);
39003
+ return this._read(schema, typeof data === "string" ? JSON.parse(data, reviver) : await parseJsonBody(data, this.serdeContext, schema));
38520
39004
  }
38521
39005
  readObject(schema, data) {
38522
39006
  return this._read(schema, data);
@@ -38526,25 +39010,62 @@ var init_JsonShapeDeserializer2 = __esm({
38526
39010
  const ns = NormalizedSchema.of(schema);
38527
39011
  if (isObject3) {
38528
39012
  if (ns.isStructSchema()) {
38529
- return this._readStruct(ns, value2);
39013
+ const record = value2;
39014
+ const union = ns.isUnionSchema();
39015
+ const out = {};
39016
+ let nameMap = void 0;
39017
+ const { jsonName } = this.settings;
39018
+ if (jsonName) {
39019
+ nameMap = {};
39020
+ }
39021
+ let unionSerde;
39022
+ if (union) {
39023
+ unionSerde = new UnionSerde(record, out);
39024
+ }
39025
+ for (const [memberName, memberSchema] of ns.structIterator()) {
39026
+ let fromKey = memberName;
39027
+ if (jsonName) {
39028
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
39029
+ nameMap[fromKey] = memberName;
39030
+ }
39031
+ if (union) {
39032
+ unionSerde.mark(fromKey);
39033
+ }
39034
+ if (record[fromKey] != null) {
39035
+ out[memberName] = this._read(memberSchema, record[fromKey]);
39036
+ }
39037
+ }
39038
+ if (union) {
39039
+ unionSerde.writeUnknown();
39040
+ } else if (typeof record.__type === "string") {
39041
+ for (const k6 in record) {
39042
+ const v = record[k6];
39043
+ const t = jsonName ? nameMap[k6] ?? k6 : k6;
39044
+ if (!(t in out)) {
39045
+ out[t] = v;
39046
+ }
39047
+ }
39048
+ }
39049
+ return out;
38530
39050
  }
38531
39051
  if (Array.isArray(value2) && ns.isListSchema()) {
38532
39052
  const listMember = ns.getValueSchema();
38533
- for (let i6 = 0; i6 < value2.length; ++i6) {
38534
- value2[i6] = this._read(listMember, value2[i6]);
39053
+ const out = [];
39054
+ for (const item of value2) {
39055
+ out.push(this._read(listMember, item));
38535
39056
  }
38536
- return value2;
39057
+ return out;
38537
39058
  }
38538
39059
  if (ns.isMapSchema()) {
38539
39060
  const mapMember = ns.getValueSchema();
38540
- const map3 = value2;
38541
- for (const k6 in map3) {
38542
- if (k6 === "__proto__") {
38543
- writeKey(map3);
39061
+ const out = {};
39062
+ for (const _k in value2) {
39063
+ if (_k === "__proto__") {
39064
+ writeKey(out);
38544
39065
  }
38545
- map3[k6] = this._read(mapMember, map3[k6]);
39066
+ out[_k] = this._read(mapMember, value2[_k]);
38546
39067
  }
38547
- return map3;
39068
+ return out;
38548
39069
  }
38549
39070
  }
38550
39071
  if (ns.isBlobSchema() && typeof value2 === "string") {
@@ -38598,577 +39119,295 @@ var init_JsonShapeDeserializer2 = __esm({
38598
39119
  }
38599
39120
  if (ns.isDocumentSchema()) {
38600
39121
  if (isObject3) {
38601
- if (Array.isArray(value2)) {
38602
- for (let i6 = 0; i6 < value2.length; ++i6) {
38603
- const v = value2[i6];
38604
- if (!(v instanceof NumericValue)) {
38605
- value2[i6] = this._read(ns, v);
38606
- }
39122
+ const out = Array.isArray(value2) ? [] : {};
39123
+ for (const k6 in value2) {
39124
+ if (k6 === "__proto__") {
39125
+ writeKey(out);
38607
39126
  }
38608
- } else {
38609
- const doc = value2;
38610
- for (const k6 in doc) {
38611
- if (k6 === "__proto__") {
38612
- writeKey(doc);
38613
- }
38614
- const v = doc[k6];
38615
- if (!(v instanceof NumericValue)) {
38616
- doc[k6] = this._read(ns, v);
38617
- }
39127
+ const v = value2[k6];
39128
+ if (v instanceof NumericValue) {
39129
+ out[k6] = v;
39130
+ } else {
39131
+ out[k6] = this._read(ns, v);
38618
39132
  }
38619
39133
  }
38620
- return value2;
39134
+ return out;
38621
39135
  } else {
38622
- return value2;
39136
+ return structuredClone(value2);
38623
39137
  }
38624
39138
  }
38625
39139
  return value2;
38626
39140
  }
38627
- _readStruct(ns, record) {
38628
- const union = ns.isUnionSchema();
38629
- const out = {};
38630
- let nameMap = void 0;
38631
- const { jsonName } = this.settings;
38632
- if (jsonName) {
38633
- nameMap = {};
39141
+ };
39142
+ }
39143
+ });
39144
+
39145
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js
39146
+ var NUMERIC_CONTROL_CHAR, JsonReplacer;
39147
+ var init_jsonReplacer = __esm({
39148
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js"() {
39149
+ init_serde();
39150
+ NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
39151
+ JsonReplacer = class {
39152
+ static {
39153
+ __name(this, "JsonReplacer");
39154
+ }
39155
+ values = /* @__PURE__ */ new Map();
39156
+ counter = 0;
39157
+ stage = 0;
39158
+ createReplacer() {
39159
+ if (this.stage === 1) {
39160
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
38634
39161
  }
38635
- let unionSerde;
38636
- if (union) {
38637
- unionSerde = new UnionSerde(record, out);
39162
+ if (this.stage === 2) {
39163
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
38638
39164
  }
38639
- for (const [memberName, memberSchema] of ns.structIterator()) {
38640
- let fromKey = memberName;
38641
- if (jsonName) {
38642
- fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
38643
- nameMap[fromKey] = memberName;
38644
- }
38645
- if (union) {
38646
- unionSerde.mark(fromKey);
39165
+ this.stage = 1;
39166
+ return (key, value2) => {
39167
+ if (value2 instanceof NumericValue) {
39168
+ const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value2.string;
39169
+ this.values.set(`"${v}"`, value2.string);
39170
+ return v;
38647
39171
  }
38648
- if (record[fromKey] != null) {
38649
- out[memberName] = this._read(memberSchema, record[fromKey]);
39172
+ if (typeof value2 === "bigint") {
39173
+ const s2 = value2.toString();
39174
+ const v = `${NUMERIC_CONTROL_CHAR + "b" + this.counter++}_` + s2;
39175
+ this.values.set(`"${v}"`, s2);
39176
+ return v;
38650
39177
  }
39178
+ return value2;
39179
+ };
39180
+ }
39181
+ replaceInJson(json) {
39182
+ if (this.stage === 0) {
39183
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
38651
39184
  }
38652
- if (union) {
38653
- unionSerde.writeUnknown();
38654
- } else if (typeof record.__type === "string") {
38655
- for (const k6 in record) {
38656
- const v = record[k6];
38657
- const t = jsonName ? nameMap[k6] ?? k6 : k6;
38658
- if (!(t in out)) {
38659
- out[t] = v;
38660
- }
38661
- }
39185
+ if (this.stage === 2) {
39186
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
38662
39187
  }
38663
- return out;
39188
+ this.stage = 2;
39189
+ if (this.counter === 0) {
39190
+ return json;
39191
+ }
39192
+ for (const [key, value2] of this.values) {
39193
+ json = json.replace(key, value2);
39194
+ }
39195
+ return json;
38664
39196
  }
38665
39197
  };
38666
39198
  }
38667
39199
  });
38668
39200
 
38669
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js
38670
- function alloc(size) {
38671
- return typeof Buffer !== "undefined" ? Buffer.allocUnsafe(size) : new Uint8Array(size);
38672
- }
38673
- var encoder, OPEN_BRACE, CLOSE_BRACE, OPEN_BRACKET, CLOSE_BRACKET, QUOTE, COLON, COMMA, BACKSLASH, TRUE, FALSE, NULL, ESCAPE_TABLE, INITIAL_BUFFER_SIZE2, JsonShapeSerializer2;
38674
- var init_JsonShapeSerializer2 = __esm({
38675
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js"() {
39201
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js
39202
+ var JsonShapeSerializer;
39203
+ var init_JsonShapeSerializer = __esm({
39204
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js"() {
38676
39205
  init_protocols();
38677
39206
  init_schema4();
38678
39207
  init_serde();
38679
39208
  init_ConfigurableSerdeContext();
39209
+ init_jsonReplacer();
38680
39210
  init_writeKey();
38681
- encoder = new TextEncoder();
38682
- OPEN_BRACE = 123;
38683
- CLOSE_BRACE = 125;
38684
- OPEN_BRACKET = 91;
38685
- CLOSE_BRACKET = 93;
38686
- QUOTE = 34;
38687
- COLON = 58;
38688
- COMMA = 44;
38689
- BACKSLASH = 92;
38690
- TRUE = new Uint8Array([116, 114, 117, 101]);
38691
- FALSE = new Uint8Array([102, 97, 108, 115, 101]);
38692
- NULL = new Uint8Array([110, 117, 108, 108]);
38693
- ESCAPE_TABLE = new Array(128).fill(null);
38694
- ESCAPE_TABLE[8] = "b";
38695
- ESCAPE_TABLE[9] = "t";
38696
- ESCAPE_TABLE[10] = "n";
38697
- ESCAPE_TABLE[12] = "f";
38698
- ESCAPE_TABLE[13] = "r";
38699
- ESCAPE_TABLE[34] = '"';
38700
- ESCAPE_TABLE[92] = "\\";
38701
- for (let i6 = 0; i6 < 32; i6++) {
38702
- if (ESCAPE_TABLE[i6] === null) {
38703
- ESCAPE_TABLE[i6] = "u00" + i6.toString(16).padStart(2, "0");
38704
- }
38705
- }
38706
- INITIAL_BUFFER_SIZE2 = 2048;
38707
- __name(alloc, "alloc");
38708
- JsonShapeSerializer2 = class _JsonShapeSerializer2 extends SerdeContextConfig {
39211
+ JsonShapeSerializer = class extends SerdeContextConfig {
38709
39212
  static {
38710
- __name(this, "JsonShapeSerializer2");
39213
+ __name(this, "JsonShapeSerializer");
38711
39214
  }
38712
39215
  settings;
38713
- json;
38714
- i = 0;
39216
+ buffer;
39217
+ useReplacer = false;
38715
39218
  rootSchema;
38716
- rawValue;
38717
- passthrough = false;
38718
39219
  constructor(settings) {
38719
39220
  super();
38720
39221
  this.settings = settings;
38721
- this.json = alloc(INITIAL_BUFFER_SIZE2);
38722
39222
  }
38723
39223
  write(schema, value2) {
38724
- this.i = 0;
38725
- this.rawValue = value2;
38726
- this.rootSchema = NormalizedSchema.of(schema);
38727
- this.passthrough = !this.rootSchema.isStructSchema() && !this.rootSchema.isDocumentSchema() && (this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema());
38728
- if (!this.passthrough) {
38729
- this.writeValue(this.rootSchema, value2, void 0);
38730
- }
38731
- }
38732
- writeDiscriminatedDocument(schema, value2) {
38733
- this.i = 0;
38734
39224
  this.rootSchema = NormalizedSchema.of(schema);
38735
- const ns = this.rootSchema;
38736
- if (ns.isStructSchema() && value2 != null && typeof value2 === "object") {
38737
- this.ensure(2);
38738
- this.json[this.i++] = OPEN_BRACE;
38739
- this.writeAsciiQuoted("__type");
38740
- this.json[this.i++] = COLON;
38741
- this.writeAsciiQuoted(ns.getName(true) ?? "Unknown");
38742
- let wroteAny = true;
38743
- const { jsonName } = this.settings;
38744
- for (const [memberName, memberSchema] of ns.structIterator()) {
38745
- const item = value2[memberName];
38746
- if (item == null && !memberSchema.isIdempotencyToken()) {
38747
- continue;
38748
- }
38749
- if (wroteAny) {
38750
- this.ensure(1);
38751
- this.json[this.i++] = COMMA;
38752
- }
38753
- const targetKey = jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
38754
- this.writeAsciiQuoted(targetKey);
38755
- this.json[this.i++] = COLON;
38756
- this.writeValue(memberSchema, item, ns);
38757
- wroteAny = true;
38758
- }
38759
- this.ensure(1);
38760
- this.json[this.i++] = CLOSE_BRACE;
38761
- } else {
38762
- this.writeValue(ns, value2, void 0);
38763
- }
39225
+ this.buffer = this._write(this.rootSchema, value2);
38764
39226
  }
38765
39227
  flush() {
39228
+ const { rootSchema, useReplacer } = this;
38766
39229
  this.rootSchema = void 0;
38767
- const finalPosition = this.i;
38768
- this.i = 0;
38769
- const raw = this.rawValue;
38770
- this.rawValue = void 0;
38771
- if (finalPosition === 0) {
38772
- return raw;
38773
- }
38774
- const result2 = this.json.subarray(0, finalPosition);
38775
- this.json = alloc(INITIAL_BUFFER_SIZE2);
38776
- return result2;
38777
- }
38778
- ensure(byteCount) {
38779
- const { i: i6, json } = this;
38780
- if (i6 + byteCount > json.length) {
38781
- let newSize = json.length * 2;
38782
- while (newSize < i6 + byteCount) {
38783
- newSize *= 2;
39230
+ this.useReplacer = false;
39231
+ if (rootSchema?.isStructSchema() || rootSchema?.isDocumentSchema()) {
39232
+ if (!useReplacer) {
39233
+ return JSON.stringify(this.buffer);
38784
39234
  }
38785
- const next = alloc(newSize);
38786
- next.set(this.json);
38787
- this.json = next;
38788
- }
38789
- }
38790
- writeAscii(s2) {
38791
- const z = s2.length;
38792
- this.ensure(z);
38793
- let { i: i6, json } = this;
38794
- for (let j6 = 0; j6 < z; ++j6) {
38795
- json[i6] = s2.charCodeAt(j6);
38796
- i6 += 1;
39235
+ const replacer = new JsonReplacer();
39236
+ return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
38797
39237
  }
38798
- this.i = i6;
39238
+ return this.buffer;
38799
39239
  }
38800
- writeAsciiQuoted(s2) {
38801
- const z = s2.length;
38802
- this.ensure(z + 4);
38803
- let { json, i: i6 } = this;
38804
- json[i6++] = QUOTE;
38805
- for (let j6 = 0; j6 < z; ++j6) {
38806
- json[i6++] = s2.charCodeAt(j6);
39240
+ writeDiscriminatedDocument(schema, value2) {
39241
+ this.write(schema, value2);
39242
+ if (typeof this.buffer === "object") {
39243
+ this.buffer.__type = NormalizedSchema.of(schema).getName(true);
38807
39244
  }
38808
- json[i6++] = QUOTE;
38809
- this.i = i6;
38810
39245
  }
38811
- writeJsonString(s2) {
38812
- this.ensure(s2.length * 2 + 2);
38813
- this.json[this.i++] = QUOTE;
38814
- const z = s2.length;
38815
- for (let j6 = 0; j6 < z; ++j6) {
38816
- const c6 = s2.charCodeAt(j6);
38817
- if (c6 > 34 && c6 < 92) {
38818
- this.json[this.i++] = c6;
38819
- } else if (c6 < 128) {
38820
- const esc = ESCAPE_TABLE[c6];
38821
- if (esc !== null) {
38822
- this.ensure(esc.length + 1);
38823
- this.json[this.i++] = BACKSLASH;
38824
- for (let k6 = 0; k6 < esc.length; k6++) {
38825
- this.json[this.i++] = esc.charCodeAt(k6);
38826
- }
38827
- } else {
38828
- this.json[this.i++] = c6;
38829
- }
38830
- } else if (c6 >= 55296 && c6 <= 56319) {
38831
- const next = j6 + 1 < z ? s2.charCodeAt(j6 + 1) : 0;
38832
- if (next >= 56320 && next <= 57343) {
38833
- this.ensure(4);
38834
- const { written } = encoder.encodeInto(s2.substring(j6, j6 + 2), this.json.subarray(this.i));
38835
- this.i += written;
38836
- j6++;
38837
- } else {
38838
- this.ensure(6);
38839
- this.writeUnicodeEscape(c6);
39246
+ _write(schema, value2, container) {
39247
+ const isObject3 = value2 !== null && typeof value2 === "object";
39248
+ const ns = NormalizedSchema.of(schema);
39249
+ if (isObject3) {
39250
+ if (ns.isStructSchema()) {
39251
+ const record = value2;
39252
+ const out = {};
39253
+ const { jsonName } = this.settings;
39254
+ let nameMap = void 0;
39255
+ if (jsonName) {
39256
+ nameMap = {};
38840
39257
  }
38841
- } else if (c6 >= 56320 && c6 <= 57343) {
38842
- this.ensure(6);
38843
- this.writeUnicodeEscape(c6);
38844
- } else {
38845
- let { i: i6, json } = this;
38846
- if (c6 < 2048) {
38847
- json[i6++] = 192 | c6 >> 6;
38848
- json[i6++] = 128 | c6 & 63;
38849
- } else {
38850
- json[i6++] = 224 | c6 >> 12;
38851
- json[i6++] = 128 | c6 >> 6 & 63;
38852
- json[i6++] = 128 | c6 & 63;
39258
+ let outCount = 0;
39259
+ for (const [memberName, memberSchema] of ns.structIterator()) {
39260
+ const serializableValue = this._write(memberSchema, record[memberName], ns);
39261
+ if (serializableValue !== void 0) {
39262
+ let targetKey = memberName;
39263
+ if (jsonName) {
39264
+ targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
39265
+ nameMap[memberName] = targetKey;
39266
+ }
39267
+ out[targetKey] = serializableValue;
39268
+ outCount++;
39269
+ }
38853
39270
  }
38854
- this.i = i6;
38855
- }
38856
- }
38857
- this.json[this.i++] = QUOTE;
38858
- }
38859
- writeUnicodeEscape(code) {
38860
- let { json, i: i6 } = this;
38861
- json[i6++] = BACKSLASH;
38862
- json[i6++] = 117;
38863
- const hex = code.toString(16).padStart(4, "0");
38864
- for (let j6 = 0; j6 < 4; ++j6) {
38865
- json[i6++] = hex.charCodeAt(j6);
38866
- }
38867
- this.i = i6;
38868
- }
38869
- static B64 = (() => {
38870
- const chars3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
38871
- const table3 = new Uint8Array(64);
38872
- for (let i6 = 0; i6 < 64; i6++)
38873
- table3[i6] = chars3.charCodeAt(i6);
38874
- return table3;
38875
- })();
38876
- writeBase64(data) {
38877
- const b64Len = Math.ceil(data.length / 3) * 4;
38878
- this.ensure(b64Len + 2);
38879
- const json = this.json;
38880
- const B64 = _JsonShapeSerializer2.B64;
38881
- let i6 = this.i;
38882
- json[i6++] = QUOTE;
38883
- const len = data.length;
38884
- const remainder = len % 3;
38885
- const mainLen = len - remainder;
38886
- for (let j6 = 0; j6 < mainLen; j6 += 3) {
38887
- const a6 = data[j6];
38888
- const b6 = data[j6 + 1];
38889
- const c6 = data[j6 + 2];
38890
- json[i6++] = B64[a6 >> 2];
38891
- json[i6++] = B64[(a6 & 3) << 4 | b6 >> 4];
38892
- json[i6++] = B64[(b6 & 15) << 2 | c6 >> 6];
38893
- json[i6++] = B64[c6 & 63];
38894
- }
38895
- if (remainder === 2) {
38896
- const a6 = data[mainLen];
38897
- const b6 = data[mainLen + 1];
38898
- json[i6++] = B64[a6 >> 2];
38899
- json[i6++] = B64[(a6 & 3) << 4 | b6 >> 4];
38900
- json[i6++] = B64[(b6 & 15) << 2];
38901
- json[i6++] = 61;
38902
- } else if (remainder === 1) {
38903
- const a6 = data[mainLen];
38904
- json[i6++] = B64[a6 >> 2];
38905
- json[i6++] = B64[(a6 & 3) << 4];
38906
- json[i6++] = 61;
38907
- json[i6++] = 61;
38908
- }
38909
- json[i6++] = QUOTE;
38910
- this.i = i6;
38911
- }
38912
- writeValue(schema, value2, container) {
38913
- if (value2 == null) {
38914
- if (container?.isStructSchema()) {
38915
- if (value2 === void 0) {
38916
- const ns2 = NormalizedSchema.of(schema);
38917
- if (ns2.isIdempotencyToken()) {
38918
- this.writeAsciiQuoted(generateIdempotencyToken());
38919
- return;
39271
+ if (ns.isUnionSchema() && outCount === 0) {
39272
+ const { $unknown } = record;
39273
+ if (Array.isArray($unknown)) {
39274
+ const [k6, v] = $unknown;
39275
+ if (k6 === "__proto__") {
39276
+ writeKey(out);
39277
+ }
39278
+ out[k6] = this._write(15, v);
39279
+ }
39280
+ } else if (typeof record.__type === "string") {
39281
+ for (const k6 in record) {
39282
+ const v = record[k6];
39283
+ const targetKey = jsonName ? nameMap[k6] ?? k6 : k6;
39284
+ if (!(targetKey in out)) {
39285
+ out[targetKey] = this._write(15, v);
39286
+ }
38920
39287
  }
38921
39288
  }
38922
- return;
39289
+ return out;
38923
39290
  }
38924
- this.ensure(4);
38925
- this.json.set(NULL, this.i);
38926
- this.i += 4;
38927
- return;
38928
- }
38929
- const ns = NormalizedSchema.of(schema);
38930
- const isObject3 = typeof value2 === "object";
38931
- if (ns.isStringSchema()) {
38932
- const mediaType = ns.getMergedTraits().mediaType;
38933
- if (mediaType) {
38934
- const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
38935
- if (isJson) {
38936
- this.writeJsonString(LazyJsonString.from(value2).toString());
38937
- return;
39291
+ if (Array.isArray(value2) && ns.isListSchema()) {
39292
+ const listMember = ns.getValueSchema();
39293
+ const out = [];
39294
+ const sparse = !!ns.getMergedTraits().sparse;
39295
+ for (const item of value2) {
39296
+ if (sparse || item != null) {
39297
+ out.push(this._write(listMember, item));
39298
+ }
38938
39299
  }
38939
- }
38940
- }
38941
- if (isObject3) {
38942
- if (ns.isStructSchema()) {
38943
- this.writeStruct(ns, value2);
38944
- return;
38945
- }
38946
- if (Array.isArray(value2) && (ns.isListSchema() || ns.isDocumentSchema())) {
38947
- this.writeList(ns, value2, ns.isDocumentSchema());
38948
- return;
39300
+ return out;
38949
39301
  }
38950
39302
  if (ns.isMapSchema()) {
38951
- this.writeMap(ns, value2, false);
38952
- return;
39303
+ const mapMember = ns.getValueSchema();
39304
+ const out = {};
39305
+ const sparse = !!ns.getMergedTraits().sparse;
39306
+ for (const _k in value2) {
39307
+ const _v = value2[_k];
39308
+ if (sparse || _v != null) {
39309
+ if (_k === "__proto__") {
39310
+ writeKey(out);
39311
+ }
39312
+ out[_k] = this._write(mapMember, _v);
39313
+ }
39314
+ }
39315
+ return out;
38953
39316
  }
38954
- if (value2 instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
38955
- this.writeBase64(value2);
38956
- return;
39317
+ if (value2 instanceof Uint8Array && ns.isBlobSchema()) {
39318
+ if (ns === this.rootSchema) {
39319
+ return value2;
39320
+ }
39321
+ return (this.serdeContext?.base64Encoder ?? toBase64)(value2);
38957
39322
  }
38958
39323
  if (value2 instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
38959
- this.writeTimestamp(ns, value2);
38960
- return;
39324
+ const format30 = determineTimestampFormat(ns, this.settings);
39325
+ switch (format30) {
39326
+ case 5:
39327
+ return value2.toISOString().replace(".000Z", "Z");
39328
+ case 6:
39329
+ return dateToUtcString(value2);
39330
+ case 7:
39331
+ return value2.getTime() / 1e3;
39332
+ default:
39333
+ console.warn("Missing timestamp format, using epoch seconds", value2);
39334
+ return value2.getTime() / 1e3;
39335
+ }
38961
39336
  }
38962
39337
  if (value2 instanceof NumericValue) {
38963
- this.writeAscii(value2.string);
38964
- return;
38965
- }
38966
- if (ns.isDocumentSchema()) {
38967
- if (Array.isArray(value2)) {
38968
- this.writeList(ns, value2, true);
38969
- } else {
38970
- this.writeMap(ns, value2, true);
38971
- }
38972
- return;
39338
+ this.useReplacer = true;
38973
39339
  }
38974
- const json = JSON.stringify(value2);
38975
- this.writeAscii(json);
38976
- return;
38977
39340
  }
38978
- if (typeof value2 === "string") {
38979
- if (ns.isBlobSchema()) {
38980
- const b64 = (this.serdeContext?.base64Encoder ?? toBase64)(value2);
38981
- this.writeAsciiQuoted(b64);
38982
- return;
39341
+ if (value2 === null && container?.isStructSchema()) {
39342
+ return void 0;
39343
+ }
39344
+ if (ns.isStringSchema()) {
39345
+ if (typeof value2 === "undefined" && ns.isIdempotencyToken()) {
39346
+ return generateIdempotencyToken();
38983
39347
  }
38984
- this.writeJsonString(value2);
38985
- return;
39348
+ const mediaType = ns.getMergedTraits().mediaType;
39349
+ if (value2 != null && mediaType) {
39350
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
39351
+ if (isJson) {
39352
+ return LazyJsonString.from(value2);
39353
+ }
39354
+ }
39355
+ return value2;
38986
39356
  }
38987
39357
  if (typeof value2 === "number") {
38988
- if (ns.isNumericSchema() && (Math.abs(value2) === Infinity || isNaN(value2))) {
38989
- this.writeAsciiQuoted(String(value2));
38990
- return;
39358
+ if (Math.abs(value2) === Infinity || isNaN(value2)) {
39359
+ return String(value2);
38991
39360
  }
38992
- const numStr = String(value2);
38993
- this.writeAscii(numStr);
38994
- return;
39361
+ return value2;
38995
39362
  }
38996
- if (typeof value2 === "boolean") {
38997
- this.ensure(5);
38998
- if (value2) {
38999
- this.json.set(TRUE, this.i);
39000
- this.i += 4;
39001
- } else {
39002
- this.json.set(FALSE, this.i);
39003
- this.i += 5;
39363
+ if (typeof value2 === "string" && ns.isBlobSchema()) {
39364
+ if (ns === this.rootSchema) {
39365
+ return value2;
39004
39366
  }
39005
- return;
39367
+ return (this.serdeContext?.base64Encoder ?? toBase64)(value2);
39006
39368
  }
39007
39369
  if (typeof value2 === "bigint") {
39008
- this.writeAscii(value2.toString());
39009
- return;
39010
- }
39011
- this.writeAscii(String(value2));
39012
- }
39013
- writeStruct(ns, value2) {
39014
- this.ensure(2);
39015
- this.json[this.i++] = OPEN_BRACE;
39016
- let first = true;
39017
- let wroteAny = false;
39018
- const hasType = typeof value2.__type === "string";
39019
- let writtenKeys;
39020
- if (hasType) {
39021
- writtenKeys = /* @__PURE__ */ new Set();
39022
- }
39023
- for (const [memberName, memberSchema] of ns.structIterator()) {
39024
- const item = value2[memberName];
39025
- if (item == null && !memberSchema.isIdempotencyToken())
39026
- continue;
39027
- if (!first) {
39028
- this.ensure(1);
39029
- this.json[this.i++] = COMMA;
39030
- }
39031
- first = false;
39032
- wroteAny = true;
39033
- const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
39034
- if (writtenKeys) {
39035
- writtenKeys.add(memberName);
39036
- writtenKeys.add(targetKey);
39037
- }
39038
- this.writeAsciiQuoted(targetKey);
39039
- this.json[this.i++] = COLON;
39040
- this.writeValue(memberSchema, item, ns);
39370
+ this.useReplacer = true;
39041
39371
  }
39042
- if (!wroteAny && ns.isUnionSchema()) {
39043
- const { $unknown } = value2;
39044
- if (Array.isArray($unknown)) {
39045
- const [k6, v] = $unknown;
39046
- this.writeAsciiQuoted(k6);
39047
- this.ensure(1);
39048
- this.json[this.i++] = COLON;
39049
- this.writeValue(15, v, ns);
39050
- }
39051
- } else if (hasType) {
39052
- for (const k6 in value2) {
39053
- const targetKey = this.settings.jsonName ? writtenKeys.has(k6) ? k6 : k6 : k6;
39054
- if (writtenKeys.has(targetKey))
39055
- continue;
39056
- writtenKeys.add(targetKey);
39057
- const v = value2[k6];
39058
- if (!first) {
39059
- this.ensure(1);
39060
- this.json[this.i++] = COMMA;
39372
+ if (ns.isDocumentSchema()) {
39373
+ if (isObject3) {
39374
+ if (value2 instanceof Uint8Array) {
39375
+ return (this.serdeContext?.base64Encoder ?? toBase64)(value2);
39061
39376
  }
39062
- first = false;
39063
- this.writeAsciiQuoted(targetKey);
39064
- this.ensure(1);
39065
- this.json[this.i++] = COLON;
39066
- this.writeValue(15, v, void 0);
39067
- }
39068
- }
39069
- this.ensure(1);
39070
- this.json[this.i++] = CLOSE_BRACE;
39071
- }
39072
- writeList(ns, value2, isDocument) {
39073
- this.ensure(2);
39074
- this.json[this.i++] = OPEN_BRACKET;
39075
- const sparse = !!ns.getMergedTraits().sparse;
39076
- const valueSchema = ns.getValueSchema();
39077
- for (let i6 = 0; i6 < value2.length; ++i6) {
39078
- const item = value2[i6];
39079
- if (isDocument ? item === void 0 : item == null && !sparse) {
39080
- continue;
39081
- }
39082
- if (i6 !== 0) {
39083
- this.ensure(1);
39084
- this.json[this.i++] = COMMA;
39085
- }
39086
- this.writeValue(valueSchema, item, void 0);
39087
- }
39088
- this.ensure(1);
39089
- this.json[this.i++] = CLOSE_BRACKET;
39090
- }
39091
- writeMap(ns, value2, isDocument) {
39092
- const sparse = !!ns.getMergedTraits().sparse;
39093
- const valueSchema = ns.getValueSchema();
39094
- if (!isDocument) {
39095
- if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
39096
- let input = value2;
39097
- if (sparse) {
39098
- input = {};
39099
- for (const k6 in value2) {
39100
- if (k6 === "__proto__") {
39101
- writeKey(input);
39102
- }
39103
- input[k6] = value2[k6] ?? null;
39377
+ const out = Array.isArray(value2) ? [] : {};
39378
+ for (const k6 in value2) {
39379
+ const v = value2[k6];
39380
+ if (k6 === "__proto__") {
39381
+ writeKey(out);
39382
+ }
39383
+ if (v instanceof NumericValue) {
39384
+ this.useReplacer = true;
39385
+ out[k6] = v;
39386
+ } else {
39387
+ out[k6] = this._write(ns, v);
39104
39388
  }
39105
39389
  }
39106
- const json = JSON.stringify(input);
39107
- this.ensure(json.length * 3);
39108
- const { written } = encoder.encodeInto(json, this.json.subarray(this.i));
39109
- this.i += written;
39110
- return;
39111
- }
39112
- }
39113
- this.ensure(2);
39114
- this.json[this.i++] = OPEN_BRACE;
39115
- let first = true;
39116
- for (const k6 in value2) {
39117
- const v = value2[k6];
39118
- if (isDocument ? v === void 0 : v == null && !sparse) {
39119
- continue;
39120
- }
39121
- if (!first) {
39122
- this.ensure(1);
39123
- this.json[this.i++] = COMMA;
39124
- }
39125
- first = false;
39126
- this.writeJsonString(k6);
39127
- this.ensure(1);
39128
- this.json[this.i++] = COLON;
39129
- this.writeValue(valueSchema, v, void 0);
39130
- }
39131
- this.ensure(1);
39132
- this.json[this.i++] = CLOSE_BRACE;
39133
- }
39134
- writeTimestamp(ns, value2) {
39135
- const format30 = determineTimestampFormat(ns, this.settings);
39136
- switch (format30) {
39137
- case 5: {
39138
- const iso = value2.toISOString().replace(".000Z", "Z");
39139
- this.writeAsciiQuoted(iso);
39140
- return;
39141
- }
39142
- case 6: {
39143
- this.writeAsciiQuoted(dateToUtcString(value2));
39144
- return;
39145
- }
39146
- case 7: {
39147
- const epochSecs = String(value2.getTime() / 1e3);
39148
- this.writeAscii(epochSecs);
39149
- return;
39150
- }
39151
- default: {
39152
- const epochSecs = String(value2.getTime() / 1e3);
39153
- this.writeAscii(epochSecs);
39154
- return;
39390
+ return out;
39391
+ } else {
39392
+ return structuredClone(value2);
39155
39393
  }
39156
39394
  }
39395
+ return value2;
39157
39396
  }
39158
39397
  };
39159
39398
  }
39160
39399
  });
39161
39400
 
39162
- // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js
39163
- var JsonCodec2;
39164
- var init_JsonCodec2 = __esm({
39165
- "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js"() {
39401
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js
39402
+ var JsonCodec;
39403
+ var init_JsonCodec = __esm({
39404
+ "../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js"() {
39166
39405
  init_ConfigurableSerdeContext();
39167
- init_JsonShapeDeserializer2();
39168
- init_JsonShapeSerializer2();
39169
- JsonCodec2 = class extends SerdeContextConfig {
39406
+ init_JsonShapeDeserializer();
39407
+ init_JsonShapeSerializer();
39408
+ JsonCodec = class extends SerdeContextConfig {
39170
39409
  static {
39171
- __name(this, "JsonCodec2");
39410
+ __name(this, "JsonCodec");
39172
39411
  }
39173
39412
  settings;
39174
39413
  constructor(settings) {
@@ -39176,12 +39415,12 @@ var init_JsonCodec2 = __esm({
39176
39415
  this.settings = settings;
39177
39416
  }
39178
39417
  createSerializer() {
39179
- const serializer = new JsonShapeSerializer2(this.settings);
39418
+ const serializer = new JsonShapeSerializer(this.settings);
39180
39419
  serializer.setSerdeContext(this.serdeContext);
39181
39420
  return serializer;
39182
39421
  }
39183
39422
  createDeserializer() {
39184
- const deserializer = new JsonShapeDeserializer2(this.settings);
39423
+ const deserializer = new JsonShapeDeserializer(this.settings);
39185
39424
  deserializer.setSerdeContext(this.serdeContext);
39186
39425
  return deserializer;
39187
39426
  }
@@ -44951,7 +45190,7 @@ var init_signin = __esm({
44951
45190
  var require_dist_cjs11 = __commonJS({
44952
45191
  "../../node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js"(exports2) {
44953
45192
  var { setCredentialFeature: setCredentialFeature2 } = (init_client3(), __toCommonJS(client_exports2));
44954
- var { CredentialsProviderError: CredentialsProviderError2, readFile: readFile11, parseKnownFiles: parseKnownFiles2, getProfileName: getProfileName2 } = (init_config2(), __toCommonJS(config_exports));
45193
+ var { CredentialsProviderError: CredentialsProviderError2, parseKnownFiles: parseKnownFiles2, getProfileName: getProfileName2 } = (init_config2(), __toCommonJS(config_exports));
44955
45194
  var { HttpRequest: HttpRequest2 } = (init_protocols(), __toCommonJS(protocols_exports));
44956
45195
  var { createHash: createHash8, createPrivateKey, createPublicKey, sign: sign3 } = require("node:crypto");
44957
45196
  var { promises: promises8 } = require("node:fs");
@@ -44982,13 +45221,7 @@ var require_dist_cjs11 = __commonJS({
44982
45221
  if (timeUntilExpiry <= _LoginCredentialsFetcher.REFRESH_THRESHOLD) {
44983
45222
  return this.refresh(token);
44984
45223
  }
44985
- return {
44986
- accessKeyId: accessToken.accessKeyId,
44987
- secretAccessKey: accessToken.secretAccessKey,
44988
- sessionToken: accessToken.sessionToken,
44989
- accountId: accessToken.accountId,
44990
- expiration: new Date(accessToken.expiresAt)
44991
- };
45224
+ return this.toCredentials(token.accessToken);
44992
45225
  }
44993
45226
  get logger() {
44994
45227
  return this.init?.logger;
@@ -44996,7 +45229,25 @@ var require_dist_cjs11 = __commonJS({
44996
45229
  get loginSession() {
44997
45230
  return this.profileData.login_session;
44998
45231
  }
45232
+ toCredentials(token) {
45233
+ return {
45234
+ accessKeyId: token.accessKeyId,
45235
+ secretAccessKey: token.secretAccessKey,
45236
+ sessionToken: token.sessionToken,
45237
+ accountId: token.accountId,
45238
+ expiration: new Date(token.expiresAt)
45239
+ };
45240
+ }
44999
45241
  async refresh(token) {
45242
+ const diskToken = await this.loadToken().catch(() => token);
45243
+ const now = Date.now();
45244
+ const diskExpiry = new Date(diskToken.accessToken.expiresAt).getTime();
45245
+ const tokenExpiry = new Date(token.accessToken.expiresAt).getTime();
45246
+ const freshToken = diskExpiry <= now && tokenExpiry > now ? token : diskToken;
45247
+ const freshExpiry = new Date(freshToken.accessToken.expiresAt).getTime();
45248
+ if (freshExpiry - Date.now() > _LoginCredentialsFetcher.REFRESH_THRESHOLD) {
45249
+ return this.toCredentials(freshToken.accessToken);
45250
+ }
45000
45251
  const { SigninClient: SigninClient2, CreateOAuth2TokenCommand: CreateOAuth2TokenCommand2 } = (init_signin(), __toCommonJS(signin_exports));
45001
45252
  const { logger: logger2, userAgentAppId } = this.callerClientConfig ?? {};
45002
45253
  const isH22 = /* @__PURE__ */ __name((requestHandler2) => {
@@ -45018,8 +45269,8 @@ var require_dist_cjs11 = __commonJS({
45018
45269
  this.createDPoPInterceptor(client.middlewareStack);
45019
45270
  const commandInput = {
45020
45271
  tokenInput: {
45021
- clientId: token.clientId,
45022
- refreshToken: token.refreshToken,
45272
+ clientId: freshToken.clientId,
45273
+ refreshToken: freshToken.refreshToken,
45023
45274
  grantType: "refresh_token"
45024
45275
  }
45025
45276
  };
@@ -45036,9 +45287,9 @@ var require_dist_cjs11 = __commonJS({
45036
45287
  const expiresInMs = (expiresIn ?? 900) * 1e3;
45037
45288
  const expiration = new Date(Date.now() + expiresInMs);
45038
45289
  const updatedToken = {
45039
- ...token,
45290
+ ...freshToken,
45040
45291
  accessToken: {
45041
- ...token.accessToken,
45292
+ ...freshToken.accessToken,
45042
45293
  accessKeyId,
45043
45294
  secretAccessKey,
45044
45295
  sessionToken,
@@ -45047,14 +45298,7 @@ var require_dist_cjs11 = __commonJS({
45047
45298
  refreshToken
45048
45299
  };
45049
45300
  await this.saveToken(updatedToken);
45050
- const newAccessToken = updatedToken.accessToken;
45051
- return {
45052
- accessKeyId: newAccessToken.accessKeyId,
45053
- secretAccessKey: newAccessToken.secretAccessKey,
45054
- sessionToken: newAccessToken.sessionToken,
45055
- accountId: newAccessToken.accountId,
45056
- expiration
45057
- };
45301
+ return this.toCredentials(updatedToken.accessToken);
45058
45302
  } catch (error3) {
45059
45303
  if (error3.name === "AccessDeniedException") {
45060
45304
  const errorType = error3.error;
@@ -45072,7 +45316,15 @@ var require_dist_cjs11 = __commonJS({
45072
45316
  default:
45073
45317
  message2 = `Failed to refresh token: ${String(error3)}. Please re-authenticate using \`aws login\``;
45074
45318
  }
45075
- throw new CredentialsProviderError2(message2, { logger: this.logger, tryNextLink: false });
45319
+ throw new CredentialsProviderError2(message2, {
45320
+ logger: this.logger,
45321
+ tryNextLink: false
45322
+ });
45323
+ }
45324
+ const tokenExpiry2 = new Date(freshToken.accessToken.expiresAt).getTime();
45325
+ if (tokenExpiry2 > Date.now()) {
45326
+ this.logger?.warn?.(`Failed to refresh token: ${String(error3)}. Using existing token until expiry.`);
45327
+ return this.toCredentials(freshToken.accessToken);
45076
45328
  }
45077
45329
  throw new CredentialsProviderError2(`Failed to refresh token: ${String(error3)}. Please re-authenticate using aws login`, { logger: this.logger });
45078
45330
  }
@@ -45080,12 +45332,7 @@ var require_dist_cjs11 = __commonJS({
45080
45332
  async loadToken() {
45081
45333
  const tokenFilePath = this.getTokenFilePath();
45082
45334
  try {
45083
- let tokenData;
45084
- try {
45085
- tokenData = await readFile11(tokenFilePath, { ignoreCache: this.init?.ignoreCache });
45086
- } catch {
45087
- tokenData = await promises8.readFile(tokenFilePath, "utf8");
45088
- }
45335
+ const tokenData = await promises8.readFile(tokenFilePath, "utf8");
45089
45336
  const token = JSON.parse(tokenData);
45090
45337
  const missingFields = ["accessToken", "clientId", "refreshToken", "dpopKey"].filter((k6) => !token[k6]);
45091
45338
  if (!token.accessToken?.accountId) {
@@ -78038,10 +78285,10 @@ ${pair.comment}` : item.comment;
78038
78285
  }
78039
78286
  }
78040
78287
  __name(warnFileDeprecation, "warnFileDeprecation");
78041
- var warned = {};
78288
+ var warned2 = {};
78042
78289
  function warnOptionDeprecation(name, alternative) {
78043
- if (!warned[name] && shouldWarn(true)) {
78044
- warned[name] = true;
78290
+ if (!warned2[name] && shouldWarn(true)) {
78291
+ warned2[name] = true;
78045
78292
  let msg = `The option '${name}' will be removed in a future release`;
78046
78293
  msg += alternative ? `, use '${alternative}' instead.` : ".";
78047
78294
  warn2(msg, "DeprecationWarning");
@@ -94825,28 +95072,30 @@ async function createChangeSetAndCleanup(ioHelper, options) {
94825
95072
  Capabilities: ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
94826
95073
  });
94827
95074
  await ioHelper.defaults.debug((0, import_node_util2.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id));
94828
- const createdChangeSet = await new ChangeSetDescriber({
94829
- cfn: options.cfn,
94830
- ioHelper,
94831
- stackNameOrArn: changeSet.StackId ?? options.stack.stackName,
94832
- changeSetNameOrArn: changeSet.Id ?? options.changeSetName
94833
- }).waitAndThrowOnProblem({
94834
- diagnoser: options.diagnoser
94835
- });
94836
- await cleanupOldChangeset(
94837
- options.cfn,
94838
- ioHelper,
94839
- changeSet.Id ?? options.changeSetName,
94840
- changeSet.StackId ?? options.stack.stackName
94841
- );
94842
- if (!options.exists) {
94843
- await ioHelper.defaults.debug((0, import_node_util2.format)("Deleting empty stack created by diff changeset: %s", changeSet.StackId ?? options.stack.stackName));
94844
- await options.cfn.deleteStack({
94845
- StackName: changeSet.StackId ?? options.stack.stackName,
94846
- ClientRequestToken: (0, import_node_crypto9.randomUUID)()
95075
+ const changeSetId = changeSet.Id ?? options.changeSetName;
95076
+ const stackId = changeSet.StackId ?? options.stack.stackName;
95077
+ try {
95078
+ return await new ChangeSetDescriber({
95079
+ cfn: options.cfn,
95080
+ ioHelper,
95081
+ stackNameOrArn: stackId,
95082
+ changeSetNameOrArn: changeSetId
95083
+ }).waitAndThrowOnProblem({
95084
+ diagnoser: options.diagnoser
94847
95085
  });
95086
+ } catch (e6) {
95087
+ await ioHelper.defaults.warn((0, import_node_util2.format)("Change set %s failed: %s", changeSetId, e6));
95088
+ throw e6;
95089
+ } finally {
95090
+ await cleanupOldChangeset(options.cfn, ioHelper, changeSetId, stackId);
95091
+ if (!options.exists) {
95092
+ await ioHelper.defaults.debug((0, import_node_util2.format)("Deleting empty stack created by diff changeset: %s", stackId));
95093
+ await options.cfn.deleteStack({
95094
+ StackName: stackId,
95095
+ ClientRequestToken: (0, import_node_crypto9.randomUUID)()
95096
+ });
95097
+ }
94848
95098
  }
94849
- return createdChangeSet;
94850
95099
  }
94851
95100
  async function createValidationChangeSet(ioHelper, options) {
94852
95101
  const { cfn, bodyParameter, exists, stackExistedBefore, executionRoleArn, diagnoser } = await prepareChangeSetEnv(ioHelper, options);
@@ -95126,306 +95375,6 @@ var init_checks = __esm({
95126
95375
  }
95127
95376
  });
95128
95377
 
95129
- // ../@aws-cdk/toolkit-lib/lib/api/deployments/assets.ts
95130
- async function addMetadataAssetsToManifest(ioHelper, stack, assetManifest, envResources, reuse) {
95131
- reuse = reuse || [];
95132
- const assets = stack.assets;
95133
- if (assets.length === 0) {
95134
- return {};
95135
- }
95136
- const toolkitInfo = await envResources.lookupToolkit();
95137
- if (!toolkitInfo.found) {
95138
- throw new ToolkitError("BootstrapStackRequired", `This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${import_chalk3.default.blue("cdk bootstrap " + stack.environment.name)}")`);
95139
- }
95140
- const params = {};
95141
- for (const asset of assets) {
95142
- const reuseAsset = reuse.indexOf(asset.id) > -1;
95143
- if (reuseAsset) {
95144
- await ioHelper.defaults.debug(`Reusing asset ${asset.id}: ${JSON.stringify(asset)}`);
95145
- continue;
95146
- }
95147
- await ioHelper.defaults.debug(`Preparing asset ${asset.id}: ${JSON.stringify(asset)}`);
95148
- if (!stack.assembly) {
95149
- throw new ToolkitError("AssemblyRequired", "Unexpected: stack assembly is required in order to find assets in assembly directory");
95150
- }
95151
- Object.assign(params, await prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo));
95152
- }
95153
- return params;
95154
- }
95155
- async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo) {
95156
- switch (asset.packaging) {
95157
- case "zip":
95158
- case "file":
95159
- return prepareFileAsset(
95160
- ioHelper,
95161
- asset,
95162
- assetManifest,
95163
- toolkitInfo,
95164
- asset.packaging === "zip" ? cxschema8.FileAssetPackaging.ZIP_DIRECTORY : cxschema8.FileAssetPackaging.FILE
95165
- );
95166
- case "container-image":
95167
- return prepareDockerImageAsset(asset, assetManifest, envResources);
95168
- default:
95169
- throw new ToolkitError("UnsupportedPackaging", `Unsupported packaging type: ${asset.packaging}. You might need to upgrade your aws-cdk toolkit to support this asset type.`);
95170
- }
95171
- }
95172
- async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, packaging) {
95173
- const extension = packaging === cxschema8.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" : path18.extname(asset.path);
95174
- const baseName = `${asset.sourceHash}${extension}`;
95175
- const s3Prefix = asset.id === asset.sourceHash ? "assets/" : `assets/${asset.id}/`;
95176
- const key = `${s3Prefix}${baseName}`;
95177
- const s3url = `s3://${toolkitInfo.bucketName}/${key}`;
95178
- await ioHelper.defaults.debug(`Storing asset ${asset.path} at ${s3url}`);
95179
- assetManifest.addFileAsset(asset.sourceHash, {
95180
- path: asset.path,
95181
- packaging
95182
- }, {
95183
- bucketName: toolkitInfo.bucketName,
95184
- objectKey: key
95185
- });
95186
- return {
95187
- [asset.s3BucketParameter]: toolkitInfo.bucketName,
95188
- [asset.s3KeyParameter]: `${s3Prefix}${cxapi3.ASSET_PREFIX_SEPARATOR}${baseName}`,
95189
- [asset.artifactHashParameter]: asset.sourceHash
95190
- };
95191
- }
95192
- async function prepareDockerImageAsset(asset, assetManifest, envResources) {
95193
- if (!asset.imageNameParameter && (!asset.repositoryName || !asset.imageTag)) {
95194
- throw new ToolkitError("InvalidDockerAssetConfig", 'Invalid Docker image asset configuration: "repositoryName" and "imageTag" are required when "imageNameParameter" is left out');
95195
- }
95196
- const repositoryName = asset.repositoryName ?? "cdk/" + asset.id.replace(/[:/]/g, "-").toLowerCase();
95197
- const { repositoryUri: repositoryUri2 } = await envResources.prepareEcrRepository(repositoryName);
95198
- const imageTag = asset.imageTag ?? asset.sourceHash;
95199
- assetManifest.addDockerImageAsset(asset.sourceHash, {
95200
- directory: asset.path,
95201
- dockerBuildArgs: asset.buildArgs,
95202
- dockerBuildSecrets: asset.buildSecrets,
95203
- dockerBuildSsh: asset.buildSsh,
95204
- dockerBuildTarget: asset.target,
95205
- dockerFile: asset.file,
95206
- networkMode: asset.networkMode,
95207
- platform: asset.platform,
95208
- dockerOutputs: asset.outputs
95209
- }, {
95210
- repositoryName,
95211
- imageTag
95212
- });
95213
- if (!asset.imageNameParameter) {
95214
- return {};
95215
- }
95216
- return { [asset.imageNameParameter]: `${repositoryUri2}:${imageTag}` };
95217
- }
95218
- var path18, cxapi3, cxschema8, import_chalk3;
95219
- var init_assets3 = __esm({
95220
- "../@aws-cdk/toolkit-lib/lib/api/deployments/assets.ts"() {
95221
- "use strict";
95222
- path18 = __toESM(require("path"));
95223
- cxapi3 = __toESM(require_lib3());
95224
- cxschema8 = __toESM(require_lib2());
95225
- import_chalk3 = __toESM(require_source());
95226
- init_toolkit_error();
95227
- __name(addMetadataAssetsToManifest, "addMetadataAssetsToManifest");
95228
- __name(prepareAsset, "prepareAsset");
95229
- __name(prepareFileAsset, "prepareFileAsset");
95230
- __name(prepareDockerImageAsset, "prepareDockerImageAsset");
95231
- }
95232
- });
95233
-
95234
- // ../@aws-cdk/toolkit-lib/lib/actions/deploy/private/deployment-method.ts
95235
- function isChangeSetDeployment(method) {
95236
- return method?.method === "change-set";
95237
- }
95238
- function isExecutingChangeSetDeployment(method) {
95239
- return isChangeSetDeployment(method) && (method.execute ?? true);
95240
- }
95241
- function isNonExecutingChangeSetDeployment(method) {
95242
- return isChangeSetDeployment(method) && method.execute === false;
95243
- }
95244
- function isExecuteChangeSetDeployment(method) {
95245
- return method?.method === "execute-change-set";
95246
- }
95247
- function toExecuteChangeSetDeployment(method) {
95248
- return {
95249
- method: "execute-change-set",
95250
- changeSetName: method.changeSetName ?? DEFAULT_DEPLOY_CHANGE_SET_NAME
95251
- };
95252
- }
95253
- var DEFAULT_DEPLOY_CHANGE_SET_NAME;
95254
- var init_deployment_method = __esm({
95255
- "../@aws-cdk/toolkit-lib/lib/actions/deploy/private/deployment-method.ts"() {
95256
- "use strict";
95257
- DEFAULT_DEPLOY_CHANGE_SET_NAME = "cdk-deploy-change-set";
95258
- __name(isChangeSetDeployment, "isChangeSetDeployment");
95259
- __name(isExecutingChangeSetDeployment, "isExecutingChangeSetDeployment");
95260
- __name(isNonExecutingChangeSetDeployment, "isNonExecutingChangeSetDeployment");
95261
- __name(isExecuteChangeSetDeployment, "isExecuteChangeSetDeployment");
95262
- __name(toExecuteChangeSetDeployment, "toExecuteChangeSetDeployment");
95263
- }
95264
- });
95265
-
95266
- // ../@aws-cdk/toolkit-lib/lib/payloads/hotswap.ts
95267
- var NonHotswappableReason;
95268
- var init_hotswap = __esm({
95269
- "../@aws-cdk/toolkit-lib/lib/payloads/hotswap.ts"() {
95270
- "use strict";
95271
- NonHotswappableReason = /* @__PURE__ */ ((NonHotswappableReason2) => {
95272
- NonHotswappableReason2["TAGS"] = "tags";
95273
- NonHotswappableReason2["PROPERTIES"] = "properties";
95274
- NonHotswappableReason2["OUTPUT"] = "output";
95275
- NonHotswappableReason2["DEPENDENCY_UNSUPPORTED"] = "dependency-unsupported";
95276
- NonHotswappableReason2["RESOURCE_UNSUPPORTED"] = "resource-unsupported";
95277
- NonHotswappableReason2["RESOURCE_CREATION"] = "resource-creation";
95278
- NonHotswappableReason2["RESOURCE_DELETION"] = "resource-deletion";
95279
- NonHotswappableReason2["RESOURCE_TYPE_CHANGED"] = "resource-type-changed";
95280
- NonHotswappableReason2["NESTED_STACK_CREATION"] = "nested-stack-creation";
95281
- return NonHotswappableReason2;
95282
- })(NonHotswappableReason || {});
95283
- }
95284
- });
95285
-
95286
- // ../@aws-cdk/toolkit-lib/lib/api/hotswap/common.ts
95287
- function createHotswapPropertyOverrides(props) {
95288
- return new HotswapPropertyOverrides(new EcsHotswapProperties(
95289
- props.ecs?.minimumHealthyPercent,
95290
- props.ecs?.maximumHealthyPercent,
95291
- props.ecs?.stabilizationTimeoutSeconds
95292
- ));
95293
- }
95294
- function classifyChanges(xs, hotswappablePropNames) {
95295
- const hotswappableProps = {};
95296
- const nonHotswappableProps = {};
95297
- for (const [name, propDiff] of Object.entries(xs.propertyUpdates)) {
95298
- if (hotswappablePropNames.includes(name)) {
95299
- hotswappableProps[name] = propDiff;
95300
- } else {
95301
- nonHotswappableProps[name] = propDiff;
95302
- }
95303
- }
95304
- return new ClassifiedChanges(xs, hotswappableProps, nonHotswappableProps);
95305
- }
95306
- function nonHotswappableChange(change, reason, description, nonHotswappableProps, hotswapOnlyVisible = true) {
95307
- return {
95308
- hotswappable: false,
95309
- hotswapOnlyVisible,
95310
- change: {
95311
- reason,
95312
- description,
95313
- subject: {
95314
- type: "Resource",
95315
- logicalId: change.logicalId,
95316
- resourceType: change.newValue.Type,
95317
- rejectedProperties: Object.keys(nonHotswappableProps ?? change.propertyUpdates),
95318
- metadata: change.metadata
95319
- }
95320
- }
95321
- };
95322
- }
95323
- function nonHotswappableResource(change) {
95324
- return {
95325
- hotswappable: false,
95326
- change: {
95327
- reason: "resource-unsupported" /* RESOURCE_UNSUPPORTED */,
95328
- description: "This resource type is not supported for hotswap deployments",
95329
- subject: {
95330
- type: "Resource",
95331
- logicalId: change.logicalId,
95332
- resourceType: change.newValue.Type,
95333
- rejectedProperties: Object.keys(change.propertyUpdates),
95334
- metadata: change.metadata
95335
- }
95336
- }
95337
- };
95338
- }
95339
- var ICON, HotswapPropertyOverrides, EcsHotswapProperties, ClassifiedChanges;
95340
- var init_common3 = __esm({
95341
- "../@aws-cdk/toolkit-lib/lib/api/hotswap/common.ts"() {
95342
- "use strict";
95343
- init_hotswap();
95344
- init_toolkit_error();
95345
- ICON = "\u2728";
95346
- HotswapPropertyOverrides = class {
95347
- static {
95348
- __name(this, "HotswapPropertyOverrides");
95349
- }
95350
- // Each supported resource type will have its own properties. Currently this is ECS
95351
- ecs;
95352
- constructor(ecs) {
95353
- this.ecs = ecs;
95354
- }
95355
- };
95356
- EcsHotswapProperties = class {
95357
- static {
95358
- __name(this, "EcsHotswapProperties");
95359
- }
95360
- // The lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount
95361
- minimumHealthyPercent;
95362
- // The upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount
95363
- maximumHealthyPercent;
95364
- // The number of seconds to wait for a single service to reach stable state.
95365
- stabilizationTimeoutSeconds;
95366
- constructor(minimumHealthyPercent, maximumHealthyPercent, stabilizationTimeoutSeconds) {
95367
- if (minimumHealthyPercent !== void 0 && minimumHealthyPercent < 0) {
95368
- throw new ToolkitError("InvalidEcsMinHealthyPercent", "hotswap-ecs-minimum-healthy-percent can't be a negative number");
95369
- }
95370
- if (maximumHealthyPercent !== void 0 && maximumHealthyPercent < 0) {
95371
- throw new ToolkitError("InvalidEcsMaxHealthyPercent", "hotswap-ecs-maximum-healthy-percent can't be a negative number");
95372
- }
95373
- if (stabilizationTimeoutSeconds !== void 0 && stabilizationTimeoutSeconds < 0) {
95374
- throw new ToolkitError("InvalidEcsStabilizationTimeout", "hotswap-ecs-stabilization-timeout-seconds can't be a negative number");
95375
- }
95376
- if (minimumHealthyPercent == void 0) {
95377
- this.minimumHealthyPercent = 0;
95378
- } else {
95379
- this.minimumHealthyPercent = minimumHealthyPercent;
95380
- }
95381
- this.maximumHealthyPercent = maximumHealthyPercent;
95382
- this.stabilizationTimeoutSeconds = stabilizationTimeoutSeconds;
95383
- }
95384
- /**
95385
- * Check if any hotswap properties are defined
95386
- * @returns true if all properties are undefined, false otherwise
95387
- */
95388
- isEmpty() {
95389
- return this.minimumHealthyPercent === 0 && this.maximumHealthyPercent === void 0;
95390
- }
95391
- };
95392
- __name(createHotswapPropertyOverrides, "createHotswapPropertyOverrides");
95393
- ClassifiedChanges = class {
95394
- constructor(change, hotswappableProps, nonHotswappableProps) {
95395
- this.change = change;
95396
- this.hotswappableProps = hotswappableProps;
95397
- this.nonHotswappableProps = nonHotswappableProps;
95398
- }
95399
- change;
95400
- hotswappableProps;
95401
- nonHotswappableProps;
95402
- static {
95403
- __name(this, "ClassifiedChanges");
95404
- }
95405
- reportNonHotswappablePropertyChanges(ret) {
95406
- const nonHotswappablePropNames = Object.keys(this.nonHotswappableProps);
95407
- if (nonHotswappablePropNames.length > 0) {
95408
- const tagOnlyChange = nonHotswappablePropNames.length === 1 && nonHotswappablePropNames[0] === "Tags";
95409
- const reason = tagOnlyChange ? "tags" /* TAGS */ : "properties" /* PROPERTIES */;
95410
- const description = tagOnlyChange ? "Tags are not hotswappable" : `resource properties '${nonHotswappablePropNames}' are not hotswappable on this resource type`;
95411
- ret.push(nonHotswappableChange(
95412
- this.change,
95413
- reason,
95414
- description,
95415
- this.nonHotswappableProps
95416
- ));
95417
- }
95418
- }
95419
- get namesOfHotswappableProps() {
95420
- return Object.keys(this.hotswappableProps);
95421
- }
95422
- };
95423
- __name(classifyChanges, "classifyChanges");
95424
- __name(nonHotswappableChange, "nonHotswappableChange");
95425
- __name(nonHotswappableResource, "nonHotswappableResource");
95426
- }
95427
- });
95428
-
95429
95378
  // ../../node_modules/@cdklabs/tskb/lib/sorted-map.js
95430
95379
  var require_sorted_map = __commonJS({
95431
95380
  "../../node_modules/@cdklabs/tskb/lib/sorted-map.js"(exports2) {
@@ -97271,12 +97220,12 @@ function defaultResource(resource, statements) {
97271
97220
  statements.forEach((s2) => s2.resources.replaceStar(resource));
97272
97221
  return statements;
97273
97222
  }
97274
- var import_service_spec_types, import_chalk4, IamChanges;
97223
+ var import_service_spec_types, import_chalk3, IamChanges;
97275
97224
  var init_iam_changes = __esm({
97276
97225
  "../@aws-cdk/cloudformation-diff/lib/iam/iam-changes.ts"() {
97277
97226
  "use strict";
97278
97227
  import_service_spec_types = __toESM(require_lib7());
97279
- import_chalk4 = __toESM(require_source());
97228
+ import_chalk3 = __toESM(require_source());
97280
97229
  init_iam_identity_center();
97281
97230
  init_managed_policy();
97282
97231
  init_statement();
@@ -97346,7 +97295,7 @@ var init_iam_changes = __esm({
97346
97295
  renderedStatement.action,
97347
97296
  renderedStatement.principal,
97348
97297
  renderedStatement.condition
97349
- ].map((s2) => import_chalk4.default.green(s2)));
97298
+ ].map((s2) => import_chalk3.default.green(s2)));
97350
97299
  }
97351
97300
  for (const statement of this.statements.removals) {
97352
97301
  const renderedStatement = statement.render();
@@ -97357,7 +97306,7 @@ var init_iam_changes = __esm({
97357
97306
  renderedStatement.action,
97358
97307
  renderedStatement.principal,
97359
97308
  renderedStatement.condition
97360
- ].map((s2) => import_chalk4.default.red(s2)));
97309
+ ].map((s2) => import_chalk3.default.red(s2)));
97361
97310
  }
97362
97311
  ret.sort(makeComparator((row) => [row[1]]));
97363
97312
  ret.splice(0, 0, header);
@@ -97371,14 +97320,14 @@ var init_iam_changes = __esm({
97371
97320
  "+",
97372
97321
  att.identityArn,
97373
97322
  att.managedPolicyArn
97374
- ].map((s2) => import_chalk4.default.green(s2)));
97323
+ ].map((s2) => import_chalk3.default.green(s2)));
97375
97324
  }
97376
97325
  for (const att of this.managedPolicies.removals) {
97377
97326
  ret.push([
97378
97327
  "-",
97379
97328
  att.identityArn,
97380
97329
  att.managedPolicyArn
97381
- ].map((s2) => import_chalk4.default.red(s2)));
97330
+ ].map((s2) => import_chalk3.default.red(s2)));
97382
97331
  }
97383
97332
  ret.sort(makeComparator((row) => [row[1]]));
97384
97333
  ret.splice(0, 0, header);
@@ -97397,7 +97346,7 @@ var init_iam_changes = __esm({
97397
97346
  att.principalType || "",
97398
97347
  att.targetId || "",
97399
97348
  att.targetType || ""
97400
- ].map((s2) => import_chalk4.default.green(s2)));
97349
+ ].map((s2) => import_chalk3.default.green(s2)));
97401
97350
  }
97402
97351
  for (const att of this.ssoAssignments.removals) {
97403
97352
  ret.push([
@@ -97409,7 +97358,7 @@ var init_iam_changes = __esm({
97409
97358
  att.principalType || "",
97410
97359
  att.targetId || "",
97411
97360
  att.targetType || ""
97412
- ].map((s2) => import_chalk4.default.red(s2)));
97361
+ ].map((s2) => import_chalk3.default.red(s2)));
97413
97362
  }
97414
97363
  ret.sort(makeComparator((row) => [row[1]]));
97415
97364
  ret.splice(0, 0, header);
@@ -97428,7 +97377,7 @@ var init_iam_changes = __esm({
97428
97377
  att.cfnLogicalId || "",
97429
97378
  att.ssoInstanceArn || "",
97430
97379
  att.accessControlAttributes?.map(formatAccessControlAttribute).join("\n") || ""
97431
- ].map((s2) => import_chalk4.default.green(s2)));
97380
+ ].map((s2) => import_chalk3.default.green(s2)));
97432
97381
  }
97433
97382
  for (const att of this.ssoInstanceACAConfigs.removals) {
97434
97383
  ret.push([
@@ -97436,7 +97385,7 @@ var init_iam_changes = __esm({
97436
97385
  att.cfnLogicalId || "",
97437
97386
  att.ssoInstanceArn || "",
97438
97387
  att.accessControlAttributes?.map(formatAccessControlAttribute).join("\n") || ""
97439
- ].map((s2) => import_chalk4.default.red(s2)));
97388
+ ].map((s2) => import_chalk3.default.red(s2)));
97440
97389
  }
97441
97390
  ret.sort(makeComparator((row) => [row[1]]));
97442
97391
  ret.splice(0, 0, header);
@@ -97469,7 +97418,7 @@ var init_iam_changes = __esm({
97469
97418
  att.name || "",
97470
97419
  formatSsoPermissionsBoundary(att.ssoPermissionsBoundary),
97471
97420
  att.ssoCustomerManagedPolicyReferences?.map(formatManagedPolicyRef).join("\n") || ""
97472
- ].map((s2) => import_chalk4.default.green(s2)));
97421
+ ].map((s2) => import_chalk3.default.green(s2)));
97473
97422
  }
97474
97423
  for (const att of this.ssoPermissionSets.removals) {
97475
97424
  ret.push([
@@ -97479,7 +97428,7 @@ var init_iam_changes = __esm({
97479
97428
  att.name || "",
97480
97429
  formatSsoPermissionsBoundary(att.ssoPermissionsBoundary),
97481
97430
  att.ssoCustomerManagedPolicyReferences?.map(formatManagedPolicyRef).join("\n") || ""
97482
- ].map((s2) => import_chalk4.default.red(s2)));
97431
+ ].map((s2) => import_chalk3.default.red(s2)));
97483
97432
  }
97484
97433
  ret.sort(makeComparator((row) => [row[1]]));
97485
97434
  ret.splice(0, 0, header);
@@ -97799,11 +97748,11 @@ var init_security_group_rule = __esm({
97799
97748
  });
97800
97749
 
97801
97750
  // ../@aws-cdk/cloudformation-diff/lib/network/security-group-changes.ts
97802
- var import_chalk5, SecurityGroupChanges;
97751
+ var import_chalk4, SecurityGroupChanges;
97803
97752
  var init_security_group_changes = __esm({
97804
97753
  "../@aws-cdk/cloudformation-diff/lib/network/security-group-changes.ts"() {
97805
97754
  "use strict";
97806
- import_chalk5 = __toESM(require_source());
97755
+ import_chalk4 = __toESM(require_source());
97807
97756
  init_security_group_rule();
97808
97757
  init_diffable();
97809
97758
  init_render_intrinsics();
@@ -97851,7 +97800,7 @@ var init_security_group_changes = __esm({
97851
97800
  inOut,
97852
97801
  rule.describeProtocol(),
97853
97802
  rule.describePeer()
97854
- ].map((s2) => plusMin === "+" ? import_chalk5.default.green(s2) : import_chalk5.default.red(s2)), "renderRule");
97803
+ ].map((s2) => plusMin === "+" ? import_chalk4.default.green(s2) : import_chalk4.default.red(s2)), "renderRule");
97855
97804
  ret.push(...this.ingress.additions.map(renderRule("+", inWord)));
97856
97805
  ret.push(...this.egress.additions.map(renderRule("+", outWord)));
97857
97806
  ret.push(...this.ingress.removals.map(renderRule("-", inWord)));
@@ -99126,15 +99075,15 @@ __export(format_foreach_exports, {
99126
99075
  function isForEachKey(logicalId) {
99127
99076
  return logicalId.startsWith("Fn::ForEach::");
99128
99077
  }
99129
- var import_chalk6, ADDITION, UPDATE, REMOVAL, ForEachDiffFormatter;
99078
+ var import_chalk5, ADDITION, UPDATE, REMOVAL, ForEachDiffFormatter;
99130
99079
  var init_format_foreach = __esm({
99131
99080
  "../@aws-cdk/cloudformation-diff/lib/format-foreach.ts"() {
99132
99081
  "use strict";
99133
- import_chalk6 = __toESM(require_source());
99082
+ import_chalk5 = __toESM(require_source());
99134
99083
  init_util6();
99135
- ADDITION = import_chalk6.default.green("[+]");
99136
- UPDATE = import_chalk6.default.yellow("[~]");
99137
- REMOVAL = import_chalk6.default.red("[-]");
99084
+ ADDITION = import_chalk5.default.green("[+]");
99085
+ UPDATE = import_chalk5.default.yellow("[~]");
99086
+ REMOVAL = import_chalk5.default.red("[-]");
99138
99087
  ForEachDiffFormatter = class {
99139
99088
  static {
99140
99089
  __name(this, "ForEachDiffFormatter");
@@ -99147,24 +99096,24 @@ var init_format_foreach = __esm({
99147
99096
  const changeType = this.getChangeType(oldValue, newValue);
99148
99097
  const value2 = newValue ?? oldValue;
99149
99098
  if (!Array.isArray(value2) || value2.length < 2) {
99150
- lines.push(`${this.changeSymbol(changeType)} ${import_chalk6.default.cyan(key)} (unrecognized ForEach structure)`);
99099
+ lines.push(`${this.changeSymbol(changeType)} ${import_chalk5.default.cyan(key)} (unrecognized ForEach structure)`);
99151
99100
  return lines;
99152
99101
  }
99153
99102
  const loopName = key.replace("Fn::ForEach::", "");
99154
99103
  const [collection, templateObj] = value2;
99155
99104
  const entries = Object.entries(templateObj);
99156
99105
  if (entries.length === 0) {
99157
- lines.push(`${this.changeSymbol(changeType)} ${import_chalk6.default.cyan(key)} (empty ForEach template)`);
99106
+ lines.push(`${this.changeSymbol(changeType)} ${import_chalk5.default.cyan(key)} (empty ForEach template)`);
99158
99107
  return lines;
99159
99108
  }
99160
99109
  const [[templateKey, templateValue]] = entries;
99161
99110
  const count = Array.isArray(collection) ? `${collection.length} resources` : "dynamic count";
99162
99111
  lines.push(
99163
- `${this.changeSymbol(changeType)} ${import_chalk6.default.cyan(key)} (expands to ${count} at deploy time)`
99112
+ `${this.changeSymbol(changeType)} ${import_chalk5.default.cyan(key)} (expands to ${count} at deploy time)`
99164
99113
  );
99165
- lines.push(` Loop variable: ${import_chalk6.default.blue(loopName)}`);
99114
+ lines.push(` Loop variable: ${import_chalk5.default.blue(loopName)}`);
99166
99115
  lines.push(` Collection: ${this.formatCollection(collection)}`);
99167
- lines.push(` \u2514\u2500\u2500 ${templateKey} ${import_chalk6.default.cyan(templateValue?.Type ?? "Unknown")}`);
99116
+ lines.push(` \u2514\u2500\u2500 ${templateKey} ${import_chalk5.default.cyan(templateValue?.Type ?? "Unknown")}`);
99168
99117
  if (changeType === "update" && oldValue && newValue) {
99169
99118
  const oldProps = oldValue[1]?.[Object.keys(oldValue[1])[0]]?.Properties ?? {};
99170
99119
  const newProps = newValue[1]?.[Object.keys(newValue[1])[0]]?.Properties ?? {};
@@ -103869,11 +103818,11 @@ function sum(xs) {
103869
103818
  }
103870
103819
  return total;
103871
103820
  }
103872
- var import_chalk7, import_string_width, table, tableColor, TABLE_BORDER_CHARACTERS;
103821
+ var import_chalk6, import_string_width, table, tableColor, TABLE_BORDER_CHARACTERS;
103873
103822
  var init_format_table = __esm({
103874
103823
  "../@aws-cdk/cloudformation-diff/lib/format-table.ts"() {
103875
103824
  "use strict";
103876
- import_chalk7 = __toESM(require_source());
103825
+ import_chalk6 = __toESM(require_source());
103877
103826
  import_string_width = __toESM(require_string_width());
103878
103827
  table = __toESM(require_src());
103879
103828
  __name(formatTable, "formatTable");
@@ -103881,7 +103830,7 @@ var init_format_table = __esm({
103881
103830
  __name(buildColumnConfig, "buildColumnConfig");
103882
103831
  __name(calculateColumnWidths, "calculateColumnWidths");
103883
103832
  __name(sum, "sum");
103884
- tableColor = import_chalk7.default.gray;
103833
+ tableColor = import_chalk6.default.gray;
103885
103834
  TABLE_BORDER_CHARACTERS = {
103886
103835
  topBody: tableColor("\u2500"),
103887
103836
  topJoin: tableColor("\u252C"),
@@ -105968,7 +105917,7 @@ function _diffStrings(oldStr, newStr, context) {
105968
105917
  const patch = structuredPatch(null, null, oldStr, newStr, null, null, { context });
105969
105918
  const result2 = new Array();
105970
105919
  for (const hunk of patch.hunks) {
105971
- result2.push(import_chalk8.default.magenta(`@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`));
105920
+ result2.push(import_chalk7.default.magenta(`@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`));
105972
105921
  const baseIndent = _findIndent(hunk.lines);
105973
105922
  for (const line of hunk.lines) {
105974
105923
  if (line === "\") {
@@ -105981,10 +105930,10 @@ function _diffStrings(oldStr, newStr, context) {
105981
105930
  result2.push(`${CONTEXT} ${text}`);
105982
105931
  break;
105983
105932
  case "+":
105984
- result2.push(import_chalk8.default.bold(`${ADDITION2} ${import_chalk8.default.green(text)}`));
105933
+ result2.push(import_chalk7.default.bold(`${ADDITION2} ${import_chalk7.default.green(text)}`));
105985
105934
  break;
105986
105935
  case "-":
105987
- result2.push(import_chalk8.default.bold(`${REMOVAL2} ${import_chalk8.default.red(text)}`));
105936
+ result2.push(import_chalk7.default.bold(`${REMOVAL2} ${import_chalk7.default.red(text)}`));
105988
105937
  break;
105989
105938
  default:
105990
105939
  throw new Error(`Unexpected diff marker: ${marker} (full line: ${line})`);
@@ -106006,12 +105955,12 @@ function _diffStrings(oldStr, newStr, context) {
106006
105955
  }
106007
105956
  __name(_findIndent, "_findIndent");
106008
105957
  }
106009
- var import_util24, import_chalk8, PATH_METADATA_KEY3, structuredPatch, ADDITION2, CONTEXT, UPDATE2, REMOVAL2, IMPORT, Formatter;
105958
+ var import_util24, import_chalk7, PATH_METADATA_KEY3, structuredPatch, ADDITION2, CONTEXT, UPDATE2, REMOVAL2, IMPORT, Formatter;
106010
105959
  var init_format = __esm({
106011
105960
  "../@aws-cdk/cloudformation-diff/lib/format.ts"() {
106012
105961
  "use strict";
106013
105962
  import_util24 = require("util");
106014
- import_chalk8 = __toESM(require_source());
105963
+ import_chalk7 = __toESM(require_source());
106015
105964
  init_util6();
106016
105965
  init_diff_template();
106017
105966
  init_format_foreach();
@@ -106021,11 +105970,11 @@ var init_format = __esm({
106021
105970
  __name(formatDifferences, "formatDifferences");
106022
105971
  __name(formatSecurityChanges, "formatSecurityChanges");
106023
105972
  __name(formatSecurityChangesWithBanner, "formatSecurityChangesWithBanner");
106024
- ADDITION2 = import_chalk8.default.green("[+]");
106025
- CONTEXT = import_chalk8.default.grey("[ ]");
106026
- UPDATE2 = import_chalk8.default.yellow("[~]");
106027
- REMOVAL2 = import_chalk8.default.red("[-]");
106028
- IMPORT = import_chalk8.default.blue("[\u2190]");
105973
+ ADDITION2 = import_chalk7.default.green("[+]");
105974
+ CONTEXT = import_chalk7.default.grey("[ ]");
105975
+ UPDATE2 = import_chalk7.default.yellow("[~]");
105976
+ REMOVAL2 = import_chalk7.default.red("[-]");
105977
+ IMPORT = import_chalk7.default.blue("[\u2190]");
106029
105978
  Formatter = class {
106030
105979
  constructor(stream, logicalToPathMap, diff, context = 3) {
106031
105980
  this.stream = stream;
@@ -106042,10 +105991,10 @@ var init_format = __esm({
106042
105991
  __name(this, "Formatter");
106043
105992
  }
106044
105993
  print(fmt, ...args) {
106045
- this.stream.write(import_chalk8.default.reset((0, import_util24.format)(fmt, ...args)) + "\n");
105994
+ this.stream.write(import_chalk7.default.reset((0, import_util24.format)(fmt, ...args)) + "\n");
106046
105995
  }
106047
105996
  warning(fmt, ...args) {
106048
- this.stream.write(import_chalk8.default.yellow((0, import_util24.format)(fmt, ...args)) + "\n");
105997
+ this.stream.write(import_chalk7.default.yellow((0, import_util24.format)(fmt, ...args)) + "\n");
106049
105998
  }
106050
105999
  formatSection(title, entryType, collection, formatter = this.formatDifference.bind(this)) {
106051
106000
  if (collection.differenceCount === 0) {
@@ -106056,7 +106005,7 @@ var init_format = __esm({
106056
106005
  this.printSectionFooter();
106057
106006
  }
106058
106007
  printSectionHeader(title) {
106059
- this.print(import_chalk8.default.underline(import_chalk8.default.bold(title)));
106008
+ this.print(import_chalk7.default.underline(import_chalk7.default.bold(title)));
106060
106009
  }
106061
106010
  printSectionFooter() {
106062
106011
  this.print("");
@@ -106072,8 +106021,8 @@ var init_format = __esm({
106072
106021
  return;
106073
106022
  }
106074
106023
  let value2;
106075
- const oldValue = this.formatValue(diff.oldValue, import_chalk8.default.red);
106076
- const newValue = this.formatValue(diff.newValue, import_chalk8.default.green);
106024
+ const oldValue = this.formatValue(diff.oldValue, import_chalk7.default.red);
106025
+ const newValue = this.formatValue(diff.newValue, import_chalk7.default.green);
106077
106026
  if (diff.isAddition) {
106078
106027
  value2 = newValue;
106079
106028
  } else if (diff.isUpdate) {
@@ -106081,7 +106030,7 @@ var init_format = __esm({
106081
106030
  } else if (diff.isRemoval) {
106082
106031
  value2 = oldValue;
106083
106032
  }
106084
- this.print(`${this.formatPrefix(diff)} ${import_chalk8.default.cyan(type)} ${this.formatLogicalId(logicalId)}: ${value2}`);
106033
+ this.print(`${this.formatPrefix(diff)} ${import_chalk7.default.cyan(type)} ${this.formatLogicalId(logicalId)}: ${value2}`);
106085
106034
  }
106086
106035
  /**
106087
106036
  * Print a resource difference for a given logical ID.
@@ -106104,7 +106053,7 @@ var init_format = __esm({
106104
106053
  const resourceType = diff.isRemoval ? diff.oldResourceType : diff.newResourceType;
106105
106054
  const message2 = [
106106
106055
  this.formatResourcePrefix(diff),
106107
- this.formatValue(resourceType, import_chalk8.default.cyan),
106056
+ this.formatValue(resourceType, import_chalk7.default.cyan),
106108
106057
  this.formatLogicalId(logicalId),
106109
106058
  this.formatImpact(diff.changeImpact),
106110
106059
  this.formatMove(diff.move)
@@ -106135,7 +106084,7 @@ var init_format = __esm({
106135
106084
  if (diff.isRemoval) {
106136
106085
  return REMOVAL2;
106137
106086
  }
106138
- return import_chalk8.default.reset("[?]");
106087
+ return import_chalk7.default.reset("[?]");
106139
106088
  }
106140
106089
  /**
106141
106090
  * @param value - the value to be formatted.
@@ -106159,15 +106108,15 @@ var init_format = __esm({
106159
106108
  formatImpact(impact) {
106160
106109
  switch (impact) {
106161
106110
  case "MAY_REPLACE" /* MAY_REPLACE */:
106162
- return import_chalk8.default.italic(import_chalk8.default.yellow("may be replaced"));
106111
+ return import_chalk7.default.italic(import_chalk7.default.yellow("may be replaced"));
106163
106112
  case "WILL_REPLACE" /* WILL_REPLACE */:
106164
- return import_chalk8.default.italic(import_chalk8.default.bold(import_chalk8.default.red("replace")));
106113
+ return import_chalk7.default.italic(import_chalk7.default.bold(import_chalk7.default.red("replace")));
106165
106114
  case "WILL_DESTROY" /* WILL_DESTROY */:
106166
- return import_chalk8.default.italic(import_chalk8.default.bold(import_chalk8.default.red("destroy")));
106115
+ return import_chalk7.default.italic(import_chalk7.default.bold(import_chalk7.default.red("destroy")));
106167
106116
  case "WILL_ORPHAN" /* WILL_ORPHAN */:
106168
- return import_chalk8.default.italic(import_chalk8.default.yellow("orphan"));
106117
+ return import_chalk7.default.italic(import_chalk7.default.yellow("orphan"));
106169
106118
  case "WILL_IMPORT" /* WILL_IMPORT */:
106170
- return import_chalk8.default.italic(import_chalk8.default.blue("import"));
106119
+ return import_chalk7.default.italic(import_chalk7.default.blue("import"));
106171
106120
  case "WILL_UPDATE" /* WILL_UPDATE */:
106172
106121
  case "WILL_CREATE" /* WILL_CREATE */:
106173
106122
  case "NO_CHANGE" /* NO_CHANGE */:
@@ -106175,7 +106124,7 @@ var init_format = __esm({
106175
106124
  }
106176
106125
  }
106177
106126
  formatMove(move) {
106178
- return !move ? "" : import_chalk8.default.yellow("(OR", import_chalk8.default.italic(import_chalk8.default.bold("move")), `${move.direction} ${move.stackName}.${move.resourceLogicalId} via refactoring)`);
106127
+ return !move ? "" : import_chalk7.default.yellow("(OR", import_chalk7.default.italic(import_chalk7.default.bold("move")), `${move.direction} ${move.stackName}.${move.resourceLogicalId} via refactoring)`);
106179
106128
  }
106180
106129
  /**
106181
106130
  * Renders a tree of differences under a particular name.
@@ -106214,13 +106163,13 @@ var init_format = __esm({
106214
106163
  this.print("%s %s %s", linePrefix, i6 === 0 ? "\u2514\u2500" : " ", diff[i6]);
106215
106164
  }
106216
106165
  } else {
106217
- this.print("%s \u251C\u2500 %s %s", linePrefix, REMOVAL2, this.formatValue(oldObject, import_chalk8.default.red));
106218
- this.print("%s \u2514\u2500 %s %s", linePrefix, ADDITION2, this.formatValue(newObject, import_chalk8.default.green));
106166
+ this.print("%s \u251C\u2500 %s %s", linePrefix, REMOVAL2, this.formatValue(oldObject, import_chalk7.default.red));
106167
+ this.print("%s \u2514\u2500 %s %s", linePrefix, ADDITION2, this.formatValue(newObject, import_chalk7.default.green));
106219
106168
  }
106220
106169
  } else if (oldObject !== void 0) {
106221
- this.print("%s \u2514\u2500 %s", linePrefix, this.formatValue(oldObject, import_chalk8.default.red));
106170
+ this.print("%s \u2514\u2500 %s", linePrefix, this.formatValue(oldObject, import_chalk7.default.red));
106222
106171
  } else {
106223
- this.print("%s \u2514\u2500 %s", linePrefix, this.formatValue(newObject, import_chalk8.default.green));
106172
+ this.print("%s \u2514\u2500 %s", linePrefix, this.formatValue(newObject, import_chalk7.default.green));
106224
106173
  }
106225
106174
  return;
106226
106175
  }
@@ -106233,12 +106182,12 @@ var init_format = __esm({
106233
106182
  const newValue = newObject[key];
106234
106183
  const treePrefix = key === lastKey ? "\u2514" : "\u251C";
106235
106184
  if (oldValue !== void 0 && newValue !== void 0) {
106236
- this.print("%s %s\u2500 %s %s:", linePrefix, treePrefix, this.changeTag(oldValue, newValue), import_chalk8.default.blue(`.${key}`));
106185
+ this.print("%s %s\u2500 %s %s:", linePrefix, treePrefix, this.changeTag(oldValue, newValue), import_chalk7.default.blue(`.${key}`));
106237
106186
  this.formatObjectDiff(oldValue, newValue, `${linePrefix} ${key === lastKey ? " " : "\u2502"}`);
106238
106187
  } else if (oldValue !== void 0) {
106239
- this.print("%s %s\u2500 %s Removed: %s", linePrefix, treePrefix, REMOVAL2, import_chalk8.default.blue(`.${key}`));
106188
+ this.print("%s %s\u2500 %s Removed: %s", linePrefix, treePrefix, REMOVAL2, import_chalk7.default.blue(`.${key}`));
106240
106189
  } else {
106241
- this.print("%s %s\u2500 %s Added: %s", linePrefix, treePrefix, ADDITION2, import_chalk8.default.blue(`.${key}`));
106190
+ this.print("%s %s\u2500 %s Added: %s", linePrefix, treePrefix, ADDITION2, import_chalk7.default.blue(`.${key}`));
106242
106191
  }
106243
106192
  }
106244
106193
  }
@@ -106282,7 +106231,7 @@ var init_format = __esm({
106282
106231
  formatLogicalId(logicalId) {
106283
106232
  const normalized = this.normalizedLogicalIdPath(logicalId);
106284
106233
  if (normalized) {
106285
- return `${normalized} ${import_chalk8.default.gray(logicalId)}`;
106234
+ return `${normalized} ${import_chalk7.default.gray(logicalId)}`;
106286
106235
  }
106287
106236
  return logicalId;
106288
106237
  }
@@ -106374,7 +106323,7 @@ function formatTypedMappings(stream, mappings) {
106374
106323
  const rows = mappings.map((m4) => [m4.type, m4.sourcePath, m4.destinationPath]);
106375
106324
  const formatter = new Formatter(stream, {});
106376
106325
  formatter.print("The following resources were moved or renamed:");
106377
- formatter.print(import_chalk9.default.green(formatTable(header.concat(rows), void 0)));
106326
+ formatter.print(import_chalk8.default.green(formatTable(header.concat(rows), void 0)));
106378
106327
  formatter.print(" ");
106379
106328
  }
106380
106329
  }
@@ -106384,18 +106333,18 @@ function formatAmbiguousMappings(stream, pairs) {
106384
106333
  formatter.print("Detected ambiguities:");
106385
106334
  formatter.print(tables.join("\n\n"));
106386
106335
  formatter.print(" ");
106387
- formatter.print(import_chalk9.default.yellow("Please provide an override file to resolve these ambiguous mappings."));
106336
+ formatter.print(import_chalk8.default.yellow("Please provide an override file to resolve these ambiguous mappings."));
106388
106337
  formatter.print(" ");
106389
106338
  function renderTable2([removed, added]) {
106390
106339
  return formatTable([["", "Resource"], renderRemoval(removed), renderAddition(added)], void 0);
106391
106340
  }
106392
106341
  __name(renderTable2, "renderTable");
106393
106342
  function renderRemoval(locations) {
106394
- return [import_chalk9.default.red("-"), import_chalk9.default.red(renderLocations(locations))];
106343
+ return [import_chalk8.default.red("-"), import_chalk8.default.red(renderLocations(locations))];
106395
106344
  }
106396
106345
  __name(renderRemoval, "renderRemoval");
106397
106346
  function renderAddition(locations) {
106398
- return [import_chalk9.default.green("+"), import_chalk9.default.green(renderLocations(locations))];
106347
+ return [import_chalk8.default.green("+"), import_chalk8.default.green(renderLocations(locations))];
106399
106348
  }
106400
106349
  __name(renderAddition, "renderAddition");
106401
106350
  function renderLocations(locs) {
@@ -106403,11 +106352,11 @@ function formatAmbiguousMappings(stream, pairs) {
106403
106352
  }
106404
106353
  __name(renderLocations, "renderLocations");
106405
106354
  }
106406
- var import_chalk9;
106355
+ var import_chalk8;
106407
106356
  var init_mappings = __esm({
106408
106357
  "../@aws-cdk/cloudformation-diff/lib/mappings.ts"() {
106409
106358
  "use strict";
106410
- import_chalk9 = __toESM(require_source());
106359
+ import_chalk8 = __toESM(require_source());
106411
106360
  init_format();
106412
106361
  init_format_table();
106413
106362
  __name(formatEnvironmentSectionHeader, "formatEnvironmentSectionHeader");
@@ -106453,6 +106402,306 @@ var require_lib9 = __commonJS({
106453
106402
  }
106454
106403
  });
106455
106404
 
106405
+ // ../@aws-cdk/toolkit-lib/lib/api/deployments/assets.ts
106406
+ async function addMetadataAssetsToManifest(ioHelper, stack, assetManifest, envResources, reuse) {
106407
+ reuse = reuse || [];
106408
+ const assets = stack.assets;
106409
+ if (assets.length === 0) {
106410
+ return {};
106411
+ }
106412
+ const toolkitInfo = await envResources.lookupToolkit();
106413
+ if (!toolkitInfo.found) {
106414
+ throw new ToolkitError("BootstrapStackRequired", `This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${import_chalk9.default.blue("cdk bootstrap " + stack.environment.name)}")`);
106415
+ }
106416
+ const params = {};
106417
+ for (const asset of assets) {
106418
+ const reuseAsset = reuse.indexOf(asset.id) > -1;
106419
+ if (reuseAsset) {
106420
+ await ioHelper.defaults.debug(`Reusing asset ${asset.id}: ${JSON.stringify(asset)}`);
106421
+ continue;
106422
+ }
106423
+ await ioHelper.defaults.debug(`Preparing asset ${asset.id}: ${JSON.stringify(asset)}`);
106424
+ if (!stack.assembly) {
106425
+ throw new ToolkitError("AssemblyRequired", "Unexpected: stack assembly is required in order to find assets in assembly directory");
106426
+ }
106427
+ Object.assign(params, await prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo));
106428
+ }
106429
+ return params;
106430
+ }
106431
+ async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo) {
106432
+ switch (asset.packaging) {
106433
+ case "zip":
106434
+ case "file":
106435
+ return prepareFileAsset(
106436
+ ioHelper,
106437
+ asset,
106438
+ assetManifest,
106439
+ toolkitInfo,
106440
+ asset.packaging === "zip" ? cxschema8.FileAssetPackaging.ZIP_DIRECTORY : cxschema8.FileAssetPackaging.FILE
106441
+ );
106442
+ case "container-image":
106443
+ return prepareDockerImageAsset(asset, assetManifest, envResources);
106444
+ default:
106445
+ throw new ToolkitError("UnsupportedPackaging", `Unsupported packaging type: ${asset.packaging}. You might need to upgrade your aws-cdk toolkit to support this asset type.`);
106446
+ }
106447
+ }
106448
+ async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, packaging) {
106449
+ const extension = packaging === cxschema8.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" : path18.extname(asset.path);
106450
+ const baseName = `${asset.sourceHash}${extension}`;
106451
+ const s3Prefix = asset.id === asset.sourceHash ? "assets/" : `assets/${asset.id}/`;
106452
+ const key = `${s3Prefix}${baseName}`;
106453
+ const s3url = `s3://${toolkitInfo.bucketName}/${key}`;
106454
+ await ioHelper.defaults.debug(`Storing asset ${asset.path} at ${s3url}`);
106455
+ assetManifest.addFileAsset(asset.sourceHash, {
106456
+ path: asset.path,
106457
+ packaging
106458
+ }, {
106459
+ bucketName: toolkitInfo.bucketName,
106460
+ objectKey: key
106461
+ });
106462
+ return {
106463
+ [asset.s3BucketParameter]: toolkitInfo.bucketName,
106464
+ [asset.s3KeyParameter]: `${s3Prefix}${cxapi3.ASSET_PREFIX_SEPARATOR}${baseName}`,
106465
+ [asset.artifactHashParameter]: asset.sourceHash
106466
+ };
106467
+ }
106468
+ async function prepareDockerImageAsset(asset, assetManifest, envResources) {
106469
+ if (!asset.imageNameParameter && (!asset.repositoryName || !asset.imageTag)) {
106470
+ throw new ToolkitError("InvalidDockerAssetConfig", 'Invalid Docker image asset configuration: "repositoryName" and "imageTag" are required when "imageNameParameter" is left out');
106471
+ }
106472
+ const repositoryName = asset.repositoryName ?? "cdk/" + asset.id.replace(/[:/]/g, "-").toLowerCase();
106473
+ const { repositoryUri: repositoryUri2 } = await envResources.prepareEcrRepository(repositoryName);
106474
+ const imageTag = asset.imageTag ?? asset.sourceHash;
106475
+ assetManifest.addDockerImageAsset(asset.sourceHash, {
106476
+ directory: asset.path,
106477
+ dockerBuildArgs: asset.buildArgs,
106478
+ dockerBuildSecrets: asset.buildSecrets,
106479
+ dockerBuildSsh: asset.buildSsh,
106480
+ dockerBuildTarget: asset.target,
106481
+ dockerFile: asset.file,
106482
+ networkMode: asset.networkMode,
106483
+ platform: asset.platform,
106484
+ dockerOutputs: asset.outputs
106485
+ }, {
106486
+ repositoryName,
106487
+ imageTag
106488
+ });
106489
+ if (!asset.imageNameParameter) {
106490
+ return {};
106491
+ }
106492
+ return { [asset.imageNameParameter]: `${repositoryUri2}:${imageTag}` };
106493
+ }
106494
+ var path18, cxapi3, cxschema8, import_chalk9;
106495
+ var init_assets3 = __esm({
106496
+ "../@aws-cdk/toolkit-lib/lib/api/deployments/assets.ts"() {
106497
+ "use strict";
106498
+ path18 = __toESM(require("path"));
106499
+ cxapi3 = __toESM(require_lib3());
106500
+ cxschema8 = __toESM(require_lib2());
106501
+ import_chalk9 = __toESM(require_source());
106502
+ init_toolkit_error();
106503
+ __name(addMetadataAssetsToManifest, "addMetadataAssetsToManifest");
106504
+ __name(prepareAsset, "prepareAsset");
106505
+ __name(prepareFileAsset, "prepareFileAsset");
106506
+ __name(prepareDockerImageAsset, "prepareDockerImageAsset");
106507
+ }
106508
+ });
106509
+
106510
+ // ../@aws-cdk/toolkit-lib/lib/actions/deploy/private/deployment-method.ts
106511
+ function isChangeSetDeployment(method) {
106512
+ return method?.method === "change-set";
106513
+ }
106514
+ function isExecutingChangeSetDeployment(method) {
106515
+ return isChangeSetDeployment(method) && (method.execute ?? true);
106516
+ }
106517
+ function isNonExecutingChangeSetDeployment(method) {
106518
+ return isChangeSetDeployment(method) && method.execute === false;
106519
+ }
106520
+ function isExecuteChangeSetDeployment(method) {
106521
+ return method?.method === "execute-change-set";
106522
+ }
106523
+ function toExecuteChangeSetDeployment(method) {
106524
+ return {
106525
+ method: "execute-change-set",
106526
+ changeSetName: method.changeSetName ?? DEFAULT_DEPLOY_CHANGE_SET_NAME
106527
+ };
106528
+ }
106529
+ var DEFAULT_DEPLOY_CHANGE_SET_NAME;
106530
+ var init_deployment_method = __esm({
106531
+ "../@aws-cdk/toolkit-lib/lib/actions/deploy/private/deployment-method.ts"() {
106532
+ "use strict";
106533
+ DEFAULT_DEPLOY_CHANGE_SET_NAME = "cdk-deploy-change-set";
106534
+ __name(isChangeSetDeployment, "isChangeSetDeployment");
106535
+ __name(isExecutingChangeSetDeployment, "isExecutingChangeSetDeployment");
106536
+ __name(isNonExecutingChangeSetDeployment, "isNonExecutingChangeSetDeployment");
106537
+ __name(isExecuteChangeSetDeployment, "isExecuteChangeSetDeployment");
106538
+ __name(toExecuteChangeSetDeployment, "toExecuteChangeSetDeployment");
106539
+ }
106540
+ });
106541
+
106542
+ // ../@aws-cdk/toolkit-lib/lib/payloads/hotswap.ts
106543
+ var NonHotswappableReason;
106544
+ var init_hotswap = __esm({
106545
+ "../@aws-cdk/toolkit-lib/lib/payloads/hotswap.ts"() {
106546
+ "use strict";
106547
+ NonHotswappableReason = /* @__PURE__ */ ((NonHotswappableReason2) => {
106548
+ NonHotswappableReason2["TAGS"] = "tags";
106549
+ NonHotswappableReason2["PROPERTIES"] = "properties";
106550
+ NonHotswappableReason2["OUTPUT"] = "output";
106551
+ NonHotswappableReason2["DEPENDENCY_UNSUPPORTED"] = "dependency-unsupported";
106552
+ NonHotswappableReason2["RESOURCE_UNSUPPORTED"] = "resource-unsupported";
106553
+ NonHotswappableReason2["RESOURCE_CREATION"] = "resource-creation";
106554
+ NonHotswappableReason2["RESOURCE_DELETION"] = "resource-deletion";
106555
+ NonHotswappableReason2["RESOURCE_TYPE_CHANGED"] = "resource-type-changed";
106556
+ NonHotswappableReason2["NESTED_STACK_CREATION"] = "nested-stack-creation";
106557
+ return NonHotswappableReason2;
106558
+ })(NonHotswappableReason || {});
106559
+ }
106560
+ });
106561
+
106562
+ // ../@aws-cdk/toolkit-lib/lib/api/hotswap/common.ts
106563
+ function createHotswapPropertyOverrides(props) {
106564
+ return new HotswapPropertyOverrides(new EcsHotswapProperties(
106565
+ props.ecs?.minimumHealthyPercent,
106566
+ props.ecs?.maximumHealthyPercent,
106567
+ props.ecs?.stabilizationTimeoutSeconds
106568
+ ));
106569
+ }
106570
+ function classifyChanges(xs, hotswappablePropNames) {
106571
+ const hotswappableProps = {};
106572
+ const nonHotswappableProps = {};
106573
+ for (const [name, propDiff] of Object.entries(xs.propertyUpdates)) {
106574
+ if (hotswappablePropNames.includes(name)) {
106575
+ hotswappableProps[name] = propDiff;
106576
+ } else {
106577
+ nonHotswappableProps[name] = propDiff;
106578
+ }
106579
+ }
106580
+ return new ClassifiedChanges(xs, hotswappableProps, nonHotswappableProps);
106581
+ }
106582
+ function nonHotswappableChange(change, reason, description, nonHotswappableProps, hotswapOnlyVisible = true) {
106583
+ return {
106584
+ hotswappable: false,
106585
+ hotswapOnlyVisible,
106586
+ change: {
106587
+ reason,
106588
+ description,
106589
+ subject: {
106590
+ type: "Resource",
106591
+ logicalId: change.logicalId,
106592
+ resourceType: change.newValue.Type,
106593
+ rejectedProperties: Object.keys(nonHotswappableProps ?? change.propertyUpdates),
106594
+ metadata: change.metadata
106595
+ }
106596
+ }
106597
+ };
106598
+ }
106599
+ function nonHotswappableResource(change) {
106600
+ return {
106601
+ hotswappable: false,
106602
+ change: {
106603
+ reason: "resource-unsupported" /* RESOURCE_UNSUPPORTED */,
106604
+ description: "This resource type is not supported for hotswap deployments",
106605
+ subject: {
106606
+ type: "Resource",
106607
+ logicalId: change.logicalId,
106608
+ resourceType: change.newValue.Type,
106609
+ rejectedProperties: Object.keys(change.propertyUpdates),
106610
+ metadata: change.metadata
106611
+ }
106612
+ }
106613
+ };
106614
+ }
106615
+ var ICON, HotswapPropertyOverrides, EcsHotswapProperties, ClassifiedChanges;
106616
+ var init_common3 = __esm({
106617
+ "../@aws-cdk/toolkit-lib/lib/api/hotswap/common.ts"() {
106618
+ "use strict";
106619
+ init_hotswap();
106620
+ init_toolkit_error();
106621
+ ICON = "\u2728";
106622
+ HotswapPropertyOverrides = class {
106623
+ static {
106624
+ __name(this, "HotswapPropertyOverrides");
106625
+ }
106626
+ // Each supported resource type will have its own properties. Currently this is ECS
106627
+ ecs;
106628
+ constructor(ecs) {
106629
+ this.ecs = ecs;
106630
+ }
106631
+ };
106632
+ EcsHotswapProperties = class {
106633
+ static {
106634
+ __name(this, "EcsHotswapProperties");
106635
+ }
106636
+ // The lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount
106637
+ minimumHealthyPercent;
106638
+ // The upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount
106639
+ maximumHealthyPercent;
106640
+ // The number of seconds to wait for a single service to reach stable state.
106641
+ stabilizationTimeoutSeconds;
106642
+ constructor(minimumHealthyPercent, maximumHealthyPercent, stabilizationTimeoutSeconds) {
106643
+ if (minimumHealthyPercent !== void 0 && minimumHealthyPercent < 0) {
106644
+ throw new ToolkitError("InvalidEcsMinHealthyPercent", "hotswap-ecs-minimum-healthy-percent can't be a negative number");
106645
+ }
106646
+ if (maximumHealthyPercent !== void 0 && maximumHealthyPercent < 0) {
106647
+ throw new ToolkitError("InvalidEcsMaxHealthyPercent", "hotswap-ecs-maximum-healthy-percent can't be a negative number");
106648
+ }
106649
+ if (stabilizationTimeoutSeconds !== void 0 && stabilizationTimeoutSeconds < 0) {
106650
+ throw new ToolkitError("InvalidEcsStabilizationTimeout", "hotswap-ecs-stabilization-timeout-seconds can't be a negative number");
106651
+ }
106652
+ if (minimumHealthyPercent == void 0) {
106653
+ this.minimumHealthyPercent = 0;
106654
+ } else {
106655
+ this.minimumHealthyPercent = minimumHealthyPercent;
106656
+ }
106657
+ this.maximumHealthyPercent = maximumHealthyPercent;
106658
+ this.stabilizationTimeoutSeconds = stabilizationTimeoutSeconds;
106659
+ }
106660
+ /**
106661
+ * Check if any hotswap properties are defined
106662
+ * @returns true if all properties are undefined, false otherwise
106663
+ */
106664
+ isEmpty() {
106665
+ return this.minimumHealthyPercent === 0 && this.maximumHealthyPercent === void 0;
106666
+ }
106667
+ };
106668
+ __name(createHotswapPropertyOverrides, "createHotswapPropertyOverrides");
106669
+ ClassifiedChanges = class {
106670
+ constructor(change, hotswappableProps, nonHotswappableProps) {
106671
+ this.change = change;
106672
+ this.hotswappableProps = hotswappableProps;
106673
+ this.nonHotswappableProps = nonHotswappableProps;
106674
+ }
106675
+ change;
106676
+ hotswappableProps;
106677
+ nonHotswappableProps;
106678
+ static {
106679
+ __name(this, "ClassifiedChanges");
106680
+ }
106681
+ reportNonHotswappablePropertyChanges(ret) {
106682
+ const nonHotswappablePropNames = Object.keys(this.nonHotswappableProps);
106683
+ if (nonHotswappablePropNames.length > 0) {
106684
+ const tagOnlyChange = nonHotswappablePropNames.length === 1 && nonHotswappablePropNames[0] === "Tags";
106685
+ const reason = tagOnlyChange ? "tags" /* TAGS */ : "properties" /* PROPERTIES */;
106686
+ const description = tagOnlyChange ? "Tags are not hotswappable" : `resource properties '${nonHotswappablePropNames}' are not hotswappable on this resource type`;
106687
+ ret.push(nonHotswappableChange(
106688
+ this.change,
106689
+ reason,
106690
+ description,
106691
+ this.nonHotswappableProps
106692
+ ));
106693
+ }
106694
+ }
106695
+ get namesOfHotswappableProps() {
106696
+ return Object.keys(this.hotswappableProps);
106697
+ }
106698
+ };
106699
+ __name(classifyChanges, "classifyChanges");
106700
+ __name(nonHotswappableChange, "nonHotswappableChange");
106701
+ __name(nonHotswappableResource, "nonHotswappableResource");
106702
+ }
106703
+ });
106704
+
106456
106705
  // ../@aws-cdk/toolkit-lib/lib/payloads/bootstrap-environment-progress.ts
106457
106706
  var init_bootstrap_environment_progress = __esm({
106458
106707
  "../@aws-cdk/toolkit-lib/lib/payloads/bootstrap-environment-progress.ts"() {
@@ -108392,6 +108641,15 @@ async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterC
108392
108641
  await ioHelper.defaults.debug(`${deployName}: stack is in a failure state`);
108393
108642
  return false;
108394
108643
  }
108644
+ const hotswapCache = await readHotswapTemplateCache(
108645
+ deployStackOptions.stack.assembly.directory,
108646
+ deployStackOptions.stack.stackName,
108647
+ deployStackOptions.stack.template
108648
+ );
108649
+ if (hotswapCache && (0, import_cloudformation_diff.diffTemplate)(hotswapCache.deployedRootTemplate, deployStackOptions.stack.template).differenceCount > 0) {
108650
+ await ioHelper.defaults.debug(`${deployName}: template has changed in relation to last successful hotswap deployment`);
108651
+ return false;
108652
+ }
108395
108653
  return true;
108396
108654
  }
108397
108655
  function compareTags(a6, b6) {
@@ -108418,12 +108676,13 @@ function hasReplacement(report) {
108418
108676
  return a6 === "ReplaceAndDelete" || a6 === "ReplaceAndRetain" || a6 === "ReplaceAndSnapshot";
108419
108677
  });
108420
108678
  }
108421
- var import_node_crypto10, import_node_util3, import_chalk11, FullCloudFormationDeployment;
108679
+ var import_node_crypto10, import_node_util3, import_cloudformation_diff, import_chalk11, FullCloudFormationDeployment;
108422
108680
  var init_deploy_stack = __esm({
108423
108681
  "../@aws-cdk/toolkit-lib/lib/api/deployments/deploy-stack.ts"() {
108424
108682
  "use strict";
108425
108683
  import_node_crypto10 = require("node:crypto");
108426
108684
  import_node_util3 = require("node:util");
108685
+ import_cloudformation_diff = __toESM(require_lib9());
108427
108686
  import_chalk11 = __toESM(require_source());
108428
108687
  init_asset_manifest_builder();
108429
108688
  init_asset_publishing();
@@ -108528,10 +108787,12 @@ var init_deploy_stack = __esm({
108528
108787
  };
108529
108788
  }
108530
108789
  if (!execute2) {
108531
- await this.ioHelper.defaults.info((0, import_node_util3.format)(
108532
- "Changeset %s created and waiting in review for manual execution (--no-execute)",
108533
- changeSetDescription.ChangeSetId
108534
- ));
108790
+ if (!this.options.willExecuteChangeSet) {
108791
+ await this.ioHelper.defaults.info((0, import_node_util3.format)(
108792
+ "Changeset %s created and waiting in review for manual execution (--no-execute)",
108793
+ changeSetDescription.ChangeSetId
108794
+ ));
108795
+ }
108535
108796
  return {
108536
108797
  type: "did-deploy-stack",
108537
108798
  noOp: false,
@@ -110141,6 +110402,7 @@ var init_deployments = __esm({
110141
110402
  envResources: env3.resources,
110142
110403
  tags: options.tags,
110143
110404
  deploymentMethod: options.deploymentMethod,
110405
+ willExecuteChangeSet: options.willExecuteChangeSet,
110144
110406
  forceDeployment: options.forceDeployment,
110145
110407
  parameters: options.parameters,
110146
110408
  usePreviousParameters: options.usePreviousParameters,
@@ -110175,7 +110437,7 @@ var init_deployments = __esm({
110175
110437
  if (result2.type !== "did-deploy-stack") {
110176
110438
  return void 0;
110177
110439
  }
110178
- if (result2.noOp && options.cleanupOnNoOp) {
110440
+ if (result2.noOp && options.willExecuteChangeSet) {
110179
110441
  const changeSetName = options.deploymentMethod.changeSetName ?? DEFAULT_DEPLOY_CHANGE_SET_NAME;
110180
110442
  await this.cleanupChangeSet(options.stack, changeSetName, options.stackEventPollingInterval);
110181
110443
  }
@@ -290764,12 +291026,12 @@ function obscureDiff(diff) {
290764
291026
  });
290765
291027
  }
290766
291028
  }
290767
- var import_node_util6, import_cloudformation_diff, import_chalk15, DiffFormatter;
291029
+ var import_node_util6, import_cloudformation_diff2, import_chalk15, DiffFormatter;
290768
291030
  var init_diff_formatter = __esm({
290769
291031
  "../@aws-cdk/toolkit-lib/lib/api/diff/diff-formatter.ts"() {
290770
291032
  "use strict";
290771
291033
  import_node_util6 = require("node:util");
290772
- import_cloudformation_diff = __toESM(require_lib9());
291034
+ import_cloudformation_diff2 = __toESM(require_lib9());
290773
291035
  import_chalk15 = __toESM(require_source());
290774
291036
  init_payloads();
290775
291037
  init_logical_id_map();
@@ -290806,7 +291068,7 @@ var init_diff_formatter = __esm({
290806
291068
  */
290807
291069
  computeDiff(stackName, oldTemplate, newTemplate, changeSet, mappings) {
290808
291070
  if (!this.cache.has(stackName)) {
290809
- const templateDiff = (0, import_cloudformation_diff.fullDiff)(oldTemplate, newTemplate, changeSet, this.isImport);
291071
+ const templateDiff = (0, import_cloudformation_diff2.fullDiff)(oldTemplate, newTemplate, changeSet, this.isImport);
290810
291072
  const setMove = /* @__PURE__ */ __name((change, direction, location) => {
290811
291073
  if (location != null) {
290812
291074
  const [sourceStackName, sourceLogicalId] = location.split(".");
@@ -290860,8 +291122,8 @@ var init_diff_formatter = __esm({
290860
291122
  }
290861
291123
  let activeDiff = diff;
290862
291124
  if (diff.differenceCount && !options.strict) {
290863
- const mangledNewTemplate = JSON.parse((0, import_cloudformation_diff.mangleLikeCloudFormation)(JSON.stringify(newTemplate)));
290864
- const mangledDiff = (0, import_cloudformation_diff.fullDiff)(oldTemplate, mangledNewTemplate, changeSet);
291125
+ const mangledNewTemplate = JSON.parse((0, import_cloudformation_diff2.mangleLikeCloudFormation)(JSON.stringify(newTemplate)));
291126
+ const mangledDiff = (0, import_cloudformation_diff2.fullDiff)(oldTemplate, mangledNewTemplate, changeSet);
290865
291127
  filteredChangesCount = Math.max(0, diff.differenceCount - mangledDiff.differenceCount);
290866
291128
  if (filteredChangesCount > 0) {
290867
291129
  activeDiff = mangledDiff;
@@ -290874,7 +291136,7 @@ var init_diff_formatter = __esm({
290874
291136
  const metadataWasFiltered = diffWasNonEmpty && activeDiff.isEmpty;
290875
291137
  if (!activeDiff.isEmpty) {
290876
291138
  numStacksWithChanges++;
290877
- (0, import_cloudformation_diff.formatDifferences)(stream, activeDiff, {
291139
+ (0, import_cloudformation_diff2.formatDifferences)(stream, activeDiff, {
290878
291140
  ...logicalIdMapFromTemplate(oldTemplate),
290879
291141
  ...logicalIdMapFromTemplate(newTemplate),
290880
291142
  ...logicalIdMap
@@ -290931,7 +291193,7 @@ var init_diff_formatter = __esm({
290931
291193
  `));
290932
291194
  }
290933
291195
  try {
290934
- (0, import_cloudformation_diff.formatSecurityChanges)(stream, diff, {
291196
+ (0, import_cloudformation_diff2.formatSecurityChanges)(stream, diff, {
290935
291197
  ...logicalIdMapFromTemplate(newTemplate),
290936
291198
  ...logicalIdMap
290937
291199
  });
@@ -296825,9 +297087,6 @@ function stripReferences(value2, exports2) {
296825
297087
  if ("Fn::GetAtt" in value2) {
296826
297088
  return { __cloud_ref__: "Fn::GetAtt" };
296827
297089
  }
296828
- if ("DependsOn" in value2) {
296829
- return { __cloud_ref__: "DependsOn" };
296830
- }
296831
297090
  if ("Fn::ImportValue" in value2) {
296832
297091
  const exp = exports2[value2["Fn::ImportValue"]];
296833
297092
  if (exp != null) {
@@ -296845,6 +297104,9 @@ function stripReferences(value2, exports2) {
296845
297104
  }
296846
297105
  const result2 = {};
296847
297106
  for (const [k6, v] of Object.entries(value2)) {
297107
+ if (k6 === "DependsOn") {
297108
+ continue;
297109
+ }
296848
297110
  result2[k6] = stripReferences(v, exports2);
296849
297111
  }
296850
297112
  return result2;
@@ -297205,13 +297467,13 @@ async function listStacks(sdkProvider, environment) {
297205
297467
  }
297206
297468
  function formatEnvironmentSectionHeader2(environment) {
297207
297469
  const env3 = `aws://${environment.account}/${environment.region}`;
297208
- return formatToStream((stream) => (0, import_cloudformation_diff2.formatEnvironmentSectionHeader)(stream, env3));
297470
+ return formatToStream((stream) => (0, import_cloudformation_diff3.formatEnvironmentSectionHeader)(stream, env3));
297209
297471
  }
297210
297472
  function formatTypedMappings2(mappings) {
297211
- return formatToStream((stream) => (0, import_cloudformation_diff2.formatTypedMappings)(stream, mappings));
297473
+ return formatToStream((stream) => (0, import_cloudformation_diff3.formatTypedMappings)(stream, mappings));
297212
297474
  }
297213
297475
  function formatAmbiguousMappings2(paths) {
297214
- return formatToStream((stream) => (0, import_cloudformation_diff2.formatAmbiguousMappings)(stream, paths));
297476
+ return formatToStream((stream) => (0, import_cloudformation_diff3.formatAmbiguousMappings)(stream, paths));
297215
297477
  }
297216
297478
  function formatToStream(cb) {
297217
297479
  const stream = new StringWriteStream();
@@ -297246,11 +297508,11 @@ async function groupStacks(sdkProvider, localStacks, additionalStackNames) {
297246
297508
  }
297247
297509
  return groups;
297248
297510
  }
297249
- var import_cloudformation_diff2;
297511
+ var import_cloudformation_diff3;
297250
297512
  var init_refactoring = __esm({
297251
297513
  "../@aws-cdk/toolkit-lib/lib/api/refactoring/index.ts"() {
297252
297514
  "use strict";
297253
- import_cloudformation_diff2 = __toESM(require_lib9());
297515
+ import_cloudformation_diff3 = __toESM(require_lib9());
297254
297516
  init_util4();
297255
297517
  init_plugin2();
297256
297518
  init_streams();
@@ -297566,12 +297828,12 @@ var init_tags2 = __esm({
297566
297828
  });
297567
297829
 
297568
297830
  // ../@aws-cdk/toolkit-lib/lib/api/drift/drift-formatter.ts
297569
- var import_node_util7, import_cloudformation_diff3, import_client_cloudformation7, import_chalk24, DriftFormatter, ADDITION3, CONTEXT2, UPDATE3, REMOVAL3;
297831
+ var import_node_util7, import_cloudformation_diff4, import_client_cloudformation7, import_chalk24, DriftFormatter, ADDITION3, CONTEXT2, UPDATE3, REMOVAL3;
297570
297832
  var init_drift_formatter = __esm({
297571
297833
  "../@aws-cdk/toolkit-lib/lib/api/drift/drift-formatter.ts"() {
297572
297834
  "use strict";
297573
297835
  import_node_util7 = require("node:util");
297574
- import_cloudformation_diff3 = __toESM(require_lib9());
297836
+ import_cloudformation_diff4 = __toESM(require_lib9());
297575
297837
  import_client_cloudformation7 = __toESM(require_dist_cjs25());
297576
297838
  import_chalk24 = __toESM(require_source());
297577
297839
  init_logical_id_map();
@@ -297677,7 +297939,7 @@ ${actualDrifts.length} resource${actualDrifts.length === 1 ? "" : "s"} ${actualD
297677
297939
  for (let i6 = 0; i6 < propDiffs.length; i6++) {
297678
297940
  const diff = propDiffs[i6];
297679
297941
  if (!diff.PropertyPath) continue;
297680
- const difference2 = new import_cloudformation_diff3.Difference(diff.ExpectedValue, diff.ActualValue);
297942
+ const difference2 = new import_cloudformation_diff4.Difference(diff.ExpectedValue, diff.ActualValue);
297681
297943
  modified += this.formatTreeDiff(diff.PropertyPath, difference2, i6 === propDiffs.length - 1);
297682
297944
  }
297683
297945
  }
@@ -299082,7 +299344,7 @@ var init_toolkit = __esm({
299082
299344
  const prepareResult = isChangeSetDeployment(options.deploymentMethod) ? await deployments.prepareStack({
299083
299345
  ...sharedDeployOptions,
299084
299346
  deploymentMethod: options.deploymentMethod,
299085
- cleanupOnNoOp: isExecutingChangeSetDeployment(options.deploymentMethod)
299347
+ willExecuteChangeSet: isExecutingChangeSetDeployment(options.deploymentMethod)
299086
299348
  }) : void 0;
299087
299349
  if (!prepareResult?.noOp) {
299088
299350
  const diffChangeSet = isExecuteChangeSetDeployment(options.deploymentMethod) ? (await deployments.describeChangeSet(stack, options.deploymentMethod.changeSetName, prepareResult?.stackArn)).changeSet : prepareResult?.changeSet;
@@ -308738,13 +309000,13 @@ function effectiveValue(flag) {
308738
309000
  function defaultValue(flag) {
308739
309001
  return flag.unconfiguredBehavesLike?.v2 ?? false;
308740
309002
  }
308741
- var os13, path45, import_cloudformation_diff4, import_toolkit_lib17, import_chalk32, fs48, import_p_queue, FlagOperations;
309003
+ var os13, path45, import_cloudformation_diff5, import_toolkit_lib17, import_chalk32, fs48, import_p_queue, FlagOperations;
308742
309004
  var init_operations = __esm({
308743
309005
  "lib/commands/flags/operations.ts"() {
308744
309006
  "use strict";
308745
309007
  os13 = __toESM(require("os"));
308746
309008
  path45 = __toESM(require("path"));
308747
- import_cloudformation_diff4 = __toESM(require_lib9());
309009
+ import_cloudformation_diff5 = __toESM(require_lib9());
308748
309010
  import_toolkit_lib17 = __toESM(require_lib12());
308749
309011
  import_chalk32 = __toESM(require_source());
308750
309012
  fs48 = __toESM(require_lib4());
@@ -309144,7 +309406,7 @@ var init_operations = __esm({
309144
309406
  String(effectiveValue(flag))
309145
309407
  ]);
309146
309408
  });
309147
- const formattedTable = (0, import_cloudformation_diff4.formatTable)(rows, void 0, true);
309409
+ const formattedTable = (0, import_cloudformation_diff5.formatTable)(rows, void 0, true);
309148
309410
  await this.ioHelper.defaults.info(formattedTable);
309149
309411
  }
309150
309412
  /** Checks if a flag has a boolean recommended value */
@@ -310403,7 +310665,7 @@ Do you wish to deploy these changes?`;
310403
310665
  const prepareResult = isChangeSetDeployment(this.options.deploymentMethod) ? await this.deployments.prepareStack({
310404
310666
  ...sharedDeployOptions,
310405
310667
  deploymentMethod: this.options.deploymentMethod,
310406
- cleanupOnNoOp: isExecutingChangeSetDeployment(this.options.deploymentMethod)
310668
+ willExecuteChangeSet: isExecutingChangeSetDeployment(this.options.deploymentMethod)
310407
310669
  }) : void 0;
310408
310670
  if (this.options.requireApproval !== import_cloud_assembly_schema9.RequireApproval.NEVER && !prepareResult?.noOp) {
310409
310671
  const currentTemplate = await this.deployments.readCurrentTemplate(stack);
@@ -316740,7 +317002,7 @@ var require_lru_cache = __commonJS({
316740
317002
  }
316741
317003
  }
316742
317004
  };
316743
- var warned = /* @__PURE__ */ new Set();
317005
+ var warned2 = /* @__PURE__ */ new Set();
316744
317006
  var deprecatedOption = /* @__PURE__ */ __name((opt, instead) => {
316745
317007
  const code = `LRU_CACHE_OPTION_${opt}`;
316746
317008
  if (shouldWarn(code)) {
@@ -316766,9 +317028,9 @@ var require_lru_cache = __commonJS({
316766
317028
  var emitWarning = /* @__PURE__ */ __name((...a6) => {
316767
317029
  typeof process === "object" && process && typeof process.emitWarning === "function" ? process.emitWarning(...a6) : console.error(...a6);
316768
317030
  }, "emitWarning");
316769
- var shouldWarn = /* @__PURE__ */ __name((code) => !warned.has(code), "shouldWarn");
317031
+ var shouldWarn = /* @__PURE__ */ __name((code) => !warned2.has(code), "shouldWarn");
316770
317032
  var warn2 = /* @__PURE__ */ __name((code, what, instead, fn) => {
316771
- warned.add(code);
317033
+ warned2.add(code);
316772
317034
  const msg = `The ${what} is deprecated. Please use ${instead} instead.`;
316773
317035
  emitWarning(msg, "DeprecationWarning", code, fn);
316774
317036
  }, "warn");
@@ -316928,7 +317190,7 @@ var require_lru_cache = __commonJS({
316928
317190
  if (!this.ttlAutopurge && !this.max && !this.maxSize) {
316929
317191
  const code = "LRU_CACHE_UNBOUNDED";
316930
317192
  if (shouldWarn(code)) {
316931
- warned.add(code);
317193
+ warned2.add(code);
316932
317194
  const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
316933
317195
  emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache);
316934
317196
  }
@@ -318252,10 +318514,10 @@ var require_browser = __commonJS({
318252
318514
  exports2.useColors = useColors;
318253
318515
  exports2.storage = localstorage();
318254
318516
  exports2.destroy = /* @__PURE__ */ (() => {
318255
- let warned = false;
318517
+ let warned2 = false;
318256
318518
  return () => {
318257
- if (!warned) {
318258
- warned = true;
318519
+ if (!warned2) {
318520
+ warned2 = true;
318259
318521
  console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
318260
318522
  }
318261
318523
  };