@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
package/README.md
CHANGED
|
@@ -187,7 +187,7 @@ For each request target, the API request and matching SDK Config target must agr
|
|
|
187
187
|
- API version, when present
|
|
188
188
|
- generator version, when `generatorVersion` is present in SDK Config
|
|
189
189
|
- every package property included in the API request; the request may omit package properties
|
|
190
|
-
- ZIP output without publication settings, paired with a download request
|
|
190
|
+
- ZIP output without publication settings, paired with a download request. `delivery: local` is an alias of `zip` and is normalized to `zip` on parse.
|
|
191
191
|
|
|
192
192
|
Root package properties are inherited by each target and overridden by target package properties.
|
|
193
193
|
A target output replaces the root output; it is not merged with it.
|
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",
|
|
@@ -2441,6 +2462,12 @@ var zipOutputSchema = zod.z.strictObject({
|
|
|
2441
2462
|
fileName: nonEmptyStringSchema.optional().describe("The generated ZIP archive file name."),
|
|
2442
2463
|
publish: sdkConfigV1PublishConfigSchema.optional().describe("Optional package registry publication.")
|
|
2443
2464
|
});
|
|
2465
|
+
var localAliasOutputSchema = zipOutputSchema.extend({
|
|
2466
|
+
delivery: zod.z.literal("local").describe('Alias of "zip": the package on the local machine.')
|
|
2467
|
+
}).transform(normalizeLocalDelivery);
|
|
2468
|
+
function normalizeLocalDelivery(output) {
|
|
2469
|
+
return { ...output, delivery: "zip" };
|
|
2470
|
+
}
|
|
2444
2471
|
var githubDeliverySchema = zod.z.strictObject({
|
|
2445
2472
|
delivery: zod.z.literal("github").describe("Delivers the generated SDK to GitHub."),
|
|
2446
2473
|
github: githubOutputSchema.describe("GitHub repository delivery settings."),
|
|
@@ -2448,8 +2475,25 @@ var githubDeliverySchema = zod.z.strictObject({
|
|
|
2448
2475
|
});
|
|
2449
2476
|
var sdkConfigV1OutputConfigSchema = zod.z.discriminatedUnion(
|
|
2450
2477
|
"delivery",
|
|
2451
|
-
[filesOutputSchema, zipOutputSchema, githubDeliverySchema],
|
|
2452
|
-
{ error: 'output.delivery must be one of "files", "zip", or "github"' }
|
|
2478
|
+
[filesOutputSchema, zipOutputSchema, githubDeliverySchema, localAliasOutputSchema],
|
|
2479
|
+
{ error: 'output.delivery must be one of "files", "zip", "local", or "github"' }
|
|
2480
|
+
);
|
|
2481
|
+
var hostedOutputSchema = zod.z.strictObject({
|
|
2482
|
+
delivery: zod.z.literal("hosted").describe("Deploys the generated MCP server to Fern-hosted infrastructure."),
|
|
2483
|
+
slug: nonEmptyStringSchema.describe(
|
|
2484
|
+
"The server slug. The hosted URL is https://{organization}.fernmcp.dev/{slug}. May be an environment expression that resolves to the slug."
|
|
2485
|
+
)
|
|
2486
|
+
});
|
|
2487
|
+
var sdkConfigV1McpOutputConfigSchema = zod.z.discriminatedUnion(
|
|
2488
|
+
"delivery",
|
|
2489
|
+
[
|
|
2490
|
+
filesOutputSchema,
|
|
2491
|
+
zipOutputSchema,
|
|
2492
|
+
githubDeliverySchema,
|
|
2493
|
+
hostedOutputSchema,
|
|
2494
|
+
localAliasOutputSchema
|
|
2495
|
+
],
|
|
2496
|
+
{ error: 'output.delivery must be one of "files", "zip", "local", "github", or "hosted"' }
|
|
2453
2497
|
);
|
|
2454
2498
|
var cliDistributionShape = {
|
|
2455
2499
|
distribution: cliDistributionConfigSchema.optional().describe(
|
|
@@ -2470,9 +2514,10 @@ var sdkConfigV1CliOutputConfigSchema = zod.z.discriminatedUnion(
|
|
|
2470
2514
|
[
|
|
2471
2515
|
filesOutputSchema.extend(cliDistributionShape).superRefine(rejectDistributionWithoutGithub),
|
|
2472
2516
|
zipOutputSchema.extend(cliDistributionShape).superRefine(rejectDistributionWithoutGithub),
|
|
2473
|
-
githubDeliverySchema.extend(cliDistributionShape)
|
|
2517
|
+
githubDeliverySchema.extend(cliDistributionShape),
|
|
2518
|
+
localAliasOutputSchema.in.extend(cliDistributionShape).superRefine(rejectDistributionWithoutGithub).transform(normalizeLocalDelivery)
|
|
2474
2519
|
],
|
|
2475
|
-
{ error: 'output.delivery must be one of "files", "zip", or "github"' }
|
|
2520
|
+
{ error: 'output.delivery must be one of "files", "zip", "local", or "github"' }
|
|
2476
2521
|
);
|
|
2477
2522
|
var sdkConfigV1ReplayConfigSchema = zod.z.strictObject({
|
|
2478
2523
|
enabled: zod.z.boolean().describe("Whether regeneration reapplies customer-authored repository changes.")
|
|
@@ -2888,7 +2933,10 @@ var sdkConfigV1TargetSchema = zod.z.discriminatedUnion("language", [
|
|
|
2888
2933
|
zod.z.strictObject({
|
|
2889
2934
|
language: zod.z.literal("mcp").describe("Generates an MCP server."),
|
|
2890
2935
|
generation: sdkConfigV1GenerationConfigOverrideSchema.extend(mcpGenerationConfigSchema.shape).optional().describe("Common and MCP-specific generation settings for this target."),
|
|
2891
|
-
...targetOverrideShape
|
|
2936
|
+
...targetOverrideShape,
|
|
2937
|
+
output: sdkConfigV1McpOutputConfigSchema.optional().describe(
|
|
2938
|
+
"Output configuration, including Fern-hosted deployment, that replaces the root output for this target."
|
|
2939
|
+
)
|
|
2892
2940
|
}),
|
|
2893
2941
|
zod.z.strictObject({
|
|
2894
2942
|
language: zod.z.literal("terraform").describe("Generates a Terraform provider."),
|
|
@@ -2965,7 +3013,7 @@ function validateTargetPublishing(target, targetIndex, globalPackage, globalOutp
|
|
|
2965
3013
|
});
|
|
2966
3014
|
return;
|
|
2967
3015
|
}
|
|
2968
|
-
if (!output.publish) {
|
|
3016
|
+
if (output.delivery === "hosted" || !output.publish) {
|
|
2969
3017
|
return;
|
|
2970
3018
|
}
|
|
2971
3019
|
const registry = output.publish.registry;
|
|
@@ -3083,6 +3131,22 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
3083
3131
|
const docs = partitionSharedBlock(mapped.map(({ docs: docs2 }) => docs2));
|
|
3084
3132
|
const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
|
|
3085
3133
|
const api = { ...input.api ?? {} };
|
|
3134
|
+
const mcpBaseUrlIndex = mapped.findIndex(({ invocation }) => invocation.apiBaseUrl !== void 0);
|
|
3135
|
+
const mcpBaseUrl = mapped[mcpBaseUrlIndex]?.invocation.apiBaseUrl;
|
|
3136
|
+
const apiDiagnostics = [];
|
|
3137
|
+
if (mcpBaseUrl !== void 0) {
|
|
3138
|
+
if (api.baseUrl !== void 0 && api.baseUrl !== "" && api.baseUrl !== mcpBaseUrl) {
|
|
3139
|
+
apiDiagnostics.push({
|
|
3140
|
+
code: "FERN_MCP_BASE_URL_REPLACES_API_BASE_URL",
|
|
3141
|
+
severity: "warning",
|
|
3142
|
+
path: ["group", "generators", mcpBaseUrlIndex, "config", "baseUrl"],
|
|
3143
|
+
reason: `The MCP generator baseUrl "${mcpBaseUrl}" replaced the API base URL "${api.baseUrl}"`,
|
|
3144
|
+
sdkConfigPath: ["api", "baseUrl"],
|
|
3145
|
+
suggestedAction: "Check api.baseUrl in the migrated SDK Config. Remove the MCP baseUrl to keep the API base URL."
|
|
3146
|
+
});
|
|
3147
|
+
}
|
|
3148
|
+
api.baseUrl = mcpBaseUrl;
|
|
3149
|
+
}
|
|
3086
3150
|
delete api.audiences;
|
|
3087
3151
|
if (input.group.audiences.type === "select") {
|
|
3088
3152
|
api.audiences = [...input.group.audiences.audiences];
|
|
@@ -3183,10 +3247,13 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
3183
3247
|
const validatedSdkConfig = sdkConfig;
|
|
3184
3248
|
return {
|
|
3185
3249
|
sdkConfig: validatedSdkConfig,
|
|
3186
|
-
unsupportedFields:
|
|
3187
|
-
...
|
|
3188
|
-
...unsupportedFields
|
|
3189
|
-
|
|
3250
|
+
unsupportedFields: [
|
|
3251
|
+
...apiDiagnostics,
|
|
3252
|
+
...mapped.flatMap(({ invocation, unsupportedFields }) => [
|
|
3253
|
+
...invocation.unsupportedFields,
|
|
3254
|
+
...unsupportedFields
|
|
3255
|
+
])
|
|
3256
|
+
]
|
|
3190
3257
|
};
|
|
3191
3258
|
}
|
|
3192
3259
|
function withRustCratesPublishDefaults(packageConfig, { language, output, generator }) {
|
|
@@ -3319,6 +3386,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
3319
3386
|
...optional("smartCasingDigitWordBoundary", smartCasingDigitWordBoundary)
|
|
3320
3387
|
};
|
|
3321
3388
|
}
|
|
3389
|
+
const apiBaseUrl = language === "mcp" && activeLanguages.size === 1 ? takeString(config, ["baseUrl"], state, [...prefix, "config"]) : void 0;
|
|
3322
3390
|
const targetGeneration = mapLanguageConfig(
|
|
3323
3391
|
language,
|
|
3324
3392
|
config,
|
|
@@ -3363,6 +3431,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
3363
3431
|
package: packageConfig,
|
|
3364
3432
|
packageFallbacks: state.packageFallbacks ?? [],
|
|
3365
3433
|
...optional("cliDistribution", state.cliDistribution),
|
|
3434
|
+
...optional("apiBaseUrl", apiBaseUrl),
|
|
3366
3435
|
targetGeneration,
|
|
3367
3436
|
unsupportedFields
|
|
3368
3437
|
};
|
|
@@ -4650,6 +4719,14 @@ var zipOutputSchema2 = zod.z.strictObject({
|
|
|
4650
4719
|
...distributionShape,
|
|
4651
4720
|
...credentialResolutionShape
|
|
4652
4721
|
});
|
|
4722
|
+
var localAliasOutputSchema2 = zipOutputSchema2.extend({
|
|
4723
|
+
delivery: zod.z.literal("local").describe('Alias of "zip": the package on the local machine.')
|
|
4724
|
+
}).transform(
|
|
4725
|
+
(output) => ({
|
|
4726
|
+
...output,
|
|
4727
|
+
delivery: "zip"
|
|
4728
|
+
})
|
|
4729
|
+
);
|
|
4653
4730
|
var githubDeliverySchema2 = zod.z.strictObject({
|
|
4654
4731
|
delivery: zod.z.literal("github").describe("Delivers the generated SDK to GitHub."),
|
|
4655
4732
|
github: githubOutputSchema2.describe("GitHub repository delivery settings."),
|
|
@@ -4659,9 +4736,9 @@ var githubDeliverySchema2 = zod.z.strictObject({
|
|
|
4659
4736
|
});
|
|
4660
4737
|
var outputConfigSchema = zod.z.discriminatedUnion(
|
|
4661
4738
|
"delivery",
|
|
4662
|
-
[filesOutputSchema2, zipOutputSchema2, githubDeliverySchema2],
|
|
4739
|
+
[filesOutputSchema2, zipOutputSchema2, githubDeliverySchema2, localAliasOutputSchema2],
|
|
4663
4740
|
{
|
|
4664
|
-
error: 'output.delivery must be one of "files", "zip", or "github"'
|
|
4741
|
+
error: 'output.delivery must be one of "files", "zip", "local", or "github"'
|
|
4665
4742
|
}
|
|
4666
4743
|
);
|
|
4667
4744
|
var replayConfigSchema = zod.z.strictObject({
|
|
@@ -5010,6 +5087,7 @@ exports.sdkConfigV1GoModulePathSchema = goModulePathSchema;
|
|
|
5010
5087
|
exports.sdkConfigV1JavaGenerationConfigSchema = javaGenerationConfigSchema;
|
|
5011
5088
|
exports.sdkConfigV1KotlinGenerationConfigSchema = kotlinGenerationConfigSchema;
|
|
5012
5089
|
exports.sdkConfigV1McpGenerationConfigSchema = mcpGenerationConfigSchema;
|
|
5090
|
+
exports.sdkConfigV1McpOutputConfigSchema = sdkConfigV1McpOutputConfigSchema;
|
|
5013
5091
|
exports.sdkConfigV1NonEmptyStringSchema = nonEmptyStringSchema;
|
|
5014
5092
|
exports.sdkConfigV1OutputConfigSchema = sdkConfigV1OutputConfigSchema;
|
|
5015
5093
|
exports.sdkConfigV1PackageConfigSchema = sdkConfigV1PackageConfigSchema;
|