@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.
@@ -89,6 +89,7 @@ function bindRuntimeAuth(details, binding) {
89
89
  // src/http/middleware/request/cors.middleware.ts
90
90
  import corsMiddleware from "cors";
91
91
  var CORS_ORIGINS_ENV = "CORS_ORIGINS";
92
+ var CORS_FROM_ENVIRONMENT = "environment";
92
93
  var LOCAL_DEVELOPMENT_ORIGIN = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d{1,5})?$/;
93
94
  function parseCorsOrigins(value) {
94
95
  const origins = [];
@@ -120,7 +121,8 @@ function defaultCorsOrigin(env) {
120
121
  function withoutWildcardCredentials(options2) {
121
122
  return options2.credentials === true && isWildcardOrigin(options2.origin) ? { ...options2, credentials: false } : options2;
122
123
  }
123
- function resolveCorsOptions(appCors, env = process.env) {
124
+ function resolveCorsOptions(appCorsOption, env = process.env) {
125
+ const appCors = appCorsOption === CORS_FROM_ENVIRONMENT ? void 0 : appCorsOption;
124
126
  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.`;
125
127
  if (appCors !== void 0) {
126
128
  if (appCors.credentials === true && isWildcardOrigin(appCors.origin)) {
@@ -1632,7 +1634,11 @@ import { getEnvVar as getEnvVar3 } from "@forklaunch/common";
1632
1634
  // src/persistence/encryptedType.ts
1633
1635
  import { Type } from "@mikro-orm/core";
1634
1636
  import { AsyncLocalStorage } from "async_hooks";
1635
- var _tenantContext = new AsyncLocalStorage();
1637
+ var _encryptionState = globalThis[/* @__PURE__ */ Symbol.for("forklaunch.persistence.encryptionState")] ??= {
1638
+ encryptor: void 0,
1639
+ tenantContext: new AsyncLocalStorage()
1640
+ };
1641
+ var _tenantContext = _encryptionState.tenantContext;
1636
1642
 
1637
1643
  // src/persistence/complianceChanges.ts
1638
1644
  var LISTENERS = globalThis[/* @__PURE__ */ Symbol.for("forklaunch.compliance.changeListeners")] ??= /* @__PURE__ */ new Set();
@@ -5140,7 +5146,12 @@ var getCodeForStatus = (status) => {
5140
5146
  var httpStatusCodes_default = HTTPStatuses;
5141
5147
 
5142
5148
  // src/http/mcpGenerator/mcpGenerator.ts
5143
- import { isNever as isNever3, isRecord as isRecord3, safeStringify as safeStringify3 } from "@forklaunch/common";
5149
+ import {
5150
+ isNever as isNever3,
5151
+ isRecord as isRecord3,
5152
+ safeStringify as safeStringify3,
5153
+ toPlainString
5154
+ } from "@forklaunch/common";
5144
5155
  import { string, ZodSchemaValidator } from "@forklaunch/validator/zod";
5145
5156
  import { FastMCP } from "fastmcp";
5146
5157
 
@@ -5489,7 +5500,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
5489
5500
  break;
5490
5501
  }
5491
5502
  case "file": {
5492
- parsedBody = Buffer.from(safeStringify3(body));
5503
+ parsedBody = Buffer.from(toPlainString(body));
5493
5504
  break;
5494
5505
  }
5495
5506
  case "multipart": {
@@ -5523,7 +5534,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
5523
5534
  parsedBody = new URLSearchParams(
5524
5535
  Object.entries(body).map(([key, value]) => [
5525
5536
  key,
5526
- safeStringify3(value)
5537
+ toPlainString(value)
5527
5538
  ])
5528
5539
  );
5529
5540
  } else {
@@ -5542,7 +5553,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
5542
5553
  const queryString = new URLSearchParams(
5543
5554
  Object.entries(query).map(([key, value]) => [
5544
5555
  key,
5545
- safeStringify3(value)
5556
+ toPlainString(value)
5546
5557
  ])
5547
5558
  ).toString();
5548
5559
  url += queryString ? `?${queryString}` : "";