@postman/sdk-config 0.20.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.
@@ -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 {
@@ -2805,99 +2920,6 @@ var javaGenerationConfigSchema = jvmGenerationConfigSchema.extend({
2805
2920
 
2806
2921
  // src/sdk-config-domain/v1/language/kotlin.ts
2807
2922
  var kotlinGenerationConfigSchema = jvmGenerationConfigSchema;
2808
- var compilerOptionsSchema = zod.z.strictObject({
2809
- target: nonEmptyStringSchema.optional().describe("The JavaScript language target passed to TypeScript."),
2810
- module: nonEmptyStringSchema.optional().describe("The module format passed to TypeScript."),
2811
- lib: zod.z.array(nonEmptyStringSchema).optional().describe("The runtime library definitions passed to TypeScript.")
2812
- });
2813
- var packageScriptSchema = zod.z.strictObject({
2814
- name: nonEmptyStringSchema.describe("The package script name."),
2815
- command: nonEmptyStringSchema.describe("The command executed by the package script.")
2816
- });
2817
- var httpClientSchema = zod.z.strictObject({
2818
- name: zod.z.enum(["axios", "fetch", "node-fetch"]).describe("The HTTP client used by generated TypeScript code.")
2819
- });
2820
- var typescriptGenerationConfigSchema = zod.z.strictObject({
2821
- typescriptVersion: nonEmptyStringSchema.optional().describe("The TypeScript version used by the generated project."),
2822
- zodVersion: nonEmptyStringSchema.optional().describe("The Zod version used by generated runtime schemas."),
2823
- compilerOptions: compilerOptionsSchema.optional().describe("TypeScript compiler options for the generated project."),
2824
- httpClient: httpClientSchema.optional().describe("The HTTP client used by generated TypeScript code."),
2825
- packageManager: zod.z.enum(["pnpm", "yarn"]).optional().describe("The package manager used by the generated project."),
2826
- packageManagerVersion: nonEmptyStringSchema.optional().describe("The package manager version used by the generated project."),
2827
- testFramework: zod.z.enum(["jest", "vitest"]).optional().describe("The test framework used by generated tests."),
2828
- namingStrategy: zod.z.enum(["base", "originalPropertyNames"]).optional().describe("How schema property names are converted into TypeScript identifiers."),
2829
- bundle: zod.z.boolean().optional().describe("Whether the generated package includes bundled output."),
2830
- exportClassDefault: zod.z.boolean().optional().describe("Whether the client class is also exported as the default export."),
2831
- /** Name of the top-level namespace export emitted by Fern-compatible TypeScript SDKs. */
2832
- namespaceExportName: nonEmptyStringSchema.optional().describe("The top-level namespace export name."),
2833
- consolidateTypeFiles: zod.z.boolean().optional().describe("Whether generated types are consolidated into fewer source files."),
2834
- formDataSupport: zod.z.enum(["Node16", "Node18"]).optional().describe(
2835
- "The multipart form-data implementation: Node16 uses the form-data packages, Node18 uses the platform FormData."
2836
- ),
2837
- allowExtraFields: zod.z.boolean().optional().describe(
2838
- "Whether response parsing keeps unrecognized object keys and accepts unrecognized union members and enum values."
2839
- ),
2840
- generateSubpackageExports: zod.z.boolean().optional().describe(
2841
- "Whether the package manifest exports each subpackage client as its own entry point."
2842
- ),
2843
- exportAllRequestsAtRoot: zod.z.boolean().optional().describe("Whether every request type is also exported from the package root."),
2844
- generateEndpointMetadata: zod.z.boolean().optional().describe("Whether generated clients expose metadata for each endpoint."),
2845
- outputEsm: zod.z.boolean().optional().describe(
2846
- "Whether the package is marked as an ES module while still shipping its CommonJS build."
2847
- ),
2848
- neverThrowErrors: zod.z.boolean().optional().describe(
2849
- "Whether client methods return a wrapped response instead of throwing on a non-2xx status."
2850
- ),
2851
- includeOtherInUnionTypes: zod.z.boolean().optional().describe("Whether union types gain a member for variants the SDK does not recognize."),
2852
- includeUtilsOnUnionMembers: zod.z.boolean().optional().describe("Whether helper utilities are generated on each member of a union type."),
2853
- omitFernHeaders: zod.z.boolean().optional().describe("Whether requests omit the SDK identification headers and the User-Agent header."),
2854
- linter: zod.z.enum(["biome", "oxlint", "none"]).optional().describe("The linter configured in the generated project."),
2855
- formatter: zod.z.enum(["prettier", "biome", "oxfmt", "none"]).optional().describe("The formatter configured in the generated project."),
2856
- exports: jsonObjectSchema.optional().describe(
2857
- "package.json exports entries, keyed by subpath, applied over the generated exports. Each subpath replaces the generated one."
2858
- ),
2859
- files: zod.z.array(nonEmptyStringSchema).optional().describe("package.json files entries, listed ahead of the generated ones."),
2860
- engines: zod.z.record(nonEmptyStringSchema, nonEmptyStringSchema).optional().describe("package.json engines version ranges, keyed by engine name such as node."),
2861
- lintStaged: zod.z.record(nonEmptyStringSchema, zod.z.array(nonEmptyStringSchema).min(1)).optional().describe("lint-staged commands to run, keyed by file glob."),
2862
- browser: zod.z.record(nonEmptyStringSchema, zod.z.union([zod.z.boolean(), nonEmptyStringSchema])).optional().describe(
2863
- "package.json browser field: a module or file is excluded (false) or replaced by another path."
2864
- ),
2865
- allowCustomFetcher: zod.z.boolean().optional().describe("Whether callers can supply a custom fetch implementation."),
2866
- useBrandedStringAliases: zod.z.boolean().optional().describe("Whether string aliases are emitted as distinct branded types."),
2867
- useLegacyExports: zod.z.boolean().optional().describe("Whether the package emits the legacy export layout."),
2868
- useBigInt: zod.z.boolean().optional().describe("Whether 64-bit integer values are represented with bigint."),
2869
- serdeLayer: zod.z.boolean().optional().describe("Whether generated models use Fern serialization and deserialization helpers."),
2870
- /** Ship only the ESM build (drops CJS) to avoid the Node dual-package hazard. */
2871
- esmOnly: zod.z.boolean().optional().describe("Whether the package emits only ECMAScript modules."),
2872
- scripts: zod.z.array(packageScriptSchema).optional().describe("Additional scripts added to the generated package manifest.")
2873
- });
2874
-
2875
- // src/sdk-config-domain/v1/language/mcp.ts
2876
- var mcpAvailabilityStatuses = [
2877
- "IN_DEVELOPMENT",
2878
- "PRE_RELEASE",
2879
- "GENERAL_AVAILABILITY",
2880
- "DEPRECATED",
2881
- "ALPHA",
2882
- "BETA",
2883
- "PREVIEW",
2884
- "LEGACY"
2885
- ];
2886
- var mcpToolFilterSchema = zod.z.strictObject({
2887
- include: zod.z.array(nonEmptyStringSchema).optional().describe("Operations explicitly included as MCP tools."),
2888
- exclude: zod.z.array(nonEmptyStringSchema).optional().describe("Operations explicitly excluded from MCP tools.")
2889
- });
2890
- var mcpToolsetNameSchema = nonEmptyStringSchema.refine(
2891
- (name) => name !== "default" && /^[a-z0-9-]+$/.test(name),
2892
- 'toolset names must match [a-z0-9-]+ and cannot be "default"'
2893
- );
2894
- var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
2895
- serverName: nonEmptyStringSchema.optional().describe("The name advertised by the generated MCP server."),
2896
- serverDescription: nonEmptyStringSchema.optional().describe("The description advertised by the generated MCP server."),
2897
- excludeAvailability: zod.z.array(zod.z.enum(mcpAvailabilityStatuses)).optional().describe("Operation availability statuses excluded from MCP tool generation."),
2898
- tools: mcpToolFilterSchema.optional().describe("Global operation filters for generated MCP tools."),
2899
- toolsets: zod.z.record(mcpToolsetNameSchema, mcpToolFilterSchema).optional().describe("Named MCP toolsets and the operation filters for each toolset.")
2900
- });
2901
2923
  var phpGenerationConfigSchema = zod.z.strictObject({
2902
2924
  propertyAccess: zod.z.enum(["public", "private"]).optional().describe("The visibility of generated PHP model properties."),
2903
2925
  generateClientInterfaces: zod.z.boolean().optional().describe("Whether interfaces are generated for PHP client classes.")
@@ -4131,7 +4153,9 @@ function mapMcp(config, state, basePath) {
4131
4153
  basePath
4132
4154
  ),
4133
4155
  tools: takeToolFilter(config, ["tools"], state, basePath),
4134
- 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)
4135
4159
  });
4136
4160
  }
4137
4161
  function mapReadme(value, language, activeLanguages, state, basePath) {
@@ -4485,6 +4509,79 @@ function takeToolsets(value, aliases, state, basePath) {
4485
4509
  consume(state, located.path);
4486
4510
  return Object.fromEntries(entries.filter((entry) => entry !== void 0));
4487
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
+ }
4488
4585
 
4489
4586
  exports.FernConfigMappingError = FernConfigMappingError;
4490
4587
  exports.SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE = CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE;