@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.
@@ -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",
@@ -2439,6 +2460,17 @@ var sdkConfigV1OutputConfigSchema = zod.z.discriminatedUnion(
2439
2460
  [filesOutputSchema, zipOutputSchema, githubDeliverySchema],
2440
2461
  { error: 'output.delivery must be one of "files", "zip", or "github"' }
2441
2462
  );
2463
+ var hostedOutputSchema = zod.z.strictObject({
2464
+ delivery: zod.z.literal("hosted").describe("Deploys the generated MCP server to Fern-hosted infrastructure."),
2465
+ slug: nonEmptyStringSchema.describe(
2466
+ "The server slug. The hosted URL is https://{organization}.fernmcp.dev/{slug}. May be an environment expression that resolves to the slug."
2467
+ )
2468
+ });
2469
+ var sdkConfigV1McpOutputConfigSchema = zod.z.discriminatedUnion(
2470
+ "delivery",
2471
+ [filesOutputSchema, zipOutputSchema, githubDeliverySchema, hostedOutputSchema],
2472
+ { error: 'output.delivery must be one of "files", "zip", "github", or "hosted"' }
2473
+ );
2442
2474
  var cliDistributionShape = {
2443
2475
  distribution: cliDistributionConfigSchema.optional().describe(
2444
2476
  "CLI release channels and build attestation settings for the generated release workflow; credentials are GitHub Actions secret names."
@@ -2876,7 +2908,10 @@ var sdkConfigV1TargetSchema = zod.z.discriminatedUnion("language", [
2876
2908
  zod.z.strictObject({
2877
2909
  language: zod.z.literal("mcp").describe("Generates an MCP server."),
2878
2910
  generation: sdkConfigV1GenerationConfigOverrideSchema.extend(mcpGenerationConfigSchema.shape).optional().describe("Common and MCP-specific generation settings for this target."),
2879
- ...targetOverrideShape
2911
+ ...targetOverrideShape,
2912
+ output: sdkConfigV1McpOutputConfigSchema.optional().describe(
2913
+ "Output configuration, including Fern-hosted deployment, that replaces the root output for this target."
2914
+ )
2880
2915
  }),
2881
2916
  zod.z.strictObject({
2882
2917
  language: zod.z.literal("terraform").describe("Generates a Terraform provider."),
@@ -2953,7 +2988,7 @@ function validateTargetPublishing(target, targetIndex, globalPackage, globalOutp
2953
2988
  });
2954
2989
  return;
2955
2990
  }
2956
- if (!output.publish) {
2991
+ if (output.delivery === "hosted" || !output.publish) {
2957
2992
  return;
2958
2993
  }
2959
2994
  const registry = output.publish.registry;
@@ -3071,6 +3106,22 @@ function mapFernConfigToSdkConfigV1(input) {
3071
3106
  const docs = partitionSharedBlock(mapped.map(({ docs: docs2 }) => docs2));
3072
3107
  const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
3073
3108
  const api = { ...input.api ?? {} };
3109
+ const mcpBaseUrlIndex = mapped.findIndex(({ invocation }) => invocation.apiBaseUrl !== void 0);
3110
+ const mcpBaseUrl = mapped[mcpBaseUrlIndex]?.invocation.apiBaseUrl;
3111
+ const apiDiagnostics = [];
3112
+ if (mcpBaseUrl !== void 0) {
3113
+ if (api.baseUrl !== void 0 && api.baseUrl !== "" && api.baseUrl !== mcpBaseUrl) {
3114
+ apiDiagnostics.push({
3115
+ code: "FERN_MCP_BASE_URL_REPLACES_API_BASE_URL",
3116
+ severity: "warning",
3117
+ path: ["group", "generators", mcpBaseUrlIndex, "config", "baseUrl"],
3118
+ reason: `The MCP generator baseUrl "${mcpBaseUrl}" replaced the API base URL "${api.baseUrl}"`,
3119
+ sdkConfigPath: ["api", "baseUrl"],
3120
+ suggestedAction: "Check api.baseUrl in the migrated SDK Config. Remove the MCP baseUrl to keep the API base URL."
3121
+ });
3122
+ }
3123
+ api.baseUrl = mcpBaseUrl;
3124
+ }
3074
3125
  delete api.audiences;
3075
3126
  if (input.group.audiences.type === "select") {
3076
3127
  api.audiences = [...input.group.audiences.audiences];
@@ -3171,10 +3222,13 @@ function mapFernConfigToSdkConfigV1(input) {
3171
3222
  const validatedSdkConfig = sdkConfig;
3172
3223
  return {
3173
3224
  sdkConfig: validatedSdkConfig,
3174
- unsupportedFields: mapped.flatMap(({ invocation, unsupportedFields }) => [
3175
- ...invocation.unsupportedFields,
3176
- ...unsupportedFields
3177
- ])
3225
+ unsupportedFields: [
3226
+ ...apiDiagnostics,
3227
+ ...mapped.flatMap(({ invocation, unsupportedFields }) => [
3228
+ ...invocation.unsupportedFields,
3229
+ ...unsupportedFields
3230
+ ])
3231
+ ]
3178
3232
  };
3179
3233
  }
3180
3234
  function withRustCratesPublishDefaults(packageConfig, { language, output, generator }) {
@@ -3307,6 +3361,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
3307
3361
  ...optional("smartCasingDigitWordBoundary", smartCasingDigitWordBoundary)
3308
3362
  };
3309
3363
  }
3364
+ const apiBaseUrl = language === "mcp" && activeLanguages.size === 1 ? takeString(config, ["baseUrl"], state, [...prefix, "config"]) : void 0;
3310
3365
  const targetGeneration = mapLanguageConfig(
3311
3366
  language,
3312
3367
  config,
@@ -3351,6 +3406,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
3351
3406
  package: packageConfig,
3352
3407
  packageFallbacks: state.packageFallbacks ?? [],
3353
3408
  ...optional("cliDistribution", state.cliDistribution),
3409
+ ...optional("apiBaseUrl", apiBaseUrl),
3354
3410
  targetGeneration,
3355
3411
  unsupportedFields
3356
3412
  };
@@ -4300,6 +4356,7 @@ exports.sdkConfigV1GoModulePathSchema = goModulePathSchema;
4300
4356
  exports.sdkConfigV1JavaGenerationConfigSchema = javaGenerationConfigSchema;
4301
4357
  exports.sdkConfigV1KotlinGenerationConfigSchema = kotlinGenerationConfigSchema;
4302
4358
  exports.sdkConfigV1McpGenerationConfigSchema = mcpGenerationConfigSchema;
4359
+ exports.sdkConfigV1McpOutputConfigSchema = sdkConfigV1McpOutputConfigSchema;
4303
4360
  exports.sdkConfigV1NonEmptyStringSchema = nonEmptyStringSchema;
4304
4361
  exports.sdkConfigV1OutputConfigSchema = sdkConfigV1OutputConfigSchema;
4305
4362
  exports.sdkConfigV1PackageConfigSchema = sdkConfigV1PackageConfigSchema;