@postman/sdk-config 0.16.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 +139 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +133 -24
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +127 -23
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.d.cts +2 -2
- package/dist/sdk-config/index.d.ts +2 -2
- package/dist/sdk-config/index.js +123 -24
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +127 -23
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +922 -504
- package/dist/sdk-config/v1/index.d.ts +922 -504
- package/dist/sdk-config/v1/index.js +123 -24
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +18 -1
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.d.cts +2 -2
- package/dist/sdk-config-ir/index.d.ts +2 -2
- package/dist/sdk-config-ir/index.js +17 -2
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +18 -1
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +22 -3
- package/dist/sdk-config-ir/v1/index.d.ts +22 -3
- package/dist/sdk-config-ir/v1/index.js +17 -2
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-Cc50beVo.d.cts → typescript-D0YeGxxS.d.cts} +6 -1
- package/dist/{typescript-Cc50beVo.d.ts → typescript-D0YeGxxS.d.ts} +6 -1
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +53 -0
- package/src/sdk-config-ir/v1/README.md +7 -0
|
@@ -13,6 +13,10 @@ var relativePathSchema = nonEmptyStringSchema.refine(
|
|
|
13
13
|
(value) => !/^(?:[\\/]|[A-Za-z]:)/.test(value) && !value.split(/[\\/]/).some((segment) => segment === ".."),
|
|
14
14
|
{ message: "must be a relative path without parent directory segments" }
|
|
15
15
|
);
|
|
16
|
+
var parentRelativePathSchema = nonEmptyStringSchema.refine(
|
|
17
|
+
(value) => !/^(?:[\\/]|[A-Za-z]:)/.test(value),
|
|
18
|
+
{ message: "must be a relative path" }
|
|
19
|
+
);
|
|
16
20
|
var exactSemverSchema = zod.z.string().refine(
|
|
17
21
|
(value) => {
|
|
18
22
|
if (value.trim() !== value || !/^\d/.test(value)) {
|
|
@@ -1118,6 +1122,27 @@ function mapOutput(generator, language, index) {
|
|
|
1118
1122
|
language
|
|
1119
1123
|
);
|
|
1120
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
|
+
}
|
|
1121
1146
|
if (!isObject(generator.outputMode) || typeof generator.outputMode.type !== "string") {
|
|
1122
1147
|
fail(
|
|
1123
1148
|
"FERN_OUTPUT_REQUIRED",
|
|
@@ -2435,6 +2460,17 @@ var sdkConfigV1OutputConfigSchema = zod.z.discriminatedUnion(
|
|
|
2435
2460
|
[filesOutputSchema, zipOutputSchema, githubDeliverySchema],
|
|
2436
2461
|
{ error: 'output.delivery must be one of "files", "zip", or "github"' }
|
|
2437
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
|
+
);
|
|
2438
2474
|
var cliDistributionShape = {
|
|
2439
2475
|
distribution: cliDistributionConfigSchema.optional().describe(
|
|
2440
2476
|
"CLI release channels and build attestation settings for the generated release workflow; credentials are GitHub Actions secret names."
|
|
@@ -2488,7 +2524,8 @@ var apiImportSettingsSchema = zod.z.strictObject({
|
|
|
2488
2524
|
),
|
|
2489
2525
|
resolveSchemaCollisions: zod.z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
|
|
2490
2526
|
asyncApiMessageNaming: zod.z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
|
|
2491
|
-
defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one.")
|
|
2527
|
+
defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one."),
|
|
2528
|
+
respectByteFormat: zod.z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
|
|
2492
2529
|
});
|
|
2493
2530
|
var sourceSpecTypeSchema = zod.z.enum([
|
|
2494
2531
|
"openapi",
|
|
@@ -2499,28 +2536,66 @@ var sourceSpecTypeSchema = zod.z.enum([
|
|
|
2499
2536
|
]);
|
|
2500
2537
|
|
|
2501
2538
|
// src/sdk-config/v1/source.ts
|
|
2502
|
-
var
|
|
2539
|
+
var commonSourceSpecShape = {
|
|
2503
2540
|
id: nonEmptyStringSchema.describe("A unique identifier for this API source."),
|
|
2504
|
-
type: sourceSpecTypeSchema.describe("The API description format of this source."),
|
|
2505
2541
|
name: nonEmptyStringSchema.optional().describe("A human-readable name for this API source."),
|
|
2506
2542
|
namespace: nonEmptyStringSchema.optional().describe("A namespace used to isolate this source in a multi-source SDK."),
|
|
2507
|
-
apiImportSettings: apiImportSettingsSchema.optional().describe("Import behavior that overrides the source-level defaults for this spec.")
|
|
2543
|
+
apiImportSettings: apiImportSettingsSchema.optional().describe("Import behavior that overrides the source-level defaults for this spec.")
|
|
2544
|
+
};
|
|
2545
|
+
var sourceSpecShape = {
|
|
2546
|
+
...commonSourceSpecShape,
|
|
2547
|
+
type: sourceSpecTypeSchema.describe("The API description format of this source."),
|
|
2508
2548
|
overlays: zod.z.array(relativePathSchema).optional().describe("Relative paths to overlays applied to this source in order."),
|
|
2509
2549
|
overrides: zod.z.array(relativePathSchema).optional().describe("Relative paths to source override files applied in order.")
|
|
2510
2550
|
};
|
|
2511
|
-
var
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2551
|
+
var sdkConfigV1GitRemoteSchema = zod.z.strictObject({
|
|
2552
|
+
repo: nonEmptyStringSchema.describe("The git repository URL."),
|
|
2553
|
+
ref: nonEmptyStringSchema.optional().describe("The branch, tag, or commit SHA. Defaults to the repository's default branch."),
|
|
2554
|
+
path: relativePathSchema.describe("The path to the directory within the repository.")
|
|
2555
|
+
});
|
|
2556
|
+
var sdkConfigV1ProtobufRootSchema = zod.z.union([
|
|
2557
|
+
parentRelativePathSchema.describe("The relative path to the .proto directory root."),
|
|
2558
|
+
zod.z.strictObject({
|
|
2559
|
+
git: sdkConfigV1GitRemoteSchema.describe("The git remote holding the .proto files.")
|
|
2560
|
+
}).describe("A .proto directory root in a remote git repository.")
|
|
2561
|
+
]);
|
|
2562
|
+
var sdkConfigV1ProtobufSourceSchema = zod.z.strictObject({
|
|
2563
|
+
root: sdkConfigV1ProtobufRootSchema.describe(
|
|
2564
|
+
"The .proto directory root, as a relative path or a git remote."
|
|
2565
|
+
),
|
|
2566
|
+
target: parentRelativePathSchema.optional().describe("The relative path to the single .proto file that defines the API."),
|
|
2567
|
+
overrides: zod.z.array(parentRelativePathSchema).optional().describe("Relative paths to override files applied to the converted API in order."),
|
|
2568
|
+
dependencies: zod.z.array(nonEmptyStringSchema).optional().describe("Buf Schema Registry modules the .proto files depend on."),
|
|
2569
|
+
localGeneration: zod.z.boolean().optional().describe("Whether the .proto files are compiled locally instead of remotely."),
|
|
2570
|
+
fromOpenApi: zod.z.boolean().default(false).describe("Whether SDKs are generated from the OpenAPI converted from the .proto files.")
|
|
2571
|
+
});
|
|
2572
|
+
var sourceSpecOptions = [
|
|
2573
|
+
zod.z.strictObject({
|
|
2574
|
+
...sourceSpecShape,
|
|
2575
|
+
path: relativePathSchema.describe("The relative path to the API source file.")
|
|
2576
|
+
}),
|
|
2577
|
+
zod.z.strictObject({
|
|
2578
|
+
...sourceSpecShape,
|
|
2579
|
+
url: zod.z.url({ protocol: /^https?$/ }).describe("The HTTP or HTTPS URL of the API source file.")
|
|
2580
|
+
}),
|
|
2581
|
+
zod.z.strictObject({
|
|
2582
|
+
...commonSourceSpecShape,
|
|
2583
|
+
proto: sdkConfigV1ProtobufSourceSchema.describe("The protobuf definitions of this source.")
|
|
2584
|
+
})
|
|
2585
|
+
];
|
|
2586
|
+
var protobufSourceSpecOptionIndex = 2;
|
|
2587
|
+
function hasProtoLocator(input) {
|
|
2588
|
+
return typeof input === "object" && input !== null && "proto" in input;
|
|
2589
|
+
}
|
|
2590
|
+
var sdkConfigV1SourceSpecSchema = zod.z.union(sourceSpecOptions, {
|
|
2591
|
+
error: (issue) => {
|
|
2592
|
+
if (issue.code !== "invalid_union" || !hasProtoLocator(issue.input)) {
|
|
2593
|
+
return "source spec must contain exactly one locator: path, HTTP(S) url, or proto";
|
|
2594
|
+
}
|
|
2595
|
+
const details = (issue.errors[protobufSourceSpecOptionIndex] ?? []).map(({ path, message }) => path.length ? `${path.join(".")}: ${message}` : message).join("; ");
|
|
2596
|
+
return `protobuf source spec is invalid: ${details}`;
|
|
2597
|
+
}
|
|
2598
|
+
});
|
|
2524
2599
|
var sdkConfigV1SourceConfigSchema = zod.z.strictObject({
|
|
2525
2600
|
specs: zod.z.array(sdkConfigV1SourceSpecSchema).min(1, "source.specs must contain at least one source spec").describe("API source files in authoritative processing order."),
|
|
2526
2601
|
apiImportSettings: apiImportSettingsSchema.optional().describe("Default import behavior shared by every source spec.")
|
|
@@ -2833,7 +2908,10 @@ var sdkConfigV1TargetSchema = zod.z.discriminatedUnion("language", [
|
|
|
2833
2908
|
zod.z.strictObject({
|
|
2834
2909
|
language: zod.z.literal("mcp").describe("Generates an MCP server."),
|
|
2835
2910
|
generation: sdkConfigV1GenerationConfigOverrideSchema.extend(mcpGenerationConfigSchema.shape).optional().describe("Common and MCP-specific generation settings for this target."),
|
|
2836
|
-
...targetOverrideShape
|
|
2911
|
+
...targetOverrideShape,
|
|
2912
|
+
output: sdkConfigV1McpOutputConfigSchema.optional().describe(
|
|
2913
|
+
"Output configuration, including Fern-hosted deployment, that replaces the root output for this target."
|
|
2914
|
+
)
|
|
2837
2915
|
}),
|
|
2838
2916
|
zod.z.strictObject({
|
|
2839
2917
|
language: zod.z.literal("terraform").describe("Generates a Terraform provider."),
|
|
@@ -2910,7 +2988,7 @@ function validateTargetPublishing(target, targetIndex, globalPackage, globalOutp
|
|
|
2910
2988
|
});
|
|
2911
2989
|
return;
|
|
2912
2990
|
}
|
|
2913
|
-
if (!output.publish) {
|
|
2991
|
+
if (output.delivery === "hosted" || !output.publish) {
|
|
2914
2992
|
return;
|
|
2915
2993
|
}
|
|
2916
2994
|
const registry = output.publish.registry;
|
|
@@ -3028,6 +3106,22 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
3028
3106
|
const docs = partitionSharedBlock(mapped.map(({ docs: docs2 }) => docs2));
|
|
3029
3107
|
const generations = partitionSharedBlock(mapped.map(({ invocation }) => invocation.generation));
|
|
3030
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
|
+
}
|
|
3031
3125
|
delete api.audiences;
|
|
3032
3126
|
if (input.group.audiences.type === "select") {
|
|
3033
3127
|
api.audiences = [...input.group.audiences.audiences];
|
|
@@ -3128,10 +3222,13 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
3128
3222
|
const validatedSdkConfig = sdkConfig;
|
|
3129
3223
|
return {
|
|
3130
3224
|
sdkConfig: validatedSdkConfig,
|
|
3131
|
-
unsupportedFields:
|
|
3132
|
-
...
|
|
3133
|
-
...unsupportedFields
|
|
3134
|
-
|
|
3225
|
+
unsupportedFields: [
|
|
3226
|
+
...apiDiagnostics,
|
|
3227
|
+
...mapped.flatMap(({ invocation, unsupportedFields }) => [
|
|
3228
|
+
...invocation.unsupportedFields,
|
|
3229
|
+
...unsupportedFields
|
|
3230
|
+
])
|
|
3231
|
+
]
|
|
3135
3232
|
};
|
|
3136
3233
|
}
|
|
3137
3234
|
function withRustCratesPublishDefaults(packageConfig, { language, output, generator }) {
|
|
@@ -3264,6 +3361,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
3264
3361
|
...optional("smartCasingDigitWordBoundary", smartCasingDigitWordBoundary)
|
|
3265
3362
|
};
|
|
3266
3363
|
}
|
|
3364
|
+
const apiBaseUrl = language === "mcp" && activeLanguages.size === 1 ? takeString(config, ["baseUrl"], state, [...prefix, "config"]) : void 0;
|
|
3267
3365
|
const targetGeneration = mapLanguageConfig(
|
|
3268
3366
|
language,
|
|
3269
3367
|
config,
|
|
@@ -3308,6 +3406,7 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
3308
3406
|
package: packageConfig,
|
|
3309
3407
|
packageFallbacks: state.packageFallbacks ?? [],
|
|
3310
3408
|
...optional("cliDistribution", state.cliDistribution),
|
|
3409
|
+
...optional("apiBaseUrl", apiBaseUrl),
|
|
3311
3410
|
targetGeneration,
|
|
3312
3411
|
unsupportedFields
|
|
3313
3412
|
};
|
|
@@ -4250,16 +4349,21 @@ exports.sdkConfigV1DocsConfigSchema = sdkConfigV1DocsConfigSchema;
|
|
|
4250
4349
|
exports.sdkConfigV1ExactSemverSchema = exactSemverSchema;
|
|
4251
4350
|
exports.sdkConfigV1GenerationConfigOverrideSchema = sdkConfigV1GenerationConfigOverrideSchema;
|
|
4252
4351
|
exports.sdkConfigV1GenerationConfigSchema = sdkConfigV1GenerationConfigSchema;
|
|
4352
|
+
exports.sdkConfigV1GitRemoteSchema = sdkConfigV1GitRemoteSchema;
|
|
4253
4353
|
exports.sdkConfigV1GithubActionsSecretNameSchema = githubActionsSecretNameSchema;
|
|
4254
4354
|
exports.sdkConfigV1GoGenerationConfigSchema = goGenerationConfigSchema;
|
|
4255
4355
|
exports.sdkConfigV1GoModulePathSchema = goModulePathSchema;
|
|
4256
4356
|
exports.sdkConfigV1JavaGenerationConfigSchema = javaGenerationConfigSchema;
|
|
4257
4357
|
exports.sdkConfigV1KotlinGenerationConfigSchema = kotlinGenerationConfigSchema;
|
|
4258
4358
|
exports.sdkConfigV1McpGenerationConfigSchema = mcpGenerationConfigSchema;
|
|
4359
|
+
exports.sdkConfigV1McpOutputConfigSchema = sdkConfigV1McpOutputConfigSchema;
|
|
4259
4360
|
exports.sdkConfigV1NonEmptyStringSchema = nonEmptyStringSchema;
|
|
4260
4361
|
exports.sdkConfigV1OutputConfigSchema = sdkConfigV1OutputConfigSchema;
|
|
4261
4362
|
exports.sdkConfigV1PackageConfigSchema = sdkConfigV1PackageConfigSchema;
|
|
4363
|
+
exports.sdkConfigV1ParentRelativePathSchema = parentRelativePathSchema;
|
|
4262
4364
|
exports.sdkConfigV1PhpGenerationConfigSchema = phpGenerationConfigSchema;
|
|
4365
|
+
exports.sdkConfigV1ProtobufRootSchema = sdkConfigV1ProtobufRootSchema;
|
|
4366
|
+
exports.sdkConfigV1ProtobufSourceSchema = sdkConfigV1ProtobufSourceSchema;
|
|
4263
4367
|
exports.sdkConfigV1PublishConfigSchema = sdkConfigV1PublishConfigSchema;
|
|
4264
4368
|
exports.sdkConfigV1PublishRegistrySchema = sdkConfigV1PublishRegistrySchema;
|
|
4265
4369
|
exports.sdkConfigV1PythonGenerationConfigSchema = pythonGenerationConfigSchema;
|