@postman/sdk-config 0.17.0 → 0.18.0

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/index.cjs CHANGED
@@ -1122,6 +1122,27 @@ function mapOutput(generator, language, index) {
1122
1122
  language
1123
1123
  );
1124
1124
  }
1125
+ if (language === "mcp" && rawOutput?.location === "fern-hosted") {
1126
+ const slug = rawOutput.slug;
1127
+ if (typeof slug !== "string" || slug === "") {
1128
+ fail(
1129
+ "FERN_HOSTED_SLUG_REQUIRED",
1130
+ ["group", "generators", index, "output", "slug"],
1131
+ `Fern generator ${generator.name} uses output.location "fern-hosted" without a slug`,
1132
+ 'Set output.slug on the generator, or set target.output manually with delivery "hosted" and a slug.',
1133
+ ["targets", index, "output", "slug"]
1134
+ );
1135
+ }
1136
+ if (isObject(generator.outputMode)) consume(state, [...outputPath, "type"]);
1137
+ return finishOutputMapping(
1138
+ { output: { delivery: "hosted", slug } },
1139
+ generator.outputMode,
1140
+ outputPath,
1141
+ state,
1142
+ index,
1143
+ language
1144
+ );
1145
+ }
1125
1146
  if (!isObject(generator.outputMode) || typeof generator.outputMode.type !== "string") {
1126
1147
  fail(
1127
1148
  "FERN_OUTPUT_REQUIRED",
@@ -2451,6 +2472,17 @@ var sdkConfigV1OutputConfigSchema = zod.z.discriminatedUnion(
2451
2472
  [filesOutputSchema, zipOutputSchema, githubDeliverySchema],
2452
2473
  { error: 'output.delivery must be one of "files", "zip", or "github"' }
2453
2474
  );
2475
+ var hostedOutputSchema = zod.z.strictObject({
2476
+ delivery: zod.z.literal("hosted").describe("Deploys the generated MCP server to Fern-hosted infrastructure."),
2477
+ slug: nonEmptyStringSchema.describe(
2478
+ "The server slug. The hosted URL is https://{organization}.fernmcp.dev/{slug}. May be an environment expression that resolves to the slug."
2479
+ )
2480
+ });
2481
+ var sdkConfigV1McpOutputConfigSchema = zod.z.discriminatedUnion(
2482
+ "delivery",
2483
+ [filesOutputSchema, zipOutputSchema, githubDeliverySchema, hostedOutputSchema],
2484
+ { error: 'output.delivery must be one of "files", "zip", "github", or "hosted"' }
2485
+ );
2454
2486
  var cliDistributionShape = {
2455
2487
  distribution: cliDistributionConfigSchema.optional().describe(
2456
2488
  "CLI release channels and build attestation settings for the generated release workflow; credentials are GitHub Actions secret names."
@@ -2888,7 +2920,10 @@ var sdkConfigV1TargetSchema = zod.z.discriminatedUnion("language", [
2888
2920
  zod.z.strictObject({
2889
2921
  language: zod.z.literal("mcp").describe("Generates an MCP server."),
2890
2922
  generation: sdkConfigV1GenerationConfigOverrideSchema.extend(mcpGenerationConfigSchema.shape).optional().describe("Common and MCP-specific generation settings for this target."),
2891
- ...targetOverrideShape
2923
+ ...targetOverrideShape,
2924
+ output: sdkConfigV1McpOutputConfigSchema.optional().describe(
2925
+ "Output configuration, including Fern-hosted deployment, that replaces the root output for this target."
2926
+ )
2892
2927
  }),
2893
2928
  zod.z.strictObject({
2894
2929
  language: zod.z.literal("terraform").describe("Generates a Terraform provider."),
@@ -2965,7 +3000,7 @@ function validateTargetPublishing(target, targetIndex, globalPackage, globalOutp
2965
3000
  });
2966
3001
  return;
2967
3002
  }
2968
- if (!output.publish) {
3003
+ if (output.delivery === "hosted" || !output.publish) {
2969
3004
  return;
2970
3005
  }
2971
3006
  const registry = output.publish.registry;
@@ -3083,6 +3118,22 @@ function mapFernConfigToSdkConfigV1(input) {
3083
3118
  const docs = partitionSharedBlock(mapped.map(({ docs: docs2 }) => docs2));
3084
3119
  const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
3085
3120
  const api = { ...input.api ?? {} };
3121
+ const mcpBaseUrlIndex = mapped.findIndex(({ invocation }) => invocation.apiBaseUrl !== void 0);
3122
+ const mcpBaseUrl = mapped[mcpBaseUrlIndex]?.invocation.apiBaseUrl;
3123
+ const apiDiagnostics = [];
3124
+ if (mcpBaseUrl !== void 0) {
3125
+ if (api.baseUrl !== void 0 && api.baseUrl !== "" && api.baseUrl !== mcpBaseUrl) {
3126
+ apiDiagnostics.push({
3127
+ code: "FERN_MCP_BASE_URL_REPLACES_API_BASE_URL",
3128
+ severity: "warning",
3129
+ path: ["group", "generators", mcpBaseUrlIndex, "config", "baseUrl"],
3130
+ reason: `The MCP generator baseUrl "${mcpBaseUrl}" replaced the API base URL "${api.baseUrl}"`,
3131
+ sdkConfigPath: ["api", "baseUrl"],
3132
+ suggestedAction: "Check api.baseUrl in the migrated SDK Config. Remove the MCP baseUrl to keep the API base URL."
3133
+ });
3134
+ }
3135
+ api.baseUrl = mcpBaseUrl;
3136
+ }
3086
3137
  delete api.audiences;
3087
3138
  if (input.group.audiences.type === "select") {
3088
3139
  api.audiences = [...input.group.audiences.audiences];
@@ -3183,10 +3234,13 @@ function mapFernConfigToSdkConfigV1(input) {
3183
3234
  const validatedSdkConfig = sdkConfig;
3184
3235
  return {
3185
3236
  sdkConfig: validatedSdkConfig,
3186
- unsupportedFields: mapped.flatMap(({ invocation, unsupportedFields }) => [
3187
- ...invocation.unsupportedFields,
3188
- ...unsupportedFields
3189
- ])
3237
+ unsupportedFields: [
3238
+ ...apiDiagnostics,
3239
+ ...mapped.flatMap(({ invocation, unsupportedFields }) => [
3240
+ ...invocation.unsupportedFields,
3241
+ ...unsupportedFields
3242
+ ])
3243
+ ]
3190
3244
  };
3191
3245
  }
3192
3246
  function withRustCratesPublishDefaults(packageConfig, { language, output, generator }) {
@@ -3319,6 +3373,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
3319
3373
  ...optional("smartCasingDigitWordBoundary", smartCasingDigitWordBoundary)
3320
3374
  };
3321
3375
  }
3376
+ const apiBaseUrl = language === "mcp" && activeLanguages.size === 1 ? takeString(config, ["baseUrl"], state, [...prefix, "config"]) : void 0;
3322
3377
  const targetGeneration = mapLanguageConfig(
3323
3378
  language,
3324
3379
  config,
@@ -3363,6 +3418,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
3363
3418
  package: packageConfig,
3364
3419
  packageFallbacks: state.packageFallbacks ?? [],
3365
3420
  ...optional("cliDistribution", state.cliDistribution),
3421
+ ...optional("apiBaseUrl", apiBaseUrl),
3366
3422
  targetGeneration,
3367
3423
  unsupportedFields
3368
3424
  };
@@ -5010,6 +5066,7 @@ exports.sdkConfigV1GoModulePathSchema = goModulePathSchema;
5010
5066
  exports.sdkConfigV1JavaGenerationConfigSchema = javaGenerationConfigSchema;
5011
5067
  exports.sdkConfigV1KotlinGenerationConfigSchema = kotlinGenerationConfigSchema;
5012
5068
  exports.sdkConfigV1McpGenerationConfigSchema = mcpGenerationConfigSchema;
5069
+ exports.sdkConfigV1McpOutputConfigSchema = sdkConfigV1McpOutputConfigSchema;
5013
5070
  exports.sdkConfigV1NonEmptyStringSchema = nonEmptyStringSchema;
5014
5071
  exports.sdkConfigV1OutputConfigSchema = sdkConfigV1OutputConfigSchema;
5015
5072
  exports.sdkConfigV1PackageConfigSchema = sdkConfigV1PackageConfigSchema;