@postman/sdk-config 0.17.0 → 0.19.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/README.md +1 -1
- package/dist/index.cjs +90 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +90 -13
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +80 -10
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.d.cts +1 -1
- package/dist/sdk-config/index.d.ts +1 -1
- package/dist/sdk-config/index.js +80 -11
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +80 -10
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +6640 -818
- package/dist/sdk-config/v1/index.d.ts +6640 -818
- package/dist/sdk-config/v1/index.js +80 -11
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +10 -2
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.js +10 -2
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +10 -2
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +1040 -2
- package/dist/sdk-config-ir/v1/index.d.ts +1040 -2
- package/dist/sdk-config-ir/v1/index.js +10 -2
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/package.json +2 -2
- package/src/sdk-config/v1/README.md +22 -0
|
@@ -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",
|
|
@@ -2429,6 +2450,12 @@ var zipOutputSchema = zod.z.strictObject({
|
|
|
2429
2450
|
fileName: nonEmptyStringSchema.optional().describe("The generated ZIP archive file name."),
|
|
2430
2451
|
publish: sdkConfigV1PublishConfigSchema.optional().describe("Optional package registry publication.")
|
|
2431
2452
|
});
|
|
2453
|
+
var localAliasOutputSchema = zipOutputSchema.extend({
|
|
2454
|
+
delivery: zod.z.literal("local").describe('Alias of "zip": the package on the local machine.')
|
|
2455
|
+
}).transform(normalizeLocalDelivery);
|
|
2456
|
+
function normalizeLocalDelivery(output) {
|
|
2457
|
+
return { ...output, delivery: "zip" };
|
|
2458
|
+
}
|
|
2432
2459
|
var githubDeliverySchema = zod.z.strictObject({
|
|
2433
2460
|
delivery: zod.z.literal("github").describe("Delivers the generated SDK to GitHub."),
|
|
2434
2461
|
github: githubOutputSchema.describe("GitHub repository delivery settings."),
|
|
@@ -2436,8 +2463,25 @@ var githubDeliverySchema = zod.z.strictObject({
|
|
|
2436
2463
|
});
|
|
2437
2464
|
var sdkConfigV1OutputConfigSchema = zod.z.discriminatedUnion(
|
|
2438
2465
|
"delivery",
|
|
2439
|
-
[filesOutputSchema, zipOutputSchema, githubDeliverySchema],
|
|
2440
|
-
{ error: 'output.delivery must be one of "files", "zip", or "github"' }
|
|
2466
|
+
[filesOutputSchema, zipOutputSchema, githubDeliverySchema, localAliasOutputSchema],
|
|
2467
|
+
{ error: 'output.delivery must be one of "files", "zip", "local", or "github"' }
|
|
2468
|
+
);
|
|
2469
|
+
var hostedOutputSchema = zod.z.strictObject({
|
|
2470
|
+
delivery: zod.z.literal("hosted").describe("Deploys the generated MCP server to Fern-hosted infrastructure."),
|
|
2471
|
+
slug: nonEmptyStringSchema.describe(
|
|
2472
|
+
"The server slug. The hosted URL is https://{organization}.fernmcp.dev/{slug}. May be an environment expression that resolves to the slug."
|
|
2473
|
+
)
|
|
2474
|
+
});
|
|
2475
|
+
var sdkConfigV1McpOutputConfigSchema = zod.z.discriminatedUnion(
|
|
2476
|
+
"delivery",
|
|
2477
|
+
[
|
|
2478
|
+
filesOutputSchema,
|
|
2479
|
+
zipOutputSchema,
|
|
2480
|
+
githubDeliverySchema,
|
|
2481
|
+
hostedOutputSchema,
|
|
2482
|
+
localAliasOutputSchema
|
|
2483
|
+
],
|
|
2484
|
+
{ error: 'output.delivery must be one of "files", "zip", "local", "github", or "hosted"' }
|
|
2441
2485
|
);
|
|
2442
2486
|
var cliDistributionShape = {
|
|
2443
2487
|
distribution: cliDistributionConfigSchema.optional().describe(
|
|
@@ -2458,9 +2502,10 @@ var sdkConfigV1CliOutputConfigSchema = zod.z.discriminatedUnion(
|
|
|
2458
2502
|
[
|
|
2459
2503
|
filesOutputSchema.extend(cliDistributionShape).superRefine(rejectDistributionWithoutGithub),
|
|
2460
2504
|
zipOutputSchema.extend(cliDistributionShape).superRefine(rejectDistributionWithoutGithub),
|
|
2461
|
-
githubDeliverySchema.extend(cliDistributionShape)
|
|
2505
|
+
githubDeliverySchema.extend(cliDistributionShape),
|
|
2506
|
+
localAliasOutputSchema.in.extend(cliDistributionShape).superRefine(rejectDistributionWithoutGithub).transform(normalizeLocalDelivery)
|
|
2462
2507
|
],
|
|
2463
|
-
{ error: 'output.delivery must be one of "files", "zip", or "github"' }
|
|
2508
|
+
{ error: 'output.delivery must be one of "files", "zip", "local", or "github"' }
|
|
2464
2509
|
);
|
|
2465
2510
|
var sdkConfigV1ReplayConfigSchema = zod.z.strictObject({
|
|
2466
2511
|
enabled: zod.z.boolean().describe("Whether regeneration reapplies customer-authored repository changes.")
|
|
@@ -2876,7 +2921,10 @@ var sdkConfigV1TargetSchema = zod.z.discriminatedUnion("language", [
|
|
|
2876
2921
|
zod.z.strictObject({
|
|
2877
2922
|
language: zod.z.literal("mcp").describe("Generates an MCP server."),
|
|
2878
2923
|
generation: sdkConfigV1GenerationConfigOverrideSchema.extend(mcpGenerationConfigSchema.shape).optional().describe("Common and MCP-specific generation settings for this target."),
|
|
2879
|
-
...targetOverrideShape
|
|
2924
|
+
...targetOverrideShape,
|
|
2925
|
+
output: sdkConfigV1McpOutputConfigSchema.optional().describe(
|
|
2926
|
+
"Output configuration, including Fern-hosted deployment, that replaces the root output for this target."
|
|
2927
|
+
)
|
|
2880
2928
|
}),
|
|
2881
2929
|
zod.z.strictObject({
|
|
2882
2930
|
language: zod.z.literal("terraform").describe("Generates a Terraform provider."),
|
|
@@ -2953,7 +3001,7 @@ function validateTargetPublishing(target, targetIndex, globalPackage, globalOutp
|
|
|
2953
3001
|
});
|
|
2954
3002
|
return;
|
|
2955
3003
|
}
|
|
2956
|
-
if (!output.publish) {
|
|
3004
|
+
if (output.delivery === "hosted" || !output.publish) {
|
|
2957
3005
|
return;
|
|
2958
3006
|
}
|
|
2959
3007
|
const registry = output.publish.registry;
|
|
@@ -3071,6 +3119,22 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
3071
3119
|
const docs = partitionSharedBlock(mapped.map(({ docs: docs2 }) => docs2));
|
|
3072
3120
|
const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
|
|
3073
3121
|
const api = { ...input.api ?? {} };
|
|
3122
|
+
const mcpBaseUrlIndex = mapped.findIndex(({ invocation }) => invocation.apiBaseUrl !== void 0);
|
|
3123
|
+
const mcpBaseUrl = mapped[mcpBaseUrlIndex]?.invocation.apiBaseUrl;
|
|
3124
|
+
const apiDiagnostics = [];
|
|
3125
|
+
if (mcpBaseUrl !== void 0) {
|
|
3126
|
+
if (api.baseUrl !== void 0 && api.baseUrl !== "" && api.baseUrl !== mcpBaseUrl) {
|
|
3127
|
+
apiDiagnostics.push({
|
|
3128
|
+
code: "FERN_MCP_BASE_URL_REPLACES_API_BASE_URL",
|
|
3129
|
+
severity: "warning",
|
|
3130
|
+
path: ["group", "generators", mcpBaseUrlIndex, "config", "baseUrl"],
|
|
3131
|
+
reason: `The MCP generator baseUrl "${mcpBaseUrl}" replaced the API base URL "${api.baseUrl}"`,
|
|
3132
|
+
sdkConfigPath: ["api", "baseUrl"],
|
|
3133
|
+
suggestedAction: "Check api.baseUrl in the migrated SDK Config. Remove the MCP baseUrl to keep the API base URL."
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
api.baseUrl = mcpBaseUrl;
|
|
3137
|
+
}
|
|
3074
3138
|
delete api.audiences;
|
|
3075
3139
|
if (input.group.audiences.type === "select") {
|
|
3076
3140
|
api.audiences = [...input.group.audiences.audiences];
|
|
@@ -3171,10 +3235,13 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
3171
3235
|
const validatedSdkConfig = sdkConfig;
|
|
3172
3236
|
return {
|
|
3173
3237
|
sdkConfig: validatedSdkConfig,
|
|
3174
|
-
unsupportedFields:
|
|
3175
|
-
...
|
|
3176
|
-
...unsupportedFields
|
|
3177
|
-
|
|
3238
|
+
unsupportedFields: [
|
|
3239
|
+
...apiDiagnostics,
|
|
3240
|
+
...mapped.flatMap(({ invocation, unsupportedFields }) => [
|
|
3241
|
+
...invocation.unsupportedFields,
|
|
3242
|
+
...unsupportedFields
|
|
3243
|
+
])
|
|
3244
|
+
]
|
|
3178
3245
|
};
|
|
3179
3246
|
}
|
|
3180
3247
|
function withRustCratesPublishDefaults(packageConfig, { language, output, generator }) {
|
|
@@ -3307,6 +3374,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
3307
3374
|
...optional("smartCasingDigitWordBoundary", smartCasingDigitWordBoundary)
|
|
3308
3375
|
};
|
|
3309
3376
|
}
|
|
3377
|
+
const apiBaseUrl = language === "mcp" && activeLanguages.size === 1 ? takeString(config, ["baseUrl"], state, [...prefix, "config"]) : void 0;
|
|
3310
3378
|
const targetGeneration = mapLanguageConfig(
|
|
3311
3379
|
language,
|
|
3312
3380
|
config,
|
|
@@ -3351,6 +3419,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
3351
3419
|
package: packageConfig,
|
|
3352
3420
|
packageFallbacks: state.packageFallbacks ?? [],
|
|
3353
3421
|
...optional("cliDistribution", state.cliDistribution),
|
|
3422
|
+
...optional("apiBaseUrl", apiBaseUrl),
|
|
3354
3423
|
targetGeneration,
|
|
3355
3424
|
unsupportedFields
|
|
3356
3425
|
};
|
|
@@ -4300,6 +4369,7 @@ exports.sdkConfigV1GoModulePathSchema = goModulePathSchema;
|
|
|
4300
4369
|
exports.sdkConfigV1JavaGenerationConfigSchema = javaGenerationConfigSchema;
|
|
4301
4370
|
exports.sdkConfigV1KotlinGenerationConfigSchema = kotlinGenerationConfigSchema;
|
|
4302
4371
|
exports.sdkConfigV1McpGenerationConfigSchema = mcpGenerationConfigSchema;
|
|
4372
|
+
exports.sdkConfigV1McpOutputConfigSchema = sdkConfigV1McpOutputConfigSchema;
|
|
4303
4373
|
exports.sdkConfigV1NonEmptyStringSchema = nonEmptyStringSchema;
|
|
4304
4374
|
exports.sdkConfigV1OutputConfigSchema = sdkConfigV1OutputConfigSchema;
|
|
4305
4375
|
exports.sdkConfigV1PackageConfigSchema = sdkConfigV1PackageConfigSchema;
|