@justworkflowit/cdk-constructs 0.0.211 → 0.0.213

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.
@@ -1771,7 +1771,7 @@ var require_dist_cjs12 = __commonJS({
1771
1771
  var MIN_WAIT_TIME = 6e3;
1772
1772
  async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME) {
1773
1773
  const headers = request.headers ?? {};
1774
- const expect = headers["Expect"] || headers["expect"];
1774
+ const expect = headers.Expect || headers.expect;
1775
1775
  let timeoutId = -1;
1776
1776
  let sendBody = true;
1777
1777
  if (expect === "100-continue") {
@@ -1899,6 +1899,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
1899
1899
  this.config = await this.configProvider;
1900
1900
  }
1901
1901
  return new Promise((_resolve, _reject) => {
1902
+ const config = this.config;
1902
1903
  let writeRequestBodyPromise = void 0;
1903
1904
  const timeouts = [];
1904
1905
  const resolve = async (arg) => {
@@ -1911,9 +1912,6 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
1911
1912
  timeouts.forEach(timing.clearTimeout);
1912
1913
  _reject(arg);
1913
1914
  };
1914
- if (!this.config) {
1915
- throw new Error("Node HTTP request handler config is not resolved");
1916
- }
1917
1915
  if (abortSignal?.aborted) {
1918
1916
  const abortError = new Error("Request aborted");
1919
1917
  abortError.name = "AbortError";
@@ -1921,10 +1919,18 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
1921
1919
  return;
1922
1920
  }
1923
1921
  const isSSL = request.protocol === "https:";
1924
- const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
1922
+ const headers = request.headers ?? {};
1923
+ const expectContinue = (headers.Expect ?? headers.expect) === "100-continue";
1924
+ let agent = isSSL ? config.httpsAgent : config.httpAgent;
1925
+ if (expectContinue) {
1926
+ agent = new (isSSL ? https.Agent : http.Agent)({
1927
+ keepAlive: false,
1928
+ maxSockets: Infinity
1929
+ });
1930
+ }
1925
1931
  timeouts.push(timing.setTimeout(() => {
1926
- this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, this.config.logger);
1927
- }, this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)));
1932
+ this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, config.logger);
1933
+ }, config.socketAcquisitionWarningTimeout ?? (config.requestTimeout ?? 2e3) + (config.connectionTimeout ?? 1e3)));
1928
1934
  const queryString = querystringBuilder.buildQueryString(request.query || {});
1929
1935
  let auth = void 0;
1930
1936
  if (request.username != null || request.password != null) {
@@ -1986,10 +1992,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
1986
1992
  abortSignal.onabort = onAbort;
1987
1993
  }
1988
1994
  }
1989
- const effectiveRequestTimeout = requestTimeout ?? this.config.requestTimeout;
1990
- timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
1991
- timeouts.push(setRequestTimeout(req, reject, effectiveRequestTimeout, this.config.throwOnRequestTimeout, this.config.logger ?? console));
1992
- timeouts.push(setSocketTimeout(req, reject, this.config.socketTimeout));
1995
+ const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
1996
+ timeouts.push(setConnectionTimeout(req, reject, config.connectionTimeout));
1997
+ timeouts.push(setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, config.logger ?? console));
1998
+ timeouts.push(setSocketTimeout(req, reject, config.socketTimeout));
1993
1999
  const httpAgent = nodeHttpsOptions.agent;
1994
2000
  if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
1995
2001
  timeouts.push(setSocketKeepAlive(req, {
@@ -23437,6 +23443,7 @@ var require_dist_cjs38 = __commonJS({
23437
23443
  "use strict";
23438
23444
  var utilConfigProvider = require_dist_cjs30();
23439
23445
  var utilMiddleware = require_dist_cjs4();
23446
+ var utilEndpoints = require_dist_cjs33();
23440
23447
  var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
23441
23448
  var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
23442
23449
  var DEFAULT_USE_DUALSTACK_ENDPOINT = false;
@@ -23499,6 +23506,14 @@ var require_dist_cjs38 = __commonJS({
23499
23506
  var NODE_REGION_CONFIG_FILE_OPTIONS3 = {
23500
23507
  preferredFile: "credentials"
23501
23508
  };
23509
+ var validRegions = /* @__PURE__ */ new Set();
23510
+ var checkRegion = (region, check = utilEndpoints.isValidHostLabel) => {
23511
+ if (!validRegions.has(region) && !check(region)) {
23512
+ throw new Error(`Region not accepted: region="${region}" is not a valid hostname component.`);
23513
+ } else {
23514
+ validRegions.add(region);
23515
+ }
23516
+ };
23502
23517
  var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
23503
23518
  var getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region;
23504
23519
  var resolveRegionConfig3 = (input) => {
@@ -23508,11 +23523,10 @@ var require_dist_cjs38 = __commonJS({
23508
23523
  }
23509
23524
  return Object.assign(input, {
23510
23525
  region: async () => {
23511
- if (typeof region === "string") {
23512
- return getRealRegion(region);
23513
- }
23514
- const providedRegion = await region();
23515
- return getRealRegion(providedRegion);
23526
+ const providedRegion = typeof region === "function" ? await region() : region;
23527
+ const realRegion = getRealRegion(providedRegion);
23528
+ checkRegion(realRegion);
23529
+ return realRegion;
23516
23530
  },
23517
23531
  useFipsEndpoint: async () => {
23518
23532
  const providedRegion = typeof region === "string" ? region : await region();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justworkflowit/cdk-constructs",
3
3
  "description": "",
4
- "version": "0.0.211",
4
+ "version": "0.0.213",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "publishConfig": {