@cdk8s/awscdk-resolver 0.0.709 → 0.0.711

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.
Files changed (85) hide show
  1. package/.jsii +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js +1 -1
  4. package/node_modules/@aws-sdk/client-cloudformation/package.json +3 -3
  5. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +12 -3
  6. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +12 -3
  7. package/node_modules/@aws-sdk/core/package.json +1 -1
  8. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  9. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  10. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  11. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  12. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  13. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  14. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  15. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  16. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  17. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  18. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  19. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  20. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  21. package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
  22. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  23. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +1695 -3
  24. package/node_modules/@smithy/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js +6 -0
  25. package/node_modules/@smithy/core/dist-es/submodules/protocols/UnionSerde.js +26 -0
  26. package/node_modules/@smithy/core/dist-es/submodules/protocols/common.js +3 -0
  27. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +8 -0
  28. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/JsonSettings.js +1 -0
  29. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +102 -0
  30. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +20 -0
  31. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +1 -0
  32. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +167 -0
  33. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +200 -0
  34. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +103 -0
  35. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +20 -0
  36. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +211 -0
  37. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +529 -0
  38. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/detectBufferParsing.js +18 -0
  39. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/jsonReplacer.js +46 -0
  40. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/jsonReviver.js +121 -0
  41. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/needsReviver.js +41 -0
  42. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/parseJsonBody.js +104 -0
  43. package/node_modules/@smithy/core/dist-es/submodules/protocols/writeKey.js +3 -0
  44. package/node_modules/@smithy/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  45. package/node_modules/@smithy/core/dist-types/submodules/protocols/UnionSerde.d.ts +24 -0
  46. package/node_modules/@smithy/core/dist-types/submodules/protocols/common.d.ts +2 -0
  47. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +9 -0
  48. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +13 -0
  49. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  50. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -0
  51. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +7 -0
  52. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +14 -0
  53. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +29 -0
  54. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  55. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -0
  56. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +30 -0
  57. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +60 -0
  58. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +1 -0
  59. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +21 -0
  60. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +15 -0
  61. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/needsReviver.d.ts +11 -0
  62. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +38 -0
  63. package/node_modules/@smithy/core/dist-types/submodules/protocols/writeKey.d.ts +4 -0
  64. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  65. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -0
  66. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -0
  67. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +9 -0
  68. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +13 -0
  69. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  70. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -0
  71. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +7 -0
  72. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +14 -0
  73. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +29 -0
  74. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  75. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -0
  76. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +30 -0
  77. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +60 -0
  78. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -0
  79. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -0
  80. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -0
  81. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -0
  82. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +38 -0
  83. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -0
  84. package/node_modules/@smithy/core/package.json +2 -1
  85. package/package.json +5 -5
