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