@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
|
@@ -205,6 +205,9 @@ var oauthFlowSchema = zod.z.discriminatedUnion("type", [
|
|
|
205
205
|
zod.z.strictObject({
|
|
206
206
|
type: zod.z.literal("client-credentials").describe("Uses the OAuth client credentials flow."),
|
|
207
207
|
tokenUrl: nonEmptyStringSchema.describe("The URL used to obtain access tokens."),
|
|
208
|
+
environmentTokenUrls: zod.z.record(nonEmptyStringSchema, nonEmptyStringSchema).optional().describe(
|
|
209
|
+
"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."
|
|
210
|
+
),
|
|
208
211
|
refreshUrl: nonEmptyStringSchema.optional().describe("The URL used to refresh access tokens."),
|
|
209
212
|
scopes: zod.z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow.")
|
|
210
213
|
}),
|
|
@@ -353,6 +356,34 @@ var apiConfigSchema = zod.z.strictObject({
|
|
|
353
356
|
*/
|
|
354
357
|
webhookSignature: webhookSignatureSchema.optional().describe("How generated helpers verify webhook signatures from the API.")
|
|
355
358
|
});
|
|
359
|
+
function oauthEnvironmentTokenUrlsIssues(api, basePath) {
|
|
360
|
+
const environmentNames = new Set((api.environments ?? []).map(({ name }) => name));
|
|
361
|
+
const issues = [];
|
|
362
|
+
(api.auth?.schemes ?? []).forEach((scheme, schemeIndex) => {
|
|
363
|
+
if (scheme.type !== "oauth2") return;
|
|
364
|
+
scheme.flows.forEach((flow, flowIndex) => {
|
|
365
|
+
if (flow.type !== "client-credentials") return;
|
|
366
|
+
Object.keys(flow.environmentTokenUrls ?? {}).forEach((environment) => {
|
|
367
|
+
if (!environmentNames.has(environment)) {
|
|
368
|
+
issues.push({
|
|
369
|
+
message: `environmentTokenUrls "${environment}" must name an entry of api.environments`,
|
|
370
|
+
path: [
|
|
371
|
+
...basePath,
|
|
372
|
+
"auth",
|
|
373
|
+
"schemes",
|
|
374
|
+
schemeIndex,
|
|
375
|
+
"flows",
|
|
376
|
+
flowIndex,
|
|
377
|
+
"environmentTokenUrls",
|
|
378
|
+
environment
|
|
379
|
+
]
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
return issues;
|
|
386
|
+
}
|
|
356
387
|
var retryOverrideShape = {
|
|
357
388
|
enabled: zod.z.boolean().optional().describe("Whether the generated client retries failed requests."),
|
|
358
389
|
maxAttempts: zod.z.number().int().min(1).optional().describe("The maximum total request attempts, including the initial attempt."),
|
|
@@ -950,9 +981,20 @@ var mcpCustomToolSchema = zod.z.strictObject({
|
|
|
950
981
|
"Path to a TypeScript module that exports the tool `definition` and `handler`."
|
|
951
982
|
)
|
|
952
983
|
});
|
|
984
|
+
var mcpHooksSchema = zod.z.strictObject({
|
|
985
|
+
path: relativePathSchema.describe(
|
|
986
|
+
"Path to a TypeScript module exporting the MCP request/response hooks (`beforeRequest`, `afterResponse`, `onError`, `transformResult`)."
|
|
987
|
+
)
|
|
988
|
+
});
|
|
953
989
|
var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
|
|
954
990
|
serverName: nonEmptyStringSchema.optional().describe("The name advertised by the generated MCP server."),
|
|
955
991
|
serverDescription: nonEmptyStringSchema.optional().describe("The description advertised by the generated MCP server."),
|
|
992
|
+
instructions: nonEmptyStringSchema.optional().describe(
|
|
993
|
+
"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."
|
|
994
|
+
),
|
|
995
|
+
appendInstructions: nonEmptyStringSchema.optional().describe(
|
|
996
|
+
"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."
|
|
997
|
+
),
|
|
956
998
|
excludeAvailability: zod.z.array(zod.z.enum(mcpAvailabilityStatuses)).optional().describe("Operation availability statuses excluded from MCP tool generation."),
|
|
957
999
|
tools: mcpToolFilterSchema.optional().describe("Global operation filters for generated MCP tools."),
|
|
958
1000
|
toolsets: zod.z.record(mcpToolsetNameSchema, mcpToolFilterSchema).optional().describe("Named MCP toolsets and the operation filters for each toolset."),
|
|
@@ -961,6 +1003,9 @@ var mcpGenerationConfigSchema = typescriptGenerationConfigSchema.extend({
|
|
|
961
1003
|
),
|
|
962
1004
|
customTools: zod.z.record(mcpToolNameSchema, mcpCustomToolSchema).optional().describe(
|
|
963
1005
|
"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."
|
|
1006
|
+
),
|
|
1007
|
+
hooks: mcpHooksSchema.optional().describe(
|
|
1008
|
+
"Customer-authored request/response hooks, emitted into the generated server as `src/hooks.ts` (replacing the no-op stub)."
|
|
964
1009
|
)
|
|
965
1010
|
});
|
|
966
1011
|
var phpGenerationConfigSchema = zod.z.strictObject({
|
|
@@ -1735,6 +1780,9 @@ var sdkConfigIrV1Schema = zod.z.strictObject({
|
|
|
1735
1780
|
}
|
|
1736
1781
|
});
|
|
1737
1782
|
}
|
|
1783
|
+
oauthEnvironmentTokenUrlsIssues(api, ["api"]).forEach(
|
|
1784
|
+
(issue) => context.addIssue({ code: "custom", ...issue })
|
|
1785
|
+
);
|
|
1738
1786
|
oauthTokenEndpointsIssues(generation.language?.cli?.oauthTokenEndpoints, api.auth?.schemes, [
|
|
1739
1787
|
"generation",
|
|
1740
1788
|
"language",
|
|
@@ -1906,7 +1954,10 @@ function deepEqual(left, right) {
|
|
|
1906
1954
|
}
|
|
1907
1955
|
|
|
1908
1956
|
// src/sdk-config-ir/v1/wire.ts
|
|
1909
|
-
var sdkConfigIrCapabilitySchema = zod.z.enum([
|
|
1957
|
+
var sdkConfigIrCapabilitySchema = zod.z.enum([
|
|
1958
|
+
"generation.generateFullProject",
|
|
1959
|
+
"api.auth.oauth.environmentTokenUrls"
|
|
1960
|
+
]);
|
|
1910
1961
|
var sdkConfigIrV1InputJsonSchema = inputJsonSchema(sdkConfigIrV1Schema);
|
|
1911
1962
|
function serializeSdkConfigIrV1(value) {
|
|
1912
1963
|
const parsed = parseSdkConfigIrV1(value);
|
|
@@ -1918,6 +1969,9 @@ function serializeSdkConfigIrV1(value) {
|
|
|
1918
1969
|
if (parsed.generation.generateFullProject) {
|
|
1919
1970
|
requiredCapabilities.push("generation.generateFullProject");
|
|
1920
1971
|
}
|
|
1972
|
+
if (usesEnvironmentTokenUrls(parsed)) {
|
|
1973
|
+
requiredCapabilities.push("api.auth.oauth.environmentTokenUrls");
|
|
1974
|
+
}
|
|
1921
1975
|
const json = JSON.stringify(wireValue);
|
|
1922
1976
|
if (json === void 0) {
|
|
1923
1977
|
throw new Error("SDK Config IR v1 could not be serialized as JSON");
|
|
@@ -1930,6 +1984,13 @@ function serializeSdkConfigIrV1(value) {
|
|
|
1930
1984
|
function parseSdkConfigIrV1ForConsumption(value) {
|
|
1931
1985
|
return parseSdkConfigIrV1(stripUnknownProperties(value, sdkConfigIrV1InputJsonSchema));
|
|
1932
1986
|
}
|
|
1987
|
+
function usesEnvironmentTokenUrls(value) {
|
|
1988
|
+
return (value.api.auth?.schemes ?? []).some(
|
|
1989
|
+
(scheme) => scheme.type === "oauth2" && scheme.flows.some(
|
|
1990
|
+
(flow) => flow.type === "client-credentials" && flow.environmentTokenUrls !== void 0 && Object.keys(flow.environmentTokenUrls).length > 0
|
|
1991
|
+
)
|
|
1992
|
+
);
|
|
1993
|
+
}
|
|
1933
1994
|
|
|
1934
1995
|
exports.CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE = CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE;
|
|
1935
1996
|
exports.MCP_TOOL_NAME_PATTERN = MCP_TOOL_NAME_PATTERN;
|
|
@@ -1966,6 +2027,7 @@ exports.legacyInputSchema = legacyInputSchema;
|
|
|
1966
2027
|
exports.mcpAvailabilityStatuses = mcpAvailabilityStatuses;
|
|
1967
2028
|
exports.mcpGenerationConfigSchema = mcpGenerationConfigSchema;
|
|
1968
2029
|
exports.nonEmptyStringSchema = nonEmptyStringSchema;
|
|
2030
|
+
exports.oauthEnvironmentTokenUrlsIssues = oauthEnvironmentTokenUrlsIssues;
|
|
1969
2031
|
exports.oauthTokenEndpointsIssues = oauthTokenEndpointsIssues;
|
|
1970
2032
|
exports.outputConfigSchema = outputConfigSchema;
|
|
1971
2033
|
exports.packageConfigSchema = packageConfigSchema;
|