@@ -0,0 +1,211 @@
1
+ import { determineTimestampFormat } from "../../serde/determineTimestampFormat";
2
+ import { NormalizedSchema } from "@smithy/core/schema";
3
+ import { fromBase64, LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTimeWithOffset, parseRfc7231DateTime, } from "@smithy/core/serde";
4
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
5
+ import { UnionSerde } from "../../UnionSerde";
6
+ import { detectBufferParsing } from "../detectBufferParsing";
7
+ import { jsonReviver } from "../jsonReviver";
8
+ import { needsReviver } from "../needsReviver";
9
+ import { parseJsonBody } from "../parseJsonBody";
10
+ import { writeKey } from "../../writeKey";
11
+ import { hasOwn } from "@smithy/core/transport";
12
+ export class JsonShapeDeserializer2 extends SerdeContextConfig {
13
+ settings;
14
+ constructor(settings) {
15
+ super();
16
+ this.settings = settings;
17
+ }
18
+ async read(schema, data) {
19
+ const reviver = needsReviver(schema) ? jsonReviver : undefined;
20
+ let parsed;
21
+ if (typeof data === "string") {
22
+ if (data.length === 0) {
23
+ return {};
24
+ }
25
+ parsed = JSON.parse(data, reviver);
26
+ }
27
+ else if (data instanceof Uint8Array && detectBufferParsing()) {
28
+ if (data.byteLength === 0) {
29
+ return {};
30
+ }
31
+ const buf = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
32
+ parsed = JSON.parse(buf, reviver);
33
+ }
34
+ else {
35
+ parsed = await parseJsonBody(data, this.serdeContext, schema);
36
+ }
37
+ return this._read(schema, parsed);
38
+ }
39
+ readObject(schema, data) {
40
+ return this._read(schema, data);
41
+ }
42
+ _read(schema, value) {
43
+ const isObject = value !== null && typeof value === "object";
44
+ const ns = NormalizedSchema.of(schema);
45
+ if (isObject) {
46
+ if (ns.isStructSchema()) {
47
+ return this._readStruct(ns, value);
48
+ }
49
+ if (Array.isArray(value) && ns.isListSchema()) {
50
+ const listMember = ns.getValueSchema();
51
+ if (this.needsTransform(listMember)) {
52
+ for (let i = 0; i < value.length; ++i) {
53
+ value[i] = this._read(listMember, value[i]);
54
+ }
55
+ }
56
+ return value;
57
+ }
58
+ if (ns.isMapSchema()) {
59
+ const mapMember = ns.getValueSchema();
60
+ const map = value;
61
+ if (this.needsTransform(mapMember)) {
62
+ for (const k in map) {
63
+ if (!hasOwn(map, k))
64
+ continue;
65
+ if (k === "__proto__") {
66
+ writeKey(map);
67
+ }
68
+ map[k] = this._read(mapMember, map[k]);
69
+ }
70
+ }
71
+ return map;
72
+ }
73
+ }
74
+ if (ns.isBlobSchema() && typeof value === "string") {
75
+ return fromBase64(value);
76
+ }
77
+ const mediaType = ns.getMergedTraits().mediaType;
78
+ if (ns.isStringSchema() && typeof value === "string" && mediaType) {
79
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
80
+ if (isJson) {
81
+ return LazyJsonString.from(value);
82
+ }
83
+ return value;
84
+ }
85
+ if (ns.isTimestampSchema() && value != null) {
86
+ const format = determineTimestampFormat(ns, this.settings);
87
+ switch (format) {
88
+ case 5:
89
+ return parseRfc3339DateTimeWithOffset(value);
90
+ case 6:
91
+ return parseRfc7231DateTime(value);
92
+ case 7:
93
+ return parseEpochTimestamp(value);
94
+ default:
95
+ console.warn("Missing timestamp format, parsing value with Date constructor:", value);
96
+ return new Date(value);
97
+ }
98
+ }
99
+ if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
100
+ return BigInt(value);
101
+ }
102
+ if (ns.isBigDecimalSchema() && value != undefined) {
103
+ if (value instanceof NumericValue) {
104
+ return value;
105
+ }
106
+ const untyped = value;
107
+ if (untyped.type === "bigDecimal" && "string" in untyped) {
108
+ return new NumericValue(untyped.string, untyped.type);
109
+ }
110
+ return new NumericValue(String(value), "bigDecimal");
111
+ }
112
+ if (ns.isNumericSchema() && typeof value === "string") {
113
+ switch (value) {
114
+ case "Infinity":
115
+ return Infinity;
116
+ case "-Infinity":
117
+ return -Infinity;
118
+ case "NaN":
119
+ return NaN;
120
+ }
121
+ return value;
122
+ }
123
+ if (ns.isDocumentSchema()) {
124
+ if (isObject) {
125
+ if (Array.isArray(value)) {
126
+ for (let i = 0; i < value.length; ++i) {
127
+ const v = value[i];
128
+ if (!(v instanceof NumericValue)) {
129
+ value[i] = this._read(ns, v);
130
+ }
131
+ }
132
+ }
133
+ else {
134
+ const doc = value;
135
+ for (const k in doc) {
136
+ if (!hasOwn(doc, k))
137
+ continue;
138
+ if (k === "__proto__") {
139
+ writeKey(doc);
140
+ }
141
+ const v = doc[k];
142
+ if (!(v instanceof NumericValue)) {
143
+ doc[k] = this._read(ns, v);
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ return value;
150
+ }
151
+ _readStruct(ns, record) {
152
+ const union = ns.isUnionSchema();
153
+ const out = {};
154
+ let nameMap;
155
+ const hasType = typeof record.__type === "string";
156
+ const { jsonName } = this.settings;
157
+ if (jsonName && hasType) {
158
+ nameMap = {};
159
+ }
160
+ let unionSerde;
161
+ if (union) {
162
+ unionSerde = new UnionSerde(record, out);
163
+ }
164
+ for (const [memberName, memberSchema] of ns.structIterator()) {
165
+ let fromKey = memberName;
166
+ if (jsonName) {
167
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
168
+ if (hasType) {
169
+ nameMap[fromKey] = memberName;
170
+ }
171
+ }
172
+ if (union) {
173
+ unionSerde.mark(fromKey);
174
+ }
175
+ if (record[fromKey] != null) {
176
+ out[memberName] = this._read(memberSchema, record[fromKey]);
177
+ }
178
+ }
179
+ if (union) {
180
+ unionSerde.writeUnknown();
181
+ }
182
+ else if (hasType) {
183
+ for (const k in record) {
184
+ if (!hasOwn(record, k))
185
+ continue;
186
+ const v = record[k];
187
+ const t = jsonName ? (nameMap[k] ?? k) : k;
188
+ if (!(t in out)) {
189
+ out[t] = v;
190
+ }
191
+ }
192
+ }
193
+ return out;
194
+ }
195
+ needsTransform(ns) {
196
+ if (ns.isBlobSchema() ||
197
+ ns.isTimestampSchema() ||
198
+ ns.isBigIntegerSchema() ||
199
+ ns.isBigDecimalSchema() ||
200
+ ns.isNumericSchema()) {
201
+ return true;
202
+ }
203
+ if (ns.isDocumentSchema() || ns.isStructSchema() || ns.isListSchema() || ns.isMapSchema()) {
204
+ return true;
205
+ }
206
+ if (ns.isStringSchema() && ns.getMergedTraits().mediaType) {
207
+ return true;
208
+ }
209
+ return false;
210
+ }
211
+ }