@jaypie/express 1.2.15 → 1.2.16

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.
@@ -1809,14 +1809,18 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1809
1809
  //
1810
1810
  // Preprocess
1811
1811
  //
1812
+ // Build a request-local setup list to avoid mutating the shared array
1813
+ const requestSetup = [];
1812
1814
  // Load secrets into process.env if configured
1813
1815
  if (secrets && secrets.length > 0) {
1814
1816
  const secretsToLoad = secrets;
1815
1817
  const secretsSetup = async () => {
1816
1818
  await aws.loadEnvSecrets(...secretsToLoad);
1817
1819
  };
1818
- setup.unshift(secretsSetup);
1820
+ requestSetup.push(secretsSetup);
1819
1821
  }
1822
+ // Add shared setup functions
1823
+ requestSetup.push(...setup);
1820
1824
  if (locals) {
1821
1825
  // Locals
1822
1826
  const keys = Object.keys(locals);
@@ -1835,7 +1839,7 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1835
1839
  }
1836
1840
  }
1837
1841
  };
1838
- setup.push(localsSetup);
1842
+ requestSetup.push(localsSetup);
1839
1843
  }
1840
1844
  }
1841
1845
  let response;
@@ -1846,7 +1850,7 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1846
1850
  jaypieFunction = kit.jaypieHandler(handler, {
1847
1851
  chaos,
1848
1852
  name,
1849
- setup,
1853
+ setup: requestSetup,
1850
1854
  teardown,
1851
1855
  unavailable,
1852
1856
  validate,
@@ -2157,14 +2161,18 @@ function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2157
2161
  //
2158
2162
  // Preprocess
2159
2163
  //
2164
+ // Build a request-local setup list to avoid mutating the shared array
2165
+ const requestSetup = [];
2160
2166
  // Load secrets into process.env if configured
2161
2167
  if (secrets && secrets.length > 0) {
2162
2168
  const secretsToLoad = secrets;
2163
2169
  const secretsSetup = async () => {
2164
2170
  await aws.loadEnvSecrets(...secretsToLoad);
2165
2171
  };
2166
- setup.unshift(secretsSetup);
2172
+ requestSetup.push(secretsSetup);
2167
2173
  }
2174
+ // Add shared setup functions
2175
+ requestSetup.push(...setup);
2168
2176
  if (locals) {
2169
2177
  const keys = Object.keys(locals);
2170
2178
  if (keys.length > 0) {
@@ -2182,7 +2190,7 @@ function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2182
2190
  }
2183
2191
  }
2184
2192
  };
2185
- setup.push(localsSetup);
2193
+ requestSetup.push(localsSetup);
2186
2194
  }
2187
2195
  }
2188
2196
  try {
@@ -2190,7 +2198,7 @@ function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2190
2198
  jaypieFunction = kit.jaypieHandler(handler, {
2191
2199
  chaos,
2192
2200
  name,
2193
- setup,
2201
+ setup: requestSetup,
2194
2202
  teardown,
2195
2203
  unavailable,
2196
2204
  validate,