@forklaunch/core 4.0.0 → 4.1.1

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/http/index.js CHANGED
@@ -247,6 +247,7 @@ function bindRuntimeAuth(details, binding) {
247
247
  // src/http/middleware/request/cors.middleware.ts
248
248
  var import_cors = __toESM(require("cors"));
249
249
  var CORS_ORIGINS_ENV = "CORS_ORIGINS";
250
+ var CORS_FROM_ENVIRONMENT = "environment";
250
251
  var LOCAL_DEVELOPMENT_ORIGIN = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d{1,5})?$/;
251
252
  function parseCorsOrigins(value) {
252
253
  const origins = [];
@@ -278,7 +279,8 @@ function defaultCorsOrigin(env) {
278
279
  function withoutWildcardCredentials(options2) {
279
280
  return options2.credentials === true && isWildcardOrigin(options2.origin) ? { ...options2, credentials: false } : options2;
280
281
  }
281
- function resolveCorsOptions(appCors, env = process.env) {
282
+ function resolveCorsOptions(appCorsOption, env = process.env) {
283
+ const appCors = appCorsOption === CORS_FROM_ENVIRONMENT ? void 0 : appCorsOption;
282
284
  const howToConfigure = `Set ${CORS_ORIGINS_ENV} to a comma separated list of allowed origins (for example ${CORS_ORIGINS_ENV}=https://app.example.com), or pass \`cors: { origin: [...] }\` in the application options.`;
283
285
  if (appCors !== void 0) {
284
286
  if (appCors.credentials === true && isWildcardOrigin(appCors.origin)) {
@@ -1773,7 +1775,11 @@ var import_common7 = require("@forklaunch/common");
1773
1775
  // src/persistence/encryptedType.ts
1774
1776
  var import_core = require("@mikro-orm/core");
1775
1777
  var import_node_async_hooks = require("async_hooks");
1776
- var _tenantContext = new import_node_async_hooks.AsyncLocalStorage();
1778
+ var _encryptionState = globalThis[/* @__PURE__ */ Symbol.for("forklaunch.persistence.encryptionState")] ??= {
1779
+ encryptor: void 0,
1780
+ tenantContext: new import_node_async_hooks.AsyncLocalStorage()
1781
+ };
1782
+ var _tenantContext = _encryptionState.tenantContext;
1777
1783
 
1778
1784
  // src/persistence/complianceChanges.ts
1779
1785
  var LISTENERS = globalThis[/* @__PURE__ */ Symbol.for("forklaunch.compliance.changeListeners")] ??= /* @__PURE__ */ new Set();
@@ -5627,7 +5633,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
5627
5633
  break;
5628
5634
  }
5629
5635
  case "file": {
5630
- parsedBody = Buffer.from((0, import_common12.safeStringify)(body));
5636
+ parsedBody = Buffer.from((0, import_common12.toPlainString)(body));
5631
5637
  break;
5632
5638
  }
5633
5639
  case "multipart": {
@@ -5661,7 +5667,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
5661
5667
  parsedBody = new URLSearchParams(
5662
5668
  Object.entries(body).map(([key, value]) => [
5663
5669
  key,
5664
- (0, import_common12.safeStringify)(value)
5670
+ (0, import_common12.toPlainString)(value)
5665
5671
  ])
5666
5672
  );
5667
5673
  } else {
@@ -5680,7 +5686,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
5680
5686
  const queryString = new URLSearchParams(
5681
5687
  Object.entries(query).map(([key, value]) => [
5682
5688
  key,
5683
- (0, import_common12.safeStringify)(value)
5689
+ (0, import_common12.toPlainString)(value)
5684
5690
  ])
5685
5691
  ).toString();
5686
5692
  url += queryString ? `?${queryString}` : "";