@postman/sdk-config 0.21.0 → 0.23.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 +196 -253
- 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 +196 -254
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +195 -253
- 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 +195 -253
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +195 -253
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +20 -767
- package/dist/sdk-config/v1/index.d.ts +20 -767
- package/dist/sdk-config/v1/index.js +195 -253
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +26 -150
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.d.cts +1 -1
- package/dist/sdk-config-ir/index.d.ts +1 -1
- package/dist/sdk-config-ir/index.js +26 -151
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +26 -150
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +29 -446
- package/dist/sdk-config-ir/v1/index.d.ts +29 -446
- package/dist/sdk-config-ir/v1/index.js +26 -151
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-DNic6Rq5.d.cts → typescript-ZRqfOhMd.d.cts} +23 -21
- package/dist/{typescript-DNic6Rq5.d.ts → typescript-ZRqfOhMd.d.ts} +23 -21
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +12 -24
- package/src/sdk-config-ir/v1/README.md +0 -39
|
@@ -700,6 +700,121 @@ var docsConfigSchema = zod.z.strictObject({
|
|
|
700
700
|
var sdkConfigV1ReadmeEndpointSchema = readmeEndpointSchema;
|
|
701
701
|
var sdkConfigV1ReadmeCustomSectionSchema = readmeCustomSectionSchema;
|
|
702
702
|
var sdkConfigV1DocsConfigSchema = docsConfigSchema;
|
|
703
|
+
var compilerOptionsSchema = zod.z.strictObject({
|
|
704
|
+
target: nonEmptyStringSchema.optional().describe("The JavaScript language target passed to TypeScript."),
|
|
705
|
+
module: nonEmptyStringSchema.optional().describe("The module format passed to TypeScript."),
|
|
706
|
+
lib: zod.z.array(nonEmptyStringSchema).optional().describe("The runtime library definitions passed to TypeScript.")
|
|
707
|
+
});
|
|
708
|
+
var packageScriptSchema = zod.z.strictObject({
|
|
709
|
+
name: nonEmptyStringSchema.describe("The package script name."),
|
|
710
|
+
command: nonEmptyStringSchema.describe("The command executed by the package script.")
|
|
711
|
+
});
|
|
712
|
+
var httpClientSchema = zod.z.strictObject({
|
|
713
|
+
name: zod.z.enum(["axios", "fetch", "node-fetch"]).describe("The HTTP client used by generated TypeScript code.")
|
|
714
|
+
});
|
|
715
|
+
var typescriptGenerationConfigSchema = zod.z.strictObject({
|
|
716
|
+
typescriptVersion: nonEmptyStringSchema.optional().describe("The TypeScript version used by the generated project."),
|
|
717
|
+
zodVersion: nonEmptyStringSchema.optional().describe("The Zod version used by generated runtime schemas."),
|
|
718
|
+
compilerOptions: compilerOptionsSchema.optional().describe("TypeScript compiler options for the generated project."),
|
|
719
|
+
httpClient: httpClientSchema.optional().describe("The HTTP client used by generated TypeScript code."),
|
|
720
|
+
packageManager: zod.z.enum(["pnpm", "yarn"]).optional().describe("The package manager used by the generated project."),
|
|
721
|
+
packageManagerVersion: nonEmptyStringSchema.optional().describe("The package manager version used by the generated project."),
|
|
722
|
+
testFramework: zod.z.enum(["jest", "vitest"]).optional().describe("The test framework used by generated tests."),
|
|
723
|
+
namingStrategy: zod.z.enum(["base", "originalPropertyNames"]).optional().describe("How schema property names are converted into TypeScript identifiers."),
|
|
724
|
+
bundle: zod.z.boolean().optional().describe("Whether the generated package includes bundled output."),
|
|
725
|
+
exportClassDefault: zod.z.boolean().optional().describe("Whether the client class is also exported as the default export."),
|
|
726
|
+
/** Name of the top-level namespace export emitted by Fern-compatible TypeScript SDKs. */
|
|
727
|
+
namespaceExportName: nonEmptyStringSchema.optional().describe("The top-level namespace export name."),
|
|
728
|
+
consolidateTypeFiles: zod.z.boolean().optional().describe("Whether generated types are consolidated into fewer source files."),
|
|
729
|
+
formDataSupport: zod.z.enum(["Node16", "Node18"]).optional().describe(
|
|
730
|
+
"The multipart form-data implementation: Node16 uses the form-data packages, Node18 uses the platform FormData."
|
|
731
|
+
),
|
|
732
|
+
allowExtraFields: zod.z.boolean().optional().describe(
|
|
733
|
+
"Whether response parsing keeps unrecognized object keys and accepts unrecognized union members and enum values."
|
|
734
|
+
),
|
|
735
|
+
generateSubpackageExports: zod.z.boolean().optional().describe(
|
|
736
|
+
"Whether the package manifest exports each subpackage client as its own entry point."
|
|
737
|
+
),
|
|
738
|
+
exportAllRequestsAtRoot: zod.z.boolean().optional().describe("Whether every request type is also exported from the package root."),
|
|
739
|
+
generateEndpointMetadata: zod.z.boolean().optional().describe("Whether generated clients expose metadata for each endpoint."),
|
|
740
|
+
outputEsm: zod.z.boolean().optional().describe(
|
|
741
|
+
"Whether the package is marked as an ES module while still shipping its CommonJS build."
|
|
742
|
+
),
|
|
743
|
+
neverThrowErrors: zod.z.boolean().optional().describe(
|
|
744
|
+
"Whether client methods return a wrapped response instead of throwing on a non-2xx status."
|
|
745
|
+
),
|
|
746
|
+
includeOtherInUnionTypes: zod.z.boolean().optional().describe("Whether union types gain a member for variants the SDK does not recognize."),
|
|
747
|
+
includeUtilsOnUnionMembers: zod.z.boolean().optional().describe("Whether helper utilities are generated on each member of a union type."),
|
|
748
|
+
omitFernHeaders: zod.z.boolean().optional().describe("Whether requests omit the SDK identification headers and the User-Agent header."),
|
|
749
|
+
linter: zod.z.enum(["biome", "oxlint", "none"]).optional().describe("The linter configured in the generated project."),
|
|
750
|
+
formatter: zod.z.enum(["prettier", "biome", "oxfmt", "none"]).optional().describe("The formatter configured in the generated project."),
|
|
751
|
+
exports: jsonObjectSchema.optional().describe(
|
|
752
|
+
"package.json exports entries, keyed by subpath, applied over the generated exports. Each subpath replaces the generated one."
|
|
753
|
+
),
|
|
754
|
+
files: zod.z.array(nonEmptyStringSchema).optional().describe("package.json files entries, listed ahead of the generated ones."),
|
|
755
|
+
engines: zod.z.record(nonEmptyStringSchema, nonEmptyStringSchema).optional().describe("package.json engines version ranges, keyed by engine name such as node."),
|
|
756
|
+
lintStaged: zod.z.record(nonEmptyStringSchema, zod.z.array(nonEmptyStringSchema).min(1)).optional().describe("lint-staged commands to run, keyed by file glob."),
|
|
757
|
+
browser: zod.z.record(nonEmptyStringSchema, zod.z.union([zod.z.boolean(), nonEmptyStringSchema])).optional().describe(
|
|
758
|
+
"package.json browser field: a module or file is excluded (false) or replaced by another path."
|
|
759
|
+
),
|
|
760
|
+
allowCustomFetcher: zod.z.boolean().optional().describe("Whether callers can supply a custom fetch implementation."),
|
|
761
|
+
useBrandedStringAliases: zod.z.boolean().optional().describe("Whether string aliases are emitted as distinct branded types."),
|
|
762
|
+
useLegacyExports: zod.z.boolean().optional().describe("Whether the package emits the legacy export layout."),
|
|
763
|
+
useBigInt: zod.z.boolean().optional().describe("Whether 64-bit integer values are represented with bigint."),
|
|
764
|
+
serdeLayer: zod.z.boolean().optional().describe("Whether generated models use Fern serialization and deserialization helpers."),
|
|
765
|
+
/** Ship only the ESM build (drops CJS) to avoid the Node dual-package hazard. */
|
|
766
|
+
esmOnly: zod.z.boolean().optional().describe("Whether the package emits only ECMAScript modules."),
|
|
767
|
+
scripts: zod.z.array(packageScriptSchema).optional().describe("Additional scripts added to the generated package manifest.")
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
// src/sdk-config-domain/v1/language/mcp.ts
|
|
771
|
+
var mcpAvailabilityStatuses = [
|
|
772
|
+
"IN_DEVELOPMENT",
|
|
773
|
+
"PRE_RELEASE",
|
|
774
|
+
"GENERAL_AVAILABILITY",
|
|
775
|
+
"DEPRECATED",
|
|
776
|
+
"ALPHA",
|
|
777
|
+
"BETA",
|
|
778
|
+
"PREVIEW",
|
|
779
|
+
"LEGACY"
|
|
780
|
+
];
|
|
781
|
+
var mcpToolFilterSchema = zod.z.strictObject({
|
|
782
|
+
include: zod.z.array(nonEmptyStringSchema).optional().describe("Operations explicitly included as MCP tools."),
|
|
783
|
+
exclude: zod.z.array(nonEmptyStringSchema).optional().describe("Operations explicitly excluded from MCP tools.")
|
|
784
|
+
});
|
|
785
|
+
var mcpToolsetNameSchema = nonEmptyStringSchema.refine(
|
|
786
|
+
(name) => name !== "default" && /^[a-z0-9-]+$/.test(name),
|
|
787
|
+
'toolset names must match [a-z0-9-]+ and cannot be "default"'
|
|
788
|
+
);
|
|
789
|
+
var MCP_TOOL_NAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
790
|
+
var mcpToolNameSchema = nonEmptyStringSchema.refine(
|
|
791
|
+
(name) => MCP_TOOL_NAME_PATTERN.test(name),
|
|
792
|
+
"tool names must match [a-zA-Z0-9_-]{1,64}"
|
|
793
|
+
);
|
|
794
|
+
var mcpMergedToolSchema = mcpToolFilterSchema.extend({
|
|
795
|
+
dispatchOn: nonEmptyStringSchema.describe(
|
|
796
|
+
"The tool argument whose value selects which member operation to call."
|
|
797
|
+
),
|
|
798
|
+
description: nonEmptyStringSchema.optional().describe("Overrides the generated description of the merged tool.")
|
|
799
|
+
});
|
|
800
|
+
var mcpCustomToolSchema = zod.z.strictObject({
|
|
801
|
+
path: relativePathSchema.describe(
|
|
802
|
+
"Path to a TypeScript module that exports the tool `definition` and `handler`."
|
|
803
|
+
)
|
|
804
|
+
});
|
|
805
|
+
var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
|
|
806
|
+
serverName: nonEmptyStringSchema.optional().describe("The name advertised by the generated MCP server."),
|
|
807
|
+
serverDescription: nonEmptyStringSchema.optional().describe("The description advertised by the generated MCP server."),
|
|
808
|
+
excludeAvailability: zod.z.array(zod.z.enum(mcpAvailabilityStatuses)).optional().describe("Operation availability statuses excluded from MCP tool generation."),
|
|
809
|
+
tools: mcpToolFilterSchema.optional().describe("Global operation filters for generated MCP tools."),
|
|
810
|
+
toolsets: zod.z.record(mcpToolsetNameSchema, mcpToolFilterSchema).optional().describe("Named MCP toolsets and the operation filters for each toolset."),
|
|
811
|
+
mergedTools: zod.z.record(mcpToolNameSchema, mcpMergedToolSchema).optional().describe(
|
|
812
|
+
"Tools that fan several operations into one, dispatching on an argument. Each entry selects its member operations with the same include/exclude filter as `tools`."
|
|
813
|
+
),
|
|
814
|
+
customTools: zod.z.record(mcpToolNameSchema, mcpCustomToolSchema).optional().describe(
|
|
815
|
+
"Hand-written tools, keyed by tool name, each pointing at a TypeScript module that exports its `definition` and `handler`. Emitted alongside the operation-derived tools."
|
|
816
|
+
)
|
|
817
|
+
});
|
|
703
818
|
|
|
704
819
|
// src/sdk-config/v1/fern-config-mapper-types.ts
|
|
705
820
|
var FernConfigMappingError = class extends Error {
|
|
@@ -967,28 +1082,6 @@ function fieldNameMapSchema(field) {
|
|
|
967
1082
|
}
|
|
968
1083
|
});
|
|
969
1084
|
}
|
|
970
|
-
var SAFE_TEXT_PATTERN = /^[^"\\\x00-\x1f]*$/;
|
|
971
|
-
var HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/;
|
|
972
|
-
var provisionFlagSchema = zod.z.string().regex(KEBAB_NAME_PATTERN, {
|
|
973
|
-
message: 'profiles.provisionOperation.flag must be a kebab-case flag name without dashes, such as "api-key"'
|
|
974
|
-
});
|
|
975
|
-
var provisionParametersSchema = zod.z.record(zod.z.string(), zod.z.string()).superRefine((value, context) => {
|
|
976
|
-
for (const [key, text] of Object.entries(value)) {
|
|
977
|
-
if (!FIELD_NAME_PATTERN.test(key)) {
|
|
978
|
-
context.addIssue({
|
|
979
|
-
code: "custom",
|
|
980
|
-
message: "profiles.provisionOperation.parameters keys must be field names containing only [A-Za-z0-9_.-]",
|
|
981
|
-
path: [key]
|
|
982
|
-
});
|
|
983
|
-
} else if (!SAFE_TEXT_PATTERN.test(text)) {
|
|
984
|
-
context.addIssue({
|
|
985
|
-
code: "custom",
|
|
986
|
-
message: "profiles.provisionOperation.parameters values must not contain quotes, backslashes or control characters",
|
|
987
|
-
path: [key]
|
|
988
|
-
});
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
});
|
|
992
1085
|
var profilesProvisionOperationSchema = zod.z.strictObject({
|
|
993
1086
|
operation: dottedCommandPathSchema("profiles.provisionOperation.operation").describe(
|
|
994
1087
|
"The dotted command path of the operation that mints a profile credential."
|
|
@@ -996,16 +1089,7 @@ var profilesProvisionOperationSchema = zod.z.strictObject({
|
|
|
996
1089
|
credential: fieldNameMapSchema("profiles.provisionOperation.credential").refine((value) => Object.keys(value).length > 0, {
|
|
997
1090
|
message: "profiles.provisionOperation.credential must map at least one credential field"
|
|
998
1091
|
}).describe("Maps each stored credential field to the response field that supplies it."),
|
|
999
|
-
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it.")
|
|
1000
|
-
flag: provisionFlagSchema.optional().describe(
|
|
1001
|
-
'The long name of the "profiles create" flag, without "--". The generator defaults it to "provision", which stays accepted as a hidden alias.'
|
|
1002
|
-
),
|
|
1003
|
-
parameters: provisionParametersSchema.optional().describe(
|
|
1004
|
-
"Extra request values sent with the operation. {cli}, {profile}, {user} and {host} are substituted; a value the profile sets wins."
|
|
1005
|
-
),
|
|
1006
|
-
profileParameters: fieldNameMapSchema("profiles.provisionOperation.profileParameters").optional().describe(
|
|
1007
|
-
"Maps each profile parameter to the typed credential field it is copied from, so requests keep it once the credential is replaced by the provisioned key."
|
|
1008
|
-
)
|
|
1092
|
+
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it.")
|
|
1009
1093
|
});
|
|
1010
1094
|
var profilesConfigSchema = zod.z.strictObject({
|
|
1011
1095
|
enabled: zod.z.boolean().describe("Whether the CLI emits profile commands and the global --profile flag."),
|
|
@@ -1013,24 +1097,6 @@ var profilesConfigSchema = zod.z.strictObject({
|
|
|
1013
1097
|
revokeOperation: dottedCommandPathSchema("profiles.revokeOperation").optional().describe('The dotted command path called by "profiles remove --revoke".'),
|
|
1014
1098
|
provisionOperation: profilesProvisionOperationSchema.optional().describe('The operation called by "profiles create --provision" and its response mapping.')
|
|
1015
1099
|
});
|
|
1016
|
-
var bannerColorsSchema = (field) => zod.z.array(
|
|
1017
|
-
zod.z.string().regex(HEX_COLOR_PATTERN, {
|
|
1018
|
-
message: `banner.${field} must hold 6-digit hex colours such as "#4949F2"`
|
|
1019
|
-
})
|
|
1020
|
-
);
|
|
1021
|
-
var bannerObjectSchema = zod.z.strictObject({
|
|
1022
|
-
text: nonEmptyStringSchema.describe("The banner text. May span several lines."),
|
|
1023
|
-
colors: bannerColorsSchema("colors").optional().describe("One colour for a solid banner, or several for a gradient along the direction."),
|
|
1024
|
-
lineColors: bannerColorsSchema("lineColors").optional().describe("One colour per line of the banner. Exclusive with colors."),
|
|
1025
|
-
direction: zod.z.enum(["horizontal", "vertical", "diagonal"]).optional().describe("The direction of the gradient. The generator defaults to horizontal."),
|
|
1026
|
-
animate: zod.z.boolean().optional().describe(
|
|
1027
|
-
"Whether root --help on an interactive terminal plays a short shimmer across the banner before printing it."
|
|
1028
|
-
)
|
|
1029
|
-
}).refine((banner) => banner.colors === void 0 || banner.lineColors === void 0, {
|
|
1030
|
-
message: "banner must set either colors (a gradient) or lineColors (one colour per line), not both",
|
|
1031
|
-
path: ["lineColors"]
|
|
1032
|
-
});
|
|
1033
|
-
var bannerSchema = zod.z.union([nonEmptyStringSchema, bannerObjectSchema]);
|
|
1034
1100
|
var oauthPropertyPathSchema = zod.z.string().regex(FIELD_NAME_PATTERN, {
|
|
1035
1101
|
message: 'must be a property name, or a dotted path to a nested property, such as "data.token"'
|
|
1036
1102
|
}).regex(/^[^.]+(\.[^.]+)*$/, { message: "must not have an empty path segment" });
|
|
@@ -1100,9 +1166,6 @@ var cliGenerationConfigSchema = zod.z.strictObject({
|
|
|
1100
1166
|
profiles: profilesConfigSchema.optional().describe("Named profile command configuration."),
|
|
1101
1167
|
splitTypeCrates: zod.z.boolean().optional().describe("Whether generated types are split into one crate per API behind a facade crate."),
|
|
1102
1168
|
userAgentSuffixFlag: userAgentSuffixFlagSchema.optional().describe('The long flag name, without "--", that appends a product token to the User-Agent.'),
|
|
1103
|
-
banner: bannerSchema.optional().describe(
|
|
1104
|
-
"The banner printed above root --help: a string, or text with colours, a gradient direction, per-line colours and an animation switch."
|
|
1105
|
-
),
|
|
1106
1169
|
oauthTokenEndpoints: zod.z.record(nonEmptyStringSchema, oauthTokenEndpointsSchema).optional().describe(
|
|
1107
1170
|
"Per OAuth scheme id (api.auth.schemes[].id), the names of the properties of the token and refresh requests and responses, for the client credentials flow of an API whose token endpoint does not use the RFC 6749 names."
|
|
1108
1171
|
)
|
|
@@ -1115,18 +1178,10 @@ var CLI_GENERATION_FIELDS = [
|
|
|
1115
1178
|
"rootGroup",
|
|
1116
1179
|
"profiles",
|
|
1117
1180
|
"splitTypeCrates",
|
|
1118
|
-
"userAgentSuffixFlag"
|
|
1119
|
-
"banner"
|
|
1181
|
+
"userAgentSuffixFlag"
|
|
1120
1182
|
];
|
|
1121
1183
|
var PROFILES_FIELDS = ["enabled", "commandName", "revokeOperation"];
|
|
1122
|
-
var PROVISION_OPERATION_FIELDS = [
|
|
1123
|
-
"operation",
|
|
1124
|
-
"credential",
|
|
1125
|
-
"revokeParameters",
|
|
1126
|
-
"flag",
|
|
1127
|
-
"parameters",
|
|
1128
|
-
"profileParameters"
|
|
1129
|
-
];
|
|
1184
|
+
var PROVISION_OPERATION_FIELDS = ["operation", "credential", "revokeParameters"];
|
|
1130
1185
|
function mapCliGeneration(config, state, basePath, targetIndex) {
|
|
1131
1186
|
const generation = {};
|
|
1132
1187
|
for (const field of CLI_GENERATION_FIELDS) {
|
|
@@ -2711,52 +2766,6 @@ var sdkConfigV1CliOutputConfigSchema = zod.z.discriminatedUnion(
|
|
|
2711
2766
|
var sdkConfigV1ReplayConfigSchema = zod.z.strictObject({
|
|
2712
2767
|
enabled: zod.z.boolean().describe("Whether regeneration reapplies customer-authored repository changes.")
|
|
2713
2768
|
});
|
|
2714
|
-
var errorResponsesHttpMethodSchema = zod.z.enum([
|
|
2715
|
-
"get",
|
|
2716
|
-
"post",
|
|
2717
|
-
"put",
|
|
2718
|
-
"patch",
|
|
2719
|
-
"delete",
|
|
2720
|
-
"head",
|
|
2721
|
-
"options",
|
|
2722
|
-
"trace"
|
|
2723
|
-
]);
|
|
2724
|
-
var errorResponsesEnsureSchema = zod.z.strictObject({
|
|
2725
|
-
statusCode: zod.z.number().int().min(400).max(599).describe("The 4xx or 5xx status code added to an operation that does not declare it."),
|
|
2726
|
-
methods: zod.z.array(errorResponsesHttpMethodSchema).optional().describe("The HTTP methods whose operations receive the response. Defaults to all methods.")
|
|
2727
|
-
});
|
|
2728
|
-
var errorResponsesSchema = zod.z.strictObject({
|
|
2729
|
-
schema: zod.z.record(zod.z.string(), zod.z.unknown()).describe(
|
|
2730
|
-
"The OpenAPI schema of error response bodies, inline. The client resolves a schema file to its content before the config reaches the generator. Any $ref inside must be a local #/components/... pointer into the spec it is applied to."
|
|
2731
|
-
),
|
|
2732
|
-
name: nonEmptyStringSchema.optional().describe(
|
|
2733
|
-
"The name of the generated error body type. Defaults to the schema title, then ProblemDetails."
|
|
2734
|
-
),
|
|
2735
|
-
applyTo: zod.z.enum(["all", "untyped"]).optional().describe(
|
|
2736
|
-
"all replaces the body of every 4xx/5xx response with the schema. untyped only fills in 4xx/5xx responses that declare no body schema. Defaults to all."
|
|
2737
|
-
),
|
|
2738
|
-
ensure: zod.z.array(errorResponsesEnsureSchema).optional().describe("Error responses added to operations that do not already declare them.")
|
|
2739
|
-
});
|
|
2740
|
-
var exampleDepthSchema = zod.z.strictObject({
|
|
2741
|
-
maxDepth: zod.z.number().int().min(0).optional().describe("How many levels of optional properties an example includes. 0 leaves them out.")
|
|
2742
|
-
});
|
|
2743
|
-
var exampleGenerationSchema = zod.z.strictObject({
|
|
2744
|
-
request: exampleDepthSchema.optional().describe("Depth of generated request examples."),
|
|
2745
|
-
response: exampleDepthSchema.optional().describe("Depth of generated response examples.")
|
|
2746
|
-
});
|
|
2747
|
-
var resolveAliasesSchema = zod.z.union([
|
|
2748
|
-
zod.z.boolean(),
|
|
2749
|
-
zod.z.strictObject({
|
|
2750
|
-
except: zod.z.array(nonEmptyStringSchema).optional().describe("Component schema names whose aliases are kept.")
|
|
2751
|
-
})
|
|
2752
|
-
]);
|
|
2753
|
-
var endpointFilterSchema = zod.z.strictObject({
|
|
2754
|
-
endpoints: zod.z.array(
|
|
2755
|
-
nonEmptyStringSchema.describe(
|
|
2756
|
-
'An endpoint to keep, as "METHOD /path/template". An entry in another shape is ignored.'
|
|
2757
|
-
)
|
|
2758
|
-
).describe("The only endpoints imported. Every other operation is dropped before conversion.")
|
|
2759
|
-
});
|
|
2760
2769
|
var apiImportSettingsSchema = zod.z.strictObject({
|
|
2761
2770
|
respectNullableSchemas: zod.z.boolean().optional().describe("Whether nullable schemas remain nullable in generated types."),
|
|
2762
2771
|
titleAsSchemaName: zod.z.boolean().optional().describe("Whether a schema title can determine the generated type name."),
|
|
@@ -2785,56 +2794,7 @@ var apiImportSettingsSchema = zod.z.strictObject({
|
|
|
2785
2794
|
resolveSchemaCollisions: zod.z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
|
|
2786
2795
|
asyncApiMessageNaming: zod.z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
|
|
2787
2796
|
defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one."),
|
|
2788
|
-
respectByteFormat: zod.z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
|
|
2789
|
-
additionalPropertiesDefaultsTo: zod.z.boolean().optional().describe(
|
|
2790
|
-
"Whether an object schema that does not declare additionalProperties admits any extra property."
|
|
2791
|
-
),
|
|
2792
|
-
optionalAdditionalProperties: zod.z.boolean().optional().describe("Whether the values of a nullable map are also nullable."),
|
|
2793
|
-
anyOfSiblingPropertiesAsObject: zod.z.boolean().optional().describe(
|
|
2794
|
-
"Whether an anyOf that only constrains which sibling properties are present imports as the object it sits beside."
|
|
2795
|
-
),
|
|
2796
|
-
preserveSingleSchemaOneOf: zod.z.boolean().optional().describe(
|
|
2797
|
-
"Whether a oneOf with a single member stays a union instead of collapsing to that member."
|
|
2798
|
-
),
|
|
2799
|
-
preserveOneOfInAllOf: zod.z.boolean().optional().describe(
|
|
2800
|
-
"Whether a oneOf inside an allOf stays a union of the merged variants instead of being flattened."
|
|
2801
|
-
),
|
|
2802
|
-
removeDiscriminantsFromSchemas: zod.z.enum(["always", "never"]).optional().describe(
|
|
2803
|
-
"Whether the discriminator property is removed from the schemas of a discriminated union."
|
|
2804
|
-
),
|
|
2805
|
-
coerceConstsTo: zod.z.enum(["literals", "enums", "enums-coerceable-to-literals"]).optional().describe(
|
|
2806
|
-
"What a const imports as: a literal, a single-value enum, or an enum that coerceEnumsToLiterals can turn into a literal."
|
|
2807
|
-
),
|
|
2808
|
-
resolveAliases: resolveAliasesSchema.optional().describe(
|
|
2809
|
-
"Whether references to alias-like schemas are replaced by the schema they alias, optionally keeping the named exceptions."
|
|
2810
|
-
),
|
|
2811
|
-
respectForwardCompatibleEnums: zod.z.boolean().optional().describe(
|
|
2812
|
-
"Whether a query or header parameter that accepts an enum or any string keeps both options."
|
|
2813
|
-
),
|
|
2814
|
-
inferForwardCompatible: zod.z.boolean().optional().describe(
|
|
2815
|
-
"Whether a oneOf or anyOf of an enum and a plain string imports as a forward-compatible enum."
|
|
2816
|
-
),
|
|
2817
|
-
respectOperationIdWordBoundaries: zod.z.boolean().optional().describe(
|
|
2818
|
-
"Whether operation ids are split at every word boundary when method names are derived."
|
|
2819
|
-
),
|
|
2820
|
-
namespacedErrors: zod.z.boolean().optional().describe("Whether an error response takes the x-fern-sdk-namespace it declares."),
|
|
2821
|
-
defaultFormParameterEncoding: zod.z.enum(["form", "json"]).optional().describe("How multipart form properties without an explicit content type are encoded."),
|
|
2822
|
-
respectParameterContent: zod.z.boolean().optional().describe(
|
|
2823
|
-
"Whether a header declared with a JSON content entry instead of a schema is typed by that content."
|
|
2824
|
-
),
|
|
2825
|
-
useBytesForBinaryResponse: zod.z.boolean().optional().describe("Whether a binary response is returned as bytes instead of a file stream."),
|
|
2826
|
-
useReadVariantForResponses: zod.z.boolean().optional().describe(
|
|
2827
|
-
"Whether responses use the read variant of a schema that has read-only properties. Needs respectReadonlySchemas."
|
|
2828
|
-
),
|
|
2829
|
-
exampleGeneration: exampleGenerationSchema.optional().describe("How deep the examples generated for operations without one go."),
|
|
2830
|
-
filter: endpointFilterSchema.optional().describe("Restricts the import to a list of endpoints."),
|
|
2831
|
-
groupEnvironmentsByHost: zod.z.boolean().optional().describe("Whether HTTP and WebSocket servers with the same host become one environment."),
|
|
2832
|
-
multiServerStrategy: zod.z.enum(["environment-per-server", "urls-per-environment"]).optional().describe(
|
|
2833
|
-
"Whether each named server is its own environment or a named URL of one environment."
|
|
2834
|
-
),
|
|
2835
|
-
inferDefaultEnvironment: zod.z.boolean().optional().describe("Whether the first server becomes the default environment."),
|
|
2836
|
-
respectPerSpecBasePath: zod.z.boolean().optional().describe("Whether each spec's plain x-fern-base-path applies to that spec's endpoints."),
|
|
2837
|
-
errorResponses: errorResponsesSchema.optional().describe("A shared error body schema applied to the 4xx/5xx responses of the specs.")
|
|
2797
|
+
respectByteFormat: zod.z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
|
|
2838
2798
|
});
|
|
2839
2799
|
var sourceSpecTypeSchema = zod.z.enum([
|
|
2840
2800
|
"openapi",
|
|
@@ -2960,99 +2920,6 @@ var javaGenerationConfigSchema = jvmGenerationConfigSchema.extend({
|
|
|
2960
2920
|
|
|
2961
2921
|
// src/sdk-config-domain/v1/language/kotlin.ts
|
|
2962
2922
|
var kotlinGenerationConfigSchema = jvmGenerationConfigSchema;
|
|
2963
|
-
var compilerOptionsSchema = zod.z.strictObject({
|
|
2964
|
-
target: nonEmptyStringSchema.optional().describe("The JavaScript language target passed to TypeScript."),
|
|
2965
|
-
module: nonEmptyStringSchema.optional().describe("The module format passed to TypeScript."),
|
|
2966
|
-
lib: zod.z.array(nonEmptyStringSchema).optional().describe("The runtime library definitions passed to TypeScript.")
|
|
2967
|
-
});
|
|
2968
|
-
var packageScriptSchema = zod.z.strictObject({
|
|
2969
|
-
name: nonEmptyStringSchema.describe("The package script name."),
|
|
2970
|
-
command: nonEmptyStringSchema.describe("The command executed by the package script.")
|
|
2971
|
-
});
|
|
2972
|
-
var httpClientSchema = zod.z.strictObject({
|
|
2973
|
-
name: zod.z.enum(["axios", "fetch", "node-fetch"]).describe("The HTTP client used by generated TypeScript code.")
|
|
2974
|
-
});
|
|
2975
|
-
var typescriptGenerationConfigSchema = zod.z.strictObject({
|
|
2976
|
-
typescriptVersion: nonEmptyStringSchema.optional().describe("The TypeScript version used by the generated project."),
|
|
2977
|
-
zodVersion: nonEmptyStringSchema.optional().describe("The Zod version used by generated runtime schemas."),
|
|
2978
|
-
compilerOptions: compilerOptionsSchema.optional().describe("TypeScript compiler options for the generated project."),
|
|
2979
|
-
httpClient: httpClientSchema.optional().describe("The HTTP client used by generated TypeScript code."),
|
|
2980
|
-
packageManager: zod.z.enum(["pnpm", "yarn"]).optional().describe("The package manager used by the generated project."),
|
|
2981
|
-
packageManagerVersion: nonEmptyStringSchema.optional().describe("The package manager version used by the generated project."),
|
|
2982
|
-
testFramework: zod.z.enum(["jest", "vitest"]).optional().describe("The test framework used by generated tests."),
|
|
2983
|
-
namingStrategy: zod.z.enum(["base", "originalPropertyNames"]).optional().describe("How schema property names are converted into TypeScript identifiers."),
|
|
2984
|
-
bundle: zod.z.boolean().optional().describe("Whether the generated package includes bundled output."),
|
|
2985
|
-
exportClassDefault: zod.z.boolean().optional().describe("Whether the client class is also exported as the default export."),
|
|
2986
|
-
/** Name of the top-level namespace export emitted by Fern-compatible TypeScript SDKs. */
|
|
2987
|
-
namespaceExportName: nonEmptyStringSchema.optional().describe("The top-level namespace export name."),
|
|
2988
|
-
consolidateTypeFiles: zod.z.boolean().optional().describe("Whether generated types are consolidated into fewer source files."),
|
|
2989
|
-
formDataSupport: zod.z.enum(["Node16", "Node18"]).optional().describe(
|
|
2990
|
-
"The multipart form-data implementation: Node16 uses the form-data packages, Node18 uses the platform FormData."
|
|
2991
|
-
),
|
|
2992
|
-
allowExtraFields: zod.z.boolean().optional().describe(
|
|
2993
|
-
"Whether response parsing keeps unrecognized object keys and accepts unrecognized union members and enum values."
|
|
2994
|
-
),
|
|
2995
|
-
generateSubpackageExports: zod.z.boolean().optional().describe(
|
|
2996
|
-
"Whether the package manifest exports each subpackage client as its own entry point."
|
|
2997
|
-
),
|
|
2998
|
-
exportAllRequestsAtRoot: zod.z.boolean().optional().describe("Whether every request type is also exported from the package root."),
|
|
2999
|
-
generateEndpointMetadata: zod.z.boolean().optional().describe("Whether generated clients expose metadata for each endpoint."),
|
|
3000
|
-
outputEsm: zod.z.boolean().optional().describe(
|
|
3001
|
-
"Whether the package is marked as an ES module while still shipping its CommonJS build."
|
|
3002
|
-
),
|
|
3003
|
-
neverThrowErrors: zod.z.boolean().optional().describe(
|
|
3004
|
-
"Whether client methods return a wrapped response instead of throwing on a non-2xx status."
|
|
3005
|
-
),
|
|
3006
|
-
includeOtherInUnionTypes: zod.z.boolean().optional().describe("Whether union types gain a member for variants the SDK does not recognize."),
|
|
3007
|
-
includeUtilsOnUnionMembers: zod.z.boolean().optional().describe("Whether helper utilities are generated on each member of a union type."),
|
|
3008
|
-
omitFernHeaders: zod.z.boolean().optional().describe("Whether requests omit the SDK identification headers and the User-Agent header."),
|
|
3009
|
-
linter: zod.z.enum(["biome", "oxlint", "none"]).optional().describe("The linter configured in the generated project."),
|
|
3010
|
-
formatter: zod.z.enum(["prettier", "biome", "oxfmt", "none"]).optional().describe("The formatter configured in the generated project."),
|
|
3011
|
-
exports: jsonObjectSchema.optional().describe(
|
|
3012
|
-
"package.json exports entries, keyed by subpath, applied over the generated exports. Each subpath replaces the generated one."
|
|
3013
|
-
),
|
|
3014
|
-
files: zod.z.array(nonEmptyStringSchema).optional().describe("package.json files entries, listed ahead of the generated ones."),
|
|
3015
|
-
engines: zod.z.record(nonEmptyStringSchema, nonEmptyStringSchema).optional().describe("package.json engines version ranges, keyed by engine name such as node."),
|
|
3016
|
-
lintStaged: zod.z.record(nonEmptyStringSchema, zod.z.array(nonEmptyStringSchema).min(1)).optional().describe("lint-staged commands to run, keyed by file glob."),
|
|
3017
|
-
browser: zod.z.record(nonEmptyStringSchema, zod.z.union([zod.z.boolean(), nonEmptyStringSchema])).optional().describe(
|
|
3018
|
-
"package.json browser field: a module or file is excluded (false) or replaced by another path."
|
|
3019
|
-
),
|
|
3020
|
-
allowCustomFetcher: zod.z.boolean().optional().describe("Whether callers can supply a custom fetch implementation."),
|
|
3021
|
-
useBrandedStringAliases: zod.z.boolean().optional().describe("Whether string aliases are emitted as distinct branded types."),
|
|
3022
|
-
useLegacyExports: zod.z.boolean().optional().describe("Whether the package emits the legacy export layout."),
|
|
3023
|
-
useBigInt: zod.z.boolean().optional().describe("Whether 64-bit integer values are represented with bigint."),
|
|
3024
|
-
serdeLayer: zod.z.boolean().optional().describe("Whether generated models use Fern serialization and deserialization helpers."),
|
|
3025
|
-
/** Ship only the ESM build (drops CJS) to avoid the Node dual-package hazard. */
|
|
3026
|
-
esmOnly: zod.z.boolean().optional().describe("Whether the package emits only ECMAScript modules."),
|
|
3027
|
-
scripts: zod.z.array(packageScriptSchema).optional().describe("Additional scripts added to the generated package manifest.")
|
|
3028
|
-
});
|
|
3029
|
-
|
|
3030
|
-
// src/sdk-config-domain/v1/language/mcp.ts
|
|
3031
|
-
var mcpAvailabilityStatuses = [
|
|
3032
|
-
"IN_DEVELOPMENT",
|
|
3033
|
-
"PRE_RELEASE",
|
|
3034
|
-
"GENERAL_AVAILABILITY",
|
|
3035
|
-
"DEPRECATED",
|
|
3036
|
-
"ALPHA",
|
|
3037
|
-
"BETA",
|
|
3038
|
-
"PREVIEW",
|
|
3039
|
-
"LEGACY"
|
|
3040
|
-
];
|
|
3041
|
-
var mcpToolFilterSchema = zod.z.strictObject({
|
|
3042
|
-
include: zod.z.array(nonEmptyStringSchema).optional().describe("Operations explicitly included as MCP tools."),
|
|
3043
|
-
exclude: zod.z.array(nonEmptyStringSchema).optional().describe("Operations explicitly excluded from MCP tools.")
|
|
3044
|
-
});
|
|
3045
|
-
var mcpToolsetNameSchema = nonEmptyStringSchema.refine(
|
|
3046
|
-
(name) => name !== "default" && /^[a-z0-9-]+$/.test(name),
|
|
3047
|
-
'toolset names must match [a-z0-9-]+ and cannot be "default"'
|
|
3048
|
-
);
|
|
3049
|
-
var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
|
|
3050
|
-
serverName: nonEmptyStringSchema.optional().describe("The name advertised by the generated MCP server."),
|
|
3051
|
-
serverDescription: nonEmptyStringSchema.optional().describe("The description advertised by the generated MCP server."),
|
|
3052
|
-
excludeAvailability: zod.z.array(zod.z.enum(mcpAvailabilityStatuses)).optional().describe("Operation availability statuses excluded from MCP tool generation."),
|
|
3053
|
-
tools: mcpToolFilterSchema.optional().describe("Global operation filters for generated MCP tools."),
|
|
3054
|
-
toolsets: zod.z.record(mcpToolsetNameSchema, mcpToolFilterSchema).optional().describe("Named MCP toolsets and the operation filters for each toolset.")
|
|
3055
|
-
});
|
|
3056
2923
|
var phpGenerationConfigSchema = zod.z.strictObject({
|
|
3057
2924
|
propertyAccess: zod.z.enum(["public", "private"]).optional().describe("The visibility of generated PHP model properties."),
|
|
3058
2925
|
generateClientInterfaces: zod.z.boolean().optional().describe("Whether interfaces are generated for PHP client classes.")
|
|
@@ -4286,7 +4153,9 @@ function mapMcp(config, state, basePath) {
|
|
|
4286
4153
|
basePath
|
|
4287
4154
|
),
|
|
4288
4155
|
tools: takeToolFilter(config, ["tools"], state, basePath),
|
|
4289
|
-
toolsets: takeToolsets(config, ["toolsets"], state, basePath)
|
|
4156
|
+
toolsets: takeToolsets(config, ["toolsets"], state, basePath),
|
|
4157
|
+
mergedTools: takeMergedTools(config, ["mergedTools"], state, basePath),
|
|
4158
|
+
customTools: takeCustomTools(config, ["customTools"], state, basePath)
|
|
4290
4159
|
});
|
|
4291
4160
|
}
|
|
4292
4161
|
function mapReadme(value, language, activeLanguages, state, basePath) {
|
|
@@ -4640,6 +4509,79 @@ function takeToolsets(value, aliases, state, basePath) {
|
|
|
4640
4509
|
consume(state, located.path);
|
|
4641
4510
|
return Object.fromEntries(entries.filter((entry) => entry !== void 0));
|
|
4642
4511
|
}
|
|
4512
|
+
function takeCustomTools(value, aliases, state, basePath) {
|
|
4513
|
+
const located = takeObject(value, aliases, state, basePath);
|
|
4514
|
+
if (!located) return void 0;
|
|
4515
|
+
const entries = Object.entries(located.value).map(([name, spec]) => {
|
|
4516
|
+
if (!MCP_TOOL_NAME_PATTERN.test(name)) {
|
|
4517
|
+
fail(
|
|
4518
|
+
"FERN_MCP_CUSTOM_TOOL_NAME_INVALID",
|
|
4519
|
+
[...located.path, name],
|
|
4520
|
+
`MCP custom tool name "${name}" is not valid in SDK Config v1`,
|
|
4521
|
+
"Rename the custom tool to match [a-zA-Z0-9_-] and at most 64 characters.",
|
|
4522
|
+
["targets", basePath[2], "generation", "customTools", name]
|
|
4523
|
+
);
|
|
4524
|
+
}
|
|
4525
|
+
if (!isObject(spec) || typeof spec.path !== "string") {
|
|
4526
|
+
fail(
|
|
4527
|
+
"FERN_MCP_CUSTOM_TOOL_SPEC_INVALID",
|
|
4528
|
+
[...located.path, name],
|
|
4529
|
+
`MCP custom tool "${name}" must be an object with a string "path"`,
|
|
4530
|
+
'Give the custom tool a "path" pointing at the TypeScript module that exports its definition and handler.',
|
|
4531
|
+
["targets", basePath[2], "generation", "customTools", name]
|
|
4532
|
+
);
|
|
4533
|
+
}
|
|
4534
|
+
return [name, { path: spec.path }];
|
|
4535
|
+
});
|
|
4536
|
+
if (entries.some((entry) => !entry)) return void 0;
|
|
4537
|
+
consume(state, located.path);
|
|
4538
|
+
return Object.fromEntries(entries.filter((entry) => entry !== void 0));
|
|
4539
|
+
}
|
|
4540
|
+
function takeMergedTools(value, aliases, state, basePath) {
|
|
4541
|
+
const located = takeObject(value, aliases, state, basePath);
|
|
4542
|
+
if (!located) return void 0;
|
|
4543
|
+
const entries = Object.entries(located.value).map(([name, spec]) => {
|
|
4544
|
+
if (!MCP_TOOL_NAME_PATTERN.test(name)) {
|
|
4545
|
+
fail(
|
|
4546
|
+
"FERN_MCP_MERGED_TOOL_NAME_INVALID",
|
|
4547
|
+
[...located.path, name],
|
|
4548
|
+
`MCP merged tool name "${name}" is not valid in SDK Config v1`,
|
|
4549
|
+
"Rename the merged tool to match [a-zA-Z0-9_-] and at most 64 characters.",
|
|
4550
|
+
["targets", basePath[2], "generation", "mergedTools", name]
|
|
4551
|
+
);
|
|
4552
|
+
}
|
|
4553
|
+
if (!isObject(spec)) {
|
|
4554
|
+
fail(
|
|
4555
|
+
"FERN_MCP_MERGED_TOOL_SPEC_INVALID",
|
|
4556
|
+
[...located.path, name],
|
|
4557
|
+
`MCP merged tool "${name}" must be an object`,
|
|
4558
|
+
'Give the merged tool a "dispatchOn" argument and an include/exclude filter selecting its member operations.',
|
|
4559
|
+
["targets", basePath[2], "generation", "mergedTools", name]
|
|
4560
|
+
);
|
|
4561
|
+
}
|
|
4562
|
+
if (typeof spec.dispatchOn !== "string") {
|
|
4563
|
+
fail(
|
|
4564
|
+
"FERN_MCP_MERGED_TOOL_DISPATCH_ON_MISSING",
|
|
4565
|
+
[...located.path, name, "dispatchOn"],
|
|
4566
|
+
`MCP merged tool "${name}" is missing a string "dispatchOn"`,
|
|
4567
|
+
'Set "dispatchOn" to the tool argument whose value selects which member operation to call.',
|
|
4568
|
+
["targets", basePath[2], "generation", "mergedTools", name, "dispatchOn"]
|
|
4569
|
+
);
|
|
4570
|
+
}
|
|
4571
|
+
return [
|
|
4572
|
+
name,
|
|
4573
|
+
compact({
|
|
4574
|
+
dispatchOn: spec.dispatchOn,
|
|
4575
|
+
description: typeof spec.description === "string" ? spec.description : void 0,
|
|
4576
|
+
include: stringArrayValue(spec.include),
|
|
4577
|
+
exclude: stringArrayValue(spec.exclude)
|
|
4578
|
+
})
|
|
4579
|
+
];
|
|
4580
|
+
});
|
|
4581
|
+
if (entries.some((entry) => !entry)) return void 0;
|
|
4582
|
+
consume(state, located.path);
|
|
4583
|
+
return Object.fromEntries(entries.filter((entry) => entry !== void 0));
|
|
4584
|
+
}
|
|
4643
4585
|
|
|
4644
4586
|
exports.FernConfigMappingError = FernConfigMappingError;
|
|
4645
4587
|
exports.SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE = CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE;
|