@postman/sdk-config 0.23.0 → 0.24.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 CHANGED
@@ -802,6 +802,11 @@ var mcpCustomToolSchema = zod.z.strictObject({
802
802
  "Path to a TypeScript module that exports the tool `definition` and `handler`."
803
803
  )
804
804
  });
805
+ var mcpHooksSchema = zod.z.strictObject({
806
+ path: relativePathSchema.describe(
807
+ "Path to a TypeScript module exporting the MCP request/response hooks (`beforeRequest`, `afterResponse`, `onError`, `transformResult`)."
808
+ )
809
+ });
805
810
  var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
806
811
  serverName: nonEmptyStringSchema.optional().describe("The name advertised by the generated MCP server."),
807
812
  serverDescription: nonEmptyStringSchema.optional().describe("The description advertised by the generated MCP server."),
@@ -813,6 +818,9 @@ var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
813
818
  ),
814
819
  customTools: zod.z.record(mcpToolNameSchema, mcpCustomToolSchema).optional().describe(
815
820
  "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."
821
+ ),
822
+ hooks: mcpHooksSchema.optional().describe(
823
+ "Customer-authored request/response hooks, emitted into the generated server as `src/hooks.ts` (replacing the no-op stub)."
816
824
  )
817
825
  });
818
826
 
@@ -4167,7 +4175,8 @@ function mapMcp(config, state, basePath) {
4167
4175
  tools: takeToolFilter(config, ["tools"], state, basePath),
4168
4176
  toolsets: takeToolsets(config, ["toolsets"], state, basePath),
4169
4177
  mergedTools: takeMergedTools(config, ["mergedTools"], state, basePath),
4170
- customTools: takeCustomTools(config, ["customTools"], state, basePath)
4178
+ customTools: takeCustomTools(config, ["customTools"], state, basePath),
4179
+ hooks: takeHooks(config, ["hooks"], state, basePath)
4171
4180
  });
4172
4181
  }
4173
4182
  function mapReadme(value, language, activeLanguages, state, basePath) {
@@ -4549,6 +4558,21 @@ function takeCustomTools(value, aliases, state, basePath) {
4549
4558
  consume(state, located.path);
4550
4559
  return Object.fromEntries(entries.filter((entry) => entry !== void 0));
4551
4560
  }
4561
+ function takeHooks(value, aliases, state, basePath) {
4562
+ const located = takeObject(value, aliases, state, basePath);
4563
+ if (!located) return void 0;
4564
+ if (typeof located.value.path !== "string") {
4565
+ fail(
4566
+ "FERN_MCP_HOOKS_SPEC_INVALID",
4567
+ located.path,
4568
+ 'MCP hooks must be an object with a string "path"',
4569
+ 'Give "hooks" a "path" pointing at the TypeScript module exporting the request/response hooks.',
4570
+ ["targets", basePath[2], "generation", "hooks"]
4571
+ );
4572
+ }
4573
+ consume(state, located.path);
4574
+ return { path: located.value.path };
4575
+ }
4552
4576
  function takeMergedTools(value, aliases, state, basePath) {
4553
4577
  const located = takeObject(value, aliases, state, basePath);
4554
4578
  if (!located) return void 0;