@postman/sdk-config 0.23.0 → 0.25.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 +85 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +85 -3
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +67 -1
- 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 +67 -1
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +67 -1
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +16 -2
- package/dist/sdk-config/v1/index.d.ts +16 -2
- package/dist/sdk-config/v1/index.js +67 -1
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +63 -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 +63 -2
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +63 -1
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +39 -3
- package/dist/sdk-config-ir/v1/index.d.ts +39 -3
- package/dist/sdk-config-ir/v1/index.js +63 -2
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-ZRqfOhMd.d.cts → typescript-BIq_eF34.d.cts} +10 -1
- package/dist/{typescript-ZRqfOhMd.d.ts → typescript-BIq_eF34.d.ts} +10 -1
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +31 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { FernConfigMappingDiagnostic, FernConfigMappingError, FernConfigMappingResult, FernResolvedGeneratorGroupInput, FernResolvedGeneratorInput, FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, SdkConfigV1, SdkConfigV1ApiConfig, SdkConfigV1ApiConfigInput, SdkConfigV1CliOutputConfig, SdkConfigV1ClientConfig, SdkConfigV1ClientConfigInput, SdkConfigV1ClientConfigOverride, SdkConfigV1Dependency, SdkConfigV1DocsConfig, SdkConfigV1Document, SdkConfigV1GenerationConfig, SdkConfigV1GenerationConfigInput, SdkConfigV1GenerationConfigOverride, SdkConfigV1GitRemote, SdkConfigV1Input, SdkConfigV1McpOutputConfig, SdkConfigV1OutputConfig, SdkConfigV1PackageConfig, SdkConfigV1ProtobufRoot, SdkConfigV1ProtobufSource, SdkConfigV1PublishConfig, SdkConfigV1PublishRegistry, SdkConfigV1ReplayConfig, SdkConfigV1SourceConfig, SdkConfigV1SourceSpec, SdkConfigV1Target, SdkConfigV1WebhookSignature, SdkConfigV1WebhookSignatureInput, getSdkConfigV1Diagnostics, mapFernConfigToSdkConfigV1, parseSdkConfigV1, parseSdkConfigV1ForConsumption, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1CliOutputConfigSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1GitRemoteSchema, sdkConfigV1McpOutputConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1ProtobufRootSchema, sdkConfigV1ProtobufSourceSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 } from './v1/index.cjs';
|
|
2
|
-
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic,
|
|
2
|
+
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic, x as sdkConfigV1CliDistributionConfigSchema, y as sdkConfigV1CliDistributionGithubAppSchema, z as sdkConfigV1CliDistributionHomebrewSchema, A as sdkConfigV1CliDistributionScoopSchema, B as sdkConfigV1CliGenerationConfigSchema, E as sdkConfigV1ComposerPackageNameSchema, F as sdkConfigV1CsharpGenerationConfigSchema, I as sdkConfigV1ExactSemverSchema, L as sdkConfigV1GithubActionsSecretNameSchema, N as sdkConfigV1GoGenerationConfigSchema, O as sdkConfigV1GoModulePathSchema, Q as sdkConfigV1JavaGenerationConfigSchema, W as sdkConfigV1KotlinGenerationConfigSchema, Y as sdkConfigV1McpGenerationConfigSchema, Z as sdkConfigV1NonEmptyStringSchema, a0 as sdkConfigV1ParentRelativePathSchema, a1 as sdkConfigV1PhpGenerationConfigSchema, a2 as sdkConfigV1PythonGenerationConfigSchema, a3 as sdkConfigV1RelativePathSchema, a4 as sdkConfigV1RubyGenerationConfigSchema, a5 as sdkConfigV1RustGenerationConfigSchema, a6 as sdkConfigV1SwiftGenerationConfigSchema, a7 as sdkConfigV1TerraformGenerationConfigSchema, a8 as sdkConfigV1TypescriptGenerationConfigSchema } from '../typescript-BIq_eF34.cjs';
|
|
3
3
|
import 'zod';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { FernConfigMappingDiagnostic, FernConfigMappingError, FernConfigMappingResult, FernResolvedGeneratorGroupInput, FernResolvedGeneratorInput, FernSdkConfigLanguage, SDK_CONFIG_V1_SCHEMA_VERSION, SdkConfigV1, SdkConfigV1ApiConfig, SdkConfigV1ApiConfigInput, SdkConfigV1CliOutputConfig, SdkConfigV1ClientConfig, SdkConfigV1ClientConfigInput, SdkConfigV1ClientConfigOverride, SdkConfigV1Dependency, SdkConfigV1DocsConfig, SdkConfigV1Document, SdkConfigV1GenerationConfig, SdkConfigV1GenerationConfigInput, SdkConfigV1GenerationConfigOverride, SdkConfigV1GitRemote, SdkConfigV1Input, SdkConfigV1McpOutputConfig, SdkConfigV1OutputConfig, SdkConfigV1PackageConfig, SdkConfigV1ProtobufRoot, SdkConfigV1ProtobufSource, SdkConfigV1PublishConfig, SdkConfigV1PublishRegistry, SdkConfigV1ReplayConfig, SdkConfigV1SourceConfig, SdkConfigV1SourceSpec, SdkConfigV1Target, SdkConfigV1WebhookSignature, SdkConfigV1WebhookSignatureInput, getSdkConfigV1Diagnostics, mapFernConfigToSdkConfigV1, parseSdkConfigV1, parseSdkConfigV1ForConsumption, sdkConfigV1ApiConfigSchema, sdkConfigV1AuthConfigSchema, sdkConfigV1AuthSchemeSchema, sdkConfigV1CliOutputConfigSchema, sdkConfigV1ClientConfigOverrideSchema, sdkConfigV1ClientConfigSchema, sdkConfigV1DependencySchema, sdkConfigV1DocsConfigSchema, sdkConfigV1GenerationConfigOverrideSchema, sdkConfigV1GenerationConfigSchema, sdkConfigV1GitRemoteSchema, sdkConfigV1McpOutputConfigSchema, sdkConfigV1OutputConfigSchema, sdkConfigV1PackageConfigSchema, sdkConfigV1ProtobufRootSchema, sdkConfigV1ProtobufSourceSchema, sdkConfigV1PublishConfigSchema, sdkConfigV1PublishRegistrySchema, sdkConfigV1ReadmeCustomSectionSchema, sdkConfigV1ReadmeEndpointSchema, sdkConfigV1ReplayConfigSchema, sdkConfigV1Schema, sdkConfigV1SourceConfigSchema, sdkConfigV1SourceSpecSchema, sdkConfigV1TargetSchema, sdkConfigV1WebhookSignatureSchema, splitSdkConfigV1TargetGeneration, validateSdkConfigV1 } from './v1/index.js';
|
|
2
|
-
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic,
|
|
2
|
+
export { C as SDK_CONFIG_V1_CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, a as SdkConfigV1CliDistributionConfig, b as SdkConfigV1CliDistributionGithubAppConfig, c as SdkConfigV1CliDistributionHomebrewConfig, d as SdkConfigV1CliDistributionScoopConfig, S as SdkConfigV1Diagnostic, x as sdkConfigV1CliDistributionConfigSchema, y as sdkConfigV1CliDistributionGithubAppSchema, z as sdkConfigV1CliDistributionHomebrewSchema, A as sdkConfigV1CliDistributionScoopSchema, B as sdkConfigV1CliGenerationConfigSchema, E as sdkConfigV1ComposerPackageNameSchema, F as sdkConfigV1CsharpGenerationConfigSchema, I as sdkConfigV1ExactSemverSchema, L as sdkConfigV1GithubActionsSecretNameSchema, N as sdkConfigV1GoGenerationConfigSchema, O as sdkConfigV1GoModulePathSchema, Q as sdkConfigV1JavaGenerationConfigSchema, W as sdkConfigV1KotlinGenerationConfigSchema, Y as sdkConfigV1McpGenerationConfigSchema, Z as sdkConfigV1NonEmptyStringSchema, a0 as sdkConfigV1ParentRelativePathSchema, a1 as sdkConfigV1PhpGenerationConfigSchema, a2 as sdkConfigV1PythonGenerationConfigSchema, a3 as sdkConfigV1RelativePathSchema, a4 as sdkConfigV1RubyGenerationConfigSchema, a5 as sdkConfigV1RustGenerationConfigSchema, a6 as sdkConfigV1SwiftGenerationConfigSchema, a7 as sdkConfigV1TerraformGenerationConfigSchema, a8 as sdkConfigV1TypescriptGenerationConfigSchema } from '../typescript-BIq_eF34.js';
|
|
3
3
|
import 'zod';
|
package/dist/sdk-config/index.js
CHANGED
|
@@ -199,6 +199,9 @@ var oauthFlowSchema = z.discriminatedUnion("type", [
|
|
|
199
199
|
z.strictObject({
|
|
200
200
|
type: z.literal("client-credentials").describe("Uses the OAuth client credentials flow."),
|
|
201
201
|
tokenUrl: nonEmptyStringSchema.describe("The URL used to obtain access tokens."),
|
|
202
|
+
environmentTokenUrls: z.record(nonEmptyStringSchema, nonEmptyStringSchema).optional().describe(
|
|
203
|
+
"Token URLs by environment name, for an API whose token endpoint differs per environment. When the selected environment has an entry, its URL replaces tokenUrl, so staging and development do not call the production token endpoint. Each key must name an entry of api.environments; environments without an entry use tokenUrl."
|
|
204
|
+
),
|
|
202
205
|
refreshUrl: nonEmptyStringSchema.optional().describe("The URL used to refresh access tokens."),
|
|
203
206
|
scopes: z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow.")
|
|
204
207
|
}),
|
|
@@ -347,6 +350,34 @@ var apiConfigSchema = z.strictObject({
|
|
|
347
350
|
*/
|
|
348
351
|
webhookSignature: webhookSignatureSchema.optional().describe("How generated helpers verify webhook signatures from the API.")
|
|
349
352
|
});
|
|
353
|
+
function oauthEnvironmentTokenUrlsIssues(api, basePath) {
|
|
354
|
+
const environmentNames = new Set((api.environments ?? []).map(({ name }) => name));
|
|
355
|
+
const issues = [];
|
|
356
|
+
(api.auth?.schemes ?? []).forEach((scheme, schemeIndex) => {
|
|
357
|
+
if (scheme.type !== "oauth2") return;
|
|
358
|
+
scheme.flows.forEach((flow, flowIndex) => {
|
|
359
|
+
if (flow.type !== "client-credentials") return;
|
|
360
|
+
Object.keys(flow.environmentTokenUrls ?? {}).forEach((environment) => {
|
|
361
|
+
if (!environmentNames.has(environment)) {
|
|
362
|
+
issues.push({
|
|
363
|
+
message: `environmentTokenUrls "${environment}" must name an entry of api.environments`,
|
|
364
|
+
path: [
|
|
365
|
+
...basePath,
|
|
366
|
+
"auth",
|
|
367
|
+
"schemes",
|
|
368
|
+
schemeIndex,
|
|
369
|
+
"flows",
|
|
370
|
+
flowIndex,
|
|
371
|
+
"environmentTokenUrls",
|
|
372
|
+
environment
|
|
373
|
+
]
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
return issues;
|
|
380
|
+
}
|
|
350
381
|
|
|
351
382
|
// src/sdk-config/v1/api.ts
|
|
352
383
|
var sdkConfigV1AuthSchemeSchema = authSchemeSchema;
|
|
@@ -796,9 +827,20 @@ var mcpCustomToolSchema = z.strictObject({
|
|
|
796
827
|
"Path to a TypeScript module that exports the tool `definition` and `handler`."
|
|
797
828
|
)
|
|
798
829
|
});
|
|
830
|
+
var mcpHooksSchema = z.strictObject({
|
|
831
|
+
path: relativePathSchema.describe(
|
|
832
|
+
"Path to a TypeScript module exporting the MCP request/response hooks (`beforeRequest`, `afterResponse`, `onError`, `transformResult`)."
|
|
833
|
+
)
|
|
834
|
+
});
|
|
799
835
|
var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
|
|
800
836
|
serverName: nonEmptyStringSchema.optional().describe("The name advertised by the generated MCP server."),
|
|
801
837
|
serverDescription: nonEmptyStringSchema.optional().describe("The description advertised by the generated MCP server."),
|
|
838
|
+
instructions: nonEmptyStringSchema.optional().describe(
|
|
839
|
+
"Replaces the auto-generated server instructions returned on initialize. WARNING: the generated instructions encode protocol wiring (the openapi:// resource and schema URI templates and the _meta keys the agent needs to browse docs and fetch full input schemas); replacing them drops that wiring and can break schema/doc browsing, so prefer appendInstructions unless you intend to restate it. Emitted verbatim and sent to the MCP client on every conversation, so keep it concise."
|
|
840
|
+
),
|
|
841
|
+
appendInstructions: nonEmptyStringSchema.optional().describe(
|
|
842
|
+
"Appended after the auto-generated server instructions returned on initialize, preserving the generated protocol wiring. When both instructions and appendInstructions are set, this is appended after the replacement text. Emitted verbatim and sent to the MCP client on every conversation, so keep it concise."
|
|
843
|
+
),
|
|
802
844
|
excludeAvailability: z.array(z.enum(mcpAvailabilityStatuses)).optional().describe("Operation availability statuses excluded from MCP tool generation."),
|
|
803
845
|
tools: mcpToolFilterSchema.optional().describe("Global operation filters for generated MCP tools."),
|
|
804
846
|
toolsets: z.record(mcpToolsetNameSchema, mcpToolFilterSchema).optional().describe("Named MCP toolsets and the operation filters for each toolset."),
|
|
@@ -807,6 +849,9 @@ var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
|
|
|
807
849
|
),
|
|
808
850
|
customTools: z.record(mcpToolNameSchema, mcpCustomToolSchema).optional().describe(
|
|
809
851
|
"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."
|
|
852
|
+
),
|
|
853
|
+
hooks: mcpHooksSchema.optional().describe(
|
|
854
|
+
"Customer-authored request/response hooks, emitted into the generated server as `src/hooks.ts` (replacing the no-op stub)."
|
|
810
855
|
)
|
|
811
856
|
});
|
|
812
857
|
|
|
@@ -3202,6 +3247,9 @@ var sdkConfigV1Schema = z.strictObject({
|
|
|
3202
3247
|
targets: z.array(sdkConfigV1TargetSchema).min(1).describe("Language targets to generate; each language may appear once.")
|
|
3203
3248
|
}).superRefine(({ api, output, package: globalPackage, targets }, context) => {
|
|
3204
3249
|
const configuredLanguages = /* @__PURE__ */ new Set();
|
|
3250
|
+
oauthEnvironmentTokenUrlsIssues(api, ["api"]).forEach(
|
|
3251
|
+
(issue) => context.addIssue({ code: "custom", ...issue })
|
|
3252
|
+
);
|
|
3205
3253
|
targets.forEach((target, targetIndex) => {
|
|
3206
3254
|
if (configuredLanguages.has(target.language)) {
|
|
3207
3255
|
context.addIssue({
|
|
@@ -4130,6 +4178,8 @@ function mapMcp(config, state, basePath) {
|
|
|
4130
4178
|
return compact({
|
|
4131
4179
|
serverName: takeString(config, ["serverName"], state, basePath),
|
|
4132
4180
|
serverDescription: takeString(config, ["serverDescription"], state, basePath),
|
|
4181
|
+
instructions: takeString(config, ["instructions"], state, basePath),
|
|
4182
|
+
appendInstructions: takeString(config, ["appendInstructions"], state, basePath),
|
|
4133
4183
|
excludeAvailability: takeEnumArray(
|
|
4134
4184
|
config,
|
|
4135
4185
|
["excludeAvailability"],
|
|
@@ -4149,7 +4199,8 @@ function mapMcp(config, state, basePath) {
|
|
|
4149
4199
|
tools: takeToolFilter(config, ["tools"], state, basePath),
|
|
4150
4200
|
toolsets: takeToolsets(config, ["toolsets"], state, basePath),
|
|
4151
4201
|
mergedTools: takeMergedTools(config, ["mergedTools"], state, basePath),
|
|
4152
|
-
customTools: takeCustomTools(config, ["customTools"], state, basePath)
|
|
4202
|
+
customTools: takeCustomTools(config, ["customTools"], state, basePath),
|
|
4203
|
+
hooks: takeHooks(config, ["hooks"], state, basePath)
|
|
4153
4204
|
});
|
|
4154
4205
|
}
|
|
4155
4206
|
function mapReadme(value, language, activeLanguages, state, basePath) {
|
|
@@ -4531,6 +4582,21 @@ function takeCustomTools(value, aliases, state, basePath) {
|
|
|
4531
4582
|
consume(state, located.path);
|
|
4532
4583
|
return Object.fromEntries(entries.filter((entry) => entry !== void 0));
|
|
4533
4584
|
}
|
|
4585
|
+
function takeHooks(value, aliases, state, basePath) {
|
|
4586
|
+
const located = takeObject(value, aliases, state, basePath);
|
|
4587
|
+
if (!located) return void 0;
|
|
4588
|
+
if (typeof located.value.path !== "string") {
|
|
4589
|
+
fail(
|
|
4590
|
+
"FERN_MCP_HOOKS_SPEC_INVALID",
|
|
4591
|
+
located.path,
|
|
4592
|
+
'MCP hooks must be an object with a string "path"',
|
|
4593
|
+
'Give "hooks" a "path" pointing at the TypeScript module exporting the request/response hooks.',
|
|
4594
|
+
["targets", basePath[2], "generation", "hooks"]
|
|
4595
|
+
);
|
|
4596
|
+
}
|
|
4597
|
+
consume(state, located.path);
|
|
4598
|
+
return { path: located.value.path };
|
|
4599
|
+
}
|
|
4534
4600
|
function takeMergedTools(value, aliases, state, basePath) {
|
|
4535
4601
|
const located = takeObject(value, aliases, state, basePath);
|
|
4536
4602
|
if (!located) return void 0;
|