@postman/sdk-config 0.19.1 → 0.21.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 +367 -54
- 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 +367 -55
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +313 -9
- 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 +313 -9
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +313 -9
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +929 -30
- package/dist/sdk-config/v1/index.d.ts +929 -30
- package/dist/sdk-config/v1/index.js +313 -9
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +348 -51
- 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 +348 -52
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +348 -51
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +607 -4
- package/dist/sdk-config-ir/v1/index.d.ts +607 -4
- package/dist/sdk-config-ir/v1/index.js +348 -52
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-D0YeGxxS.d.cts → typescript-DNic6Rq5.d.cts} +80 -1
- package/dist/{typescript-D0YeGxxS.d.ts → typescript-DNic6Rq5.d.ts} +80 -1
- package/package.json +2 -2
- package/src/sdk-config/v1/README.md +82 -15
- package/src/sdk-config-ir/v1/README.md +39 -0
|
@@ -134,6 +134,39 @@ var publicClientIdSchema = nonEmptyStringSchema.refine((value) => value.trim() =
|
|
|
134
134
|
}).refine((value) => !value.includes("${"), {
|
|
135
135
|
message: "must be a literal public client ID, not an environment expression"
|
|
136
136
|
});
|
|
137
|
+
var oauthExtraParametersSchema = z.record(z.string().min(1), z.string());
|
|
138
|
+
function parseUrl(value) {
|
|
139
|
+
try {
|
|
140
|
+
return new URL(value);
|
|
141
|
+
} catch {
|
|
142
|
+
return void 0;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
var loopbackRedirectUriSchema = nonEmptyStringSchema.refine(
|
|
146
|
+
(value) => {
|
|
147
|
+
const url = parseUrl(value);
|
|
148
|
+
return url !== void 0 && url.protocol === "http:" && (url.hostname === "127.0.0.1" || url.hostname === "localhost") && url.port !== "";
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
message: "must be an http URL on 127.0.0.1 or localhost that pins a port, such as http://127.0.0.1:8484/callback"
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
function containsControlCharacter(value) {
|
|
155
|
+
return [...value].some((character) => {
|
|
156
|
+
const code = character.charCodeAt(0);
|
|
157
|
+
return code <= 31 || code === 127;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
var hostedPageUrlSchema = nonEmptyStringSchema.refine(
|
|
161
|
+
(value) => {
|
|
162
|
+
const url = parseUrl(value);
|
|
163
|
+
return url !== void 0 && (url.protocol === "http:" || url.protocol === "https:");
|
|
164
|
+
},
|
|
165
|
+
{ message: "must be an absolute http or https URL" }
|
|
166
|
+
).refine((value) => !containsControlCharacter(value), {
|
|
167
|
+
message: "must not contain control characters"
|
|
168
|
+
});
|
|
169
|
+
var redirectPortSchema = z.number().int().min(1).max(65535);
|
|
137
170
|
var oauthFlowSchema = z.discriminatedUnion("type", [
|
|
138
171
|
z.strictObject({
|
|
139
172
|
type: z.literal("authorization-code").describe("Uses the OAuth authorization code flow."),
|
|
@@ -143,7 +176,25 @@ var oauthFlowSchema = z.discriminatedUnion("type", [
|
|
|
143
176
|
scopes: z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow."),
|
|
144
177
|
clientId: publicClientIdSchema.optional().describe(
|
|
145
178
|
"The public, non-secret OAuth client ID that generated interactive login flows, such as CLI browser login with PKCE, send to the authorization and token endpoints. It is embedded verbatim in generated code, so it must never be a client secret."
|
|
146
|
-
)
|
|
179
|
+
),
|
|
180
|
+
redirectUri: loopbackRedirectUriSchema.optional().describe(
|
|
181
|
+
"The loopback callback of the interactive login, such as http://127.0.0.1:8484/callback. The login binds this exact host, port and path and sends it to the authorization server, so it must match the redirect registered there. Without it the login uses a free port chosen by the operating system."
|
|
182
|
+
),
|
|
183
|
+
redirectUriBackupPorts: z.array(redirectPortSchema).min(1).optional().describe(
|
|
184
|
+
"Ports tried in order when the port of redirectUri is busy. Each reuses the host and path of redirectUri, and every resulting URI must be registered with the authorization server. Requires redirectUri."
|
|
185
|
+
),
|
|
186
|
+
successRedirectUrl: hostedPageUrlSchema.optional().describe(
|
|
187
|
+
"A page the browser is sent to once the login captured the authorization code. Without it the login shows its own page."
|
|
188
|
+
),
|
|
189
|
+
errorRedirectUrl: hostedPageUrlSchema.optional().describe(
|
|
190
|
+
"A page the browser is sent to when the login fails; the error and error_description query parameters are added. Without it the login shows its own page."
|
|
191
|
+
),
|
|
192
|
+
authorizationParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the authorization request, such as audience."),
|
|
193
|
+
tokenParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the authorization code exchange request."),
|
|
194
|
+
refreshParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the token refresh request.")
|
|
195
|
+
}).refine((flow) => flow.redirectUriBackupPorts === void 0 || flow.redirectUri !== void 0, {
|
|
196
|
+
message: "redirectUriBackupPorts requires redirectUri",
|
|
197
|
+
path: ["redirectUriBackupPorts"]
|
|
147
198
|
}),
|
|
148
199
|
z.strictObject({
|
|
149
200
|
type: z.literal("client-credentials").describe("Uses the OAuth client credentials flow."),
|
|
@@ -162,21 +213,47 @@ var oauthFlowSchema = z.discriminatedUnion("type", [
|
|
|
162
213
|
tokenUrl: nonEmptyStringSchema.describe("The URL used to obtain access tokens."),
|
|
163
214
|
refreshUrl: nonEmptyStringSchema.optional().describe("The URL used to refresh access tokens."),
|
|
164
215
|
scopes: z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow.")
|
|
216
|
+
}),
|
|
217
|
+
z.strictObject({
|
|
218
|
+
type: z.literal("device-code").describe(
|
|
219
|
+
"Uses the OAuth device authorization flow (RFC 8628) for logins without a browser."
|
|
220
|
+
),
|
|
221
|
+
clientId: publicClientIdSchema.describe(
|
|
222
|
+
"The public, non-secret OAuth client ID sent to the device authorization and token endpoints. It is embedded verbatim in generated code, so it must never be a client secret."
|
|
223
|
+
),
|
|
224
|
+
deviceAuthorizationUrl: nonEmptyStringSchema.describe(
|
|
225
|
+
"The URL that issues the device code, the user code and the verification URL."
|
|
226
|
+
),
|
|
227
|
+
tokenUrl: nonEmptyStringSchema.describe(
|
|
228
|
+
"The URL polled to exchange the device code for tokens once the user approved."
|
|
229
|
+
),
|
|
230
|
+
refreshUrl: nonEmptyStringSchema.optional().describe("The URL used to refresh access tokens."),
|
|
231
|
+
scopes: z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow."),
|
|
232
|
+
deviceAuthorizationParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the device authorization request, such as audience."),
|
|
233
|
+
tokenParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the token polling request."),
|
|
234
|
+
refreshParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the token refresh request.")
|
|
165
235
|
})
|
|
166
236
|
]);
|
|
167
|
-
var
|
|
237
|
+
var oauth2AuthObjectSchema = z.strictObject({
|
|
168
238
|
id: nonEmptyStringSchema.describe("A unique identifier for this authentication scheme."),
|
|
169
239
|
type: z.literal("oauth2").describe("Identifies an OAuth 2.0 authentication scheme."),
|
|
170
240
|
flows: z.array(oauthFlowSchema).min(1).describe("The OAuth flows supported by the API."),
|
|
171
241
|
clientId: authVariableSchema.optional().describe("The OAuth client ID parameter exposed by the SDK."),
|
|
172
242
|
clientSecret: authVariableSchema.optional().describe("The OAuth client secret parameter exposed by the SDK."),
|
|
173
243
|
tokenHeader: nonEmptyStringSchema.optional().describe("The request header that carries the OAuth access token."),
|
|
174
|
-
tokenPrefix: nonEmptyStringSchema.optional().describe(
|
|
244
|
+
tokenPrefix: nonEmptyStringSchema.optional().describe('The prefix added before the OAuth access token. Defaults to "Bearer" when omitted.'),
|
|
245
|
+
omitTokenPrefix: z.boolean().optional().describe(
|
|
246
|
+
'Whether the OAuth access token is sent as-is, with no prefix. Without it, a missing tokenPrefix means "Bearer". Cannot be combined with tokenPrefix.'
|
|
247
|
+
),
|
|
175
248
|
refreshBufferSeconds: z.number().nonnegative().optional().describe("How early, in seconds, the client refreshes a token before it expires."),
|
|
176
249
|
description: z.string().optional().describe(
|
|
177
250
|
"A description of the authentication scheme included in generated SDK documentation."
|
|
178
251
|
)
|
|
179
252
|
});
|
|
253
|
+
var oauth2AuthSchema = oauth2AuthObjectSchema.refine(
|
|
254
|
+
(scheme) => !(scheme.omitTokenPrefix === true && scheme.tokenPrefix !== void 0),
|
|
255
|
+
{ message: "omitTokenPrefix cannot be combined with tokenPrefix", path: ["omitTokenPrefix"] }
|
|
256
|
+
);
|
|
180
257
|
var customAuthParameterSchema = z.strictObject({
|
|
181
258
|
location: z.enum(["header", "query", "cookie"]).describe("Where the custom authentication value is sent."),
|
|
182
259
|
name: nonEmptyStringSchema.describe("The header, query parameter, or cookie name."),
|
|
@@ -832,6 +909,9 @@ var RESERVED_PROFILES_COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
|
832
909
|
var binaryNameSchema = nonEmptyStringSchema.regex(ALPHANUMERIC_PATTERN, {
|
|
833
910
|
message: "binaryName must contain at least one ASCII letter or digit"
|
|
834
911
|
});
|
|
912
|
+
var crateNameSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,63}$/, {
|
|
913
|
+
message: "crateName must start with a letter, contain only letters, digits, hyphens, and underscores, and be at most 64 characters"
|
|
914
|
+
});
|
|
835
915
|
var rootGroupSchema = z.string().regex(ROOT_GROUP_PATTERN, {
|
|
836
916
|
message: "rootGroup must start with a lowercase letter and contain only lowercase letters, digits, hyphens, and underscores"
|
|
837
917
|
});
|
|
@@ -881,6 +961,28 @@ function fieldNameMapSchema(field) {
|
|
|
881
961
|
}
|
|
882
962
|
});
|
|
883
963
|
}
|
|
964
|
+
var SAFE_TEXT_PATTERN = /^[^"\\\x00-\x1f]*$/;
|
|
965
|
+
var HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/;
|
|
966
|
+
var provisionFlagSchema = z.string().regex(KEBAB_NAME_PATTERN, {
|
|
967
|
+
message: 'profiles.provisionOperation.flag must be a kebab-case flag name without dashes, such as "api-key"'
|
|
968
|
+
});
|
|
969
|
+
var provisionParametersSchema = z.record(z.string(), z.string()).superRefine((value, context) => {
|
|
970
|
+
for (const [key, text] of Object.entries(value)) {
|
|
971
|
+
if (!FIELD_NAME_PATTERN.test(key)) {
|
|
972
|
+
context.addIssue({
|
|
973
|
+
code: "custom",
|
|
974
|
+
message: "profiles.provisionOperation.parameters keys must be field names containing only [A-Za-z0-9_.-]",
|
|
975
|
+
path: [key]
|
|
976
|
+
});
|
|
977
|
+
} else if (!SAFE_TEXT_PATTERN.test(text)) {
|
|
978
|
+
context.addIssue({
|
|
979
|
+
code: "custom",
|
|
980
|
+
message: "profiles.provisionOperation.parameters values must not contain quotes, backslashes or control characters",
|
|
981
|
+
path: [key]
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
});
|
|
884
986
|
var profilesProvisionOperationSchema = z.strictObject({
|
|
885
987
|
operation: dottedCommandPathSchema("profiles.provisionOperation.operation").describe(
|
|
886
988
|
"The dotted command path of the operation that mints a profile credential."
|
|
@@ -888,7 +990,16 @@ var profilesProvisionOperationSchema = z.strictObject({
|
|
|
888
990
|
credential: fieldNameMapSchema("profiles.provisionOperation.credential").refine((value) => Object.keys(value).length > 0, {
|
|
889
991
|
message: "profiles.provisionOperation.credential must map at least one credential field"
|
|
890
992
|
}).describe("Maps each stored credential field to the response field that supplies it."),
|
|
891
|
-
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it.")
|
|
993
|
+
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it."),
|
|
994
|
+
flag: provisionFlagSchema.optional().describe(
|
|
995
|
+
'The long name of the "profiles create" flag, without "--". The generator defaults it to "provision", which stays accepted as a hidden alias.'
|
|
996
|
+
),
|
|
997
|
+
parameters: provisionParametersSchema.optional().describe(
|
|
998
|
+
"Extra request values sent with the operation. {cli}, {profile}, {user} and {host} are substituted; a value the profile sets wins."
|
|
999
|
+
),
|
|
1000
|
+
profileParameters: fieldNameMapSchema("profiles.provisionOperation.profileParameters").optional().describe(
|
|
1001
|
+
"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."
|
|
1002
|
+
)
|
|
892
1003
|
});
|
|
893
1004
|
var profilesConfigSchema = z.strictObject({
|
|
894
1005
|
enabled: z.boolean().describe("Whether the CLI emits profile commands and the global --profile flag."),
|
|
@@ -896,17 +1007,99 @@ var profilesConfigSchema = z.strictObject({
|
|
|
896
1007
|
revokeOperation: dottedCommandPathSchema("profiles.revokeOperation").optional().describe('The dotted command path called by "profiles remove --revoke".'),
|
|
897
1008
|
provisionOperation: profilesProvisionOperationSchema.optional().describe('The operation called by "profiles create --provision" and its response mapping.')
|
|
898
1009
|
});
|
|
1010
|
+
var bannerColorsSchema = (field) => z.array(
|
|
1011
|
+
z.string().regex(HEX_COLOR_PATTERN, {
|
|
1012
|
+
message: `banner.${field} must hold 6-digit hex colours such as "#4949F2"`
|
|
1013
|
+
})
|
|
1014
|
+
);
|
|
1015
|
+
var bannerObjectSchema = z.strictObject({
|
|
1016
|
+
text: nonEmptyStringSchema.describe("The banner text. May span several lines."),
|
|
1017
|
+
colors: bannerColorsSchema("colors").optional().describe("One colour for a solid banner, or several for a gradient along the direction."),
|
|
1018
|
+
lineColors: bannerColorsSchema("lineColors").optional().describe("One colour per line of the banner. Exclusive with colors."),
|
|
1019
|
+
direction: z.enum(["horizontal", "vertical", "diagonal"]).optional().describe("The direction of the gradient. The generator defaults to horizontal."),
|
|
1020
|
+
animate: z.boolean().optional().describe(
|
|
1021
|
+
"Whether root --help on an interactive terminal plays a short shimmer across the banner before printing it."
|
|
1022
|
+
)
|
|
1023
|
+
}).refine((banner) => banner.colors === void 0 || banner.lineColors === void 0, {
|
|
1024
|
+
message: "banner must set either colors (a gradient) or lineColors (one colour per line), not both",
|
|
1025
|
+
path: ["lineColors"]
|
|
1026
|
+
});
|
|
1027
|
+
var bannerSchema = z.union([nonEmptyStringSchema, bannerObjectSchema]);
|
|
1028
|
+
var oauthPropertyPathSchema = z.string().regex(FIELD_NAME_PATTERN, {
|
|
1029
|
+
message: 'must be a property name, or a dotted path to a nested property, such as "data.token"'
|
|
1030
|
+
}).regex(/^[^.]+(\.[^.]+)*$/, { message: "must not have an empty path segment" });
|
|
1031
|
+
var oauthTokenRequestPropertiesSchema = z.strictObject({
|
|
1032
|
+
clientId: oauthPropertyPathSchema.optional().describe('The request property that carries the client ID. Defaults to "client_id".'),
|
|
1033
|
+
clientSecret: oauthPropertyPathSchema.optional().describe('The request property that carries the client secret. Defaults to "client_secret".'),
|
|
1034
|
+
scopes: oauthPropertyPathSchema.optional().describe('The request property that carries the scopes. Defaults to "scope".')
|
|
1035
|
+
});
|
|
1036
|
+
var oauthTokenResponsePropertiesSchema = z.strictObject({
|
|
1037
|
+
accessToken: oauthPropertyPathSchema.optional().describe('The response property that holds the access token. Defaults to "access_token".'),
|
|
1038
|
+
expiresIn: oauthPropertyPathSchema.optional().describe(
|
|
1039
|
+
'The response property that holds the lifetime in seconds. Defaults to "expires_in".'
|
|
1040
|
+
),
|
|
1041
|
+
refreshToken: oauthPropertyPathSchema.optional().describe('The response property that holds the refresh token. Defaults to "refresh_token".')
|
|
1042
|
+
});
|
|
1043
|
+
var oauthTokenEndpointsSchema = z.strictObject({
|
|
1044
|
+
token: z.strictObject({
|
|
1045
|
+
requestProperties: oauthTokenRequestPropertiesSchema.optional().describe("The names of the properties of the token request."),
|
|
1046
|
+
responseProperties: oauthTokenResponsePropertiesSchema.optional().describe("The names of the properties of the token response.")
|
|
1047
|
+
}).optional().describe("The token endpoint of the client credentials flow (its tokenUrl)."),
|
|
1048
|
+
refresh: z.strictObject({
|
|
1049
|
+
requestProperties: z.strictObject({
|
|
1050
|
+
refreshToken: oauthPropertyPathSchema.optional().describe(
|
|
1051
|
+
'The request property that carries the refresh token. Defaults to "refresh_token".'
|
|
1052
|
+
)
|
|
1053
|
+
}).optional().describe("The names of the properties of the refresh request."),
|
|
1054
|
+
responseProperties: oauthTokenResponsePropertiesSchema.optional().describe("The names of the properties of the refresh response.")
|
|
1055
|
+
}).optional().describe("The refresh endpoint of the client credentials flow (its refreshUrl).")
|
|
1056
|
+
});
|
|
1057
|
+
function oauthTokenEndpointsIssues(oauthTokenEndpoints, schemes, basePath) {
|
|
1058
|
+
const flowsById = /* @__PURE__ */ new Map();
|
|
1059
|
+
for (const scheme of schemes ?? []) {
|
|
1060
|
+
const flow = scheme.type === "oauth2" ? scheme.flows?.find((f) => f.type === "client-credentials") : void 0;
|
|
1061
|
+
if (flow !== void 0) {
|
|
1062
|
+
flowsById.set(scheme.id, flow);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
return Object.entries(oauthTokenEndpoints ?? {}).flatMap(([id, endpoints]) => {
|
|
1066
|
+
const flow = flowsById.get(id);
|
|
1067
|
+
if (flow === void 0) {
|
|
1068
|
+
return [
|
|
1069
|
+
{
|
|
1070
|
+
message: `oauthTokenEndpoints "${id}" must name an OAuth scheme with a client-credentials flow`,
|
|
1071
|
+
path: [...basePath, id]
|
|
1072
|
+
}
|
|
1073
|
+
];
|
|
1074
|
+
}
|
|
1075
|
+
return endpoints.refresh !== void 0 && flow.refreshUrl === void 0 ? [
|
|
1076
|
+
{
|
|
1077
|
+
message: `oauthTokenEndpoints "${id}" has refresh settings, but its flow has no refreshUrl`,
|
|
1078
|
+
path: [...basePath, id, "refresh"]
|
|
1079
|
+
}
|
|
1080
|
+
] : [];
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
899
1083
|
var cliGenerationConfigSchema = z.strictObject({
|
|
900
1084
|
paginationParameters: z.array(nonEmptyStringSchema).optional().describe("Request parameter names treated as pagination controls by the CLI."),
|
|
901
1085
|
skills: z.boolean().optional().describe("Whether the generated CLI includes skills that teach AI agents to invoke commands."),
|
|
902
1086
|
binaryName: binaryNameSchema.optional().describe(
|
|
903
1087
|
"The CLI executable name. The generator kebab-cases it and also uses it for the source directory and env-var prefix."
|
|
904
1088
|
),
|
|
1089
|
+
crateName: crateNameSchema.optional().describe(
|
|
1090
|
+
"The name of the generated Cargo package, which release archives and installers are named after. The generator defaults it to the binary name when the output is delivered to GitHub."
|
|
1091
|
+
),
|
|
905
1092
|
customCommands: z.boolean().optional().describe("Whether hand-written command support is generated. The generator defaults to true."),
|
|
906
1093
|
rootGroup: rootGroupSchema.optional().describe("A command group that every spec-derived command is nested under."),
|
|
907
1094
|
profiles: profilesConfigSchema.optional().describe("Named profile command configuration."),
|
|
908
1095
|
splitTypeCrates: z.boolean().optional().describe("Whether generated types are split into one crate per API behind a facade crate."),
|
|
909
|
-
userAgentSuffixFlag: userAgentSuffixFlagSchema.optional().describe('The long flag name, without "--", that appends a product token to the User-Agent.')
|
|
1096
|
+
userAgentSuffixFlag: userAgentSuffixFlagSchema.optional().describe('The long flag name, without "--", that appends a product token to the User-Agent.'),
|
|
1097
|
+
banner: bannerSchema.optional().describe(
|
|
1098
|
+
"The banner printed above root --help: a string, or text with colours, a gradient direction, per-line colours and an animation switch."
|
|
1099
|
+
),
|
|
1100
|
+
oauthTokenEndpoints: z.record(nonEmptyStringSchema, oauthTokenEndpointsSchema).optional().describe(
|
|
1101
|
+
"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."
|
|
1102
|
+
)
|
|
910
1103
|
});
|
|
911
1104
|
|
|
912
1105
|
// src/sdk-config/v1/fern-config-mapper-cli.ts
|
|
@@ -916,10 +1109,18 @@ var CLI_GENERATION_FIELDS = [
|
|
|
916
1109
|
"rootGroup",
|
|
917
1110
|
"profiles",
|
|
918
1111
|
"splitTypeCrates",
|
|
919
|
-
"userAgentSuffixFlag"
|
|
1112
|
+
"userAgentSuffixFlag",
|
|
1113
|
+
"banner"
|
|
920
1114
|
];
|
|
921
1115
|
var PROFILES_FIELDS = ["enabled", "commandName", "revokeOperation"];
|
|
922
|
-
var PROVISION_OPERATION_FIELDS = [
|
|
1116
|
+
var PROVISION_OPERATION_FIELDS = [
|
|
1117
|
+
"operation",
|
|
1118
|
+
"credential",
|
|
1119
|
+
"revokeParameters",
|
|
1120
|
+
"flag",
|
|
1121
|
+
"parameters",
|
|
1122
|
+
"profileParameters"
|
|
1123
|
+
];
|
|
923
1124
|
function mapCliGeneration(config, state, basePath, targetIndex) {
|
|
924
1125
|
const generation = {};
|
|
925
1126
|
for (const field of CLI_GENERATION_FIELDS) {
|
|
@@ -2504,6 +2705,52 @@ var sdkConfigV1CliOutputConfigSchema = z.discriminatedUnion(
|
|
|
2504
2705
|
var sdkConfigV1ReplayConfigSchema = z.strictObject({
|
|
2505
2706
|
enabled: z.boolean().describe("Whether regeneration reapplies customer-authored repository changes.")
|
|
2506
2707
|
});
|
|
2708
|
+
var errorResponsesHttpMethodSchema = z.enum([
|
|
2709
|
+
"get",
|
|
2710
|
+
"post",
|
|
2711
|
+
"put",
|
|
2712
|
+
"patch",
|
|
2713
|
+
"delete",
|
|
2714
|
+
"head",
|
|
2715
|
+
"options",
|
|
2716
|
+
"trace"
|
|
2717
|
+
]);
|
|
2718
|
+
var errorResponsesEnsureSchema = z.strictObject({
|
|
2719
|
+
statusCode: z.number().int().min(400).max(599).describe("The 4xx or 5xx status code added to an operation that does not declare it."),
|
|
2720
|
+
methods: z.array(errorResponsesHttpMethodSchema).optional().describe("The HTTP methods whose operations receive the response. Defaults to all methods.")
|
|
2721
|
+
});
|
|
2722
|
+
var errorResponsesSchema = z.strictObject({
|
|
2723
|
+
schema: z.record(z.string(), z.unknown()).describe(
|
|
2724
|
+
"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."
|
|
2725
|
+
),
|
|
2726
|
+
name: nonEmptyStringSchema.optional().describe(
|
|
2727
|
+
"The name of the generated error body type. Defaults to the schema title, then ProblemDetails."
|
|
2728
|
+
),
|
|
2729
|
+
applyTo: z.enum(["all", "untyped"]).optional().describe(
|
|
2730
|
+
"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."
|
|
2731
|
+
),
|
|
2732
|
+
ensure: z.array(errorResponsesEnsureSchema).optional().describe("Error responses added to operations that do not already declare them.")
|
|
2733
|
+
});
|
|
2734
|
+
var exampleDepthSchema = z.strictObject({
|
|
2735
|
+
maxDepth: z.number().int().min(0).optional().describe("How many levels of optional properties an example includes. 0 leaves them out.")
|
|
2736
|
+
});
|
|
2737
|
+
var exampleGenerationSchema = z.strictObject({
|
|
2738
|
+
request: exampleDepthSchema.optional().describe("Depth of generated request examples."),
|
|
2739
|
+
response: exampleDepthSchema.optional().describe("Depth of generated response examples.")
|
|
2740
|
+
});
|
|
2741
|
+
var resolveAliasesSchema = z.union([
|
|
2742
|
+
z.boolean(),
|
|
2743
|
+
z.strictObject({
|
|
2744
|
+
except: z.array(nonEmptyStringSchema).optional().describe("Component schema names whose aliases are kept.")
|
|
2745
|
+
})
|
|
2746
|
+
]);
|
|
2747
|
+
var endpointFilterSchema = z.strictObject({
|
|
2748
|
+
endpoints: z.array(
|
|
2749
|
+
nonEmptyStringSchema.describe(
|
|
2750
|
+
'An endpoint to keep, as "METHOD /path/template". An entry in another shape is ignored.'
|
|
2751
|
+
)
|
|
2752
|
+
).describe("The only endpoints imported. Every other operation is dropped before conversion.")
|
|
2753
|
+
});
|
|
2507
2754
|
var apiImportSettingsSchema = z.strictObject({
|
|
2508
2755
|
respectNullableSchemas: z.boolean().optional().describe("Whether nullable schemas remain nullable in generated types."),
|
|
2509
2756
|
titleAsSchemaName: z.boolean().optional().describe("Whether a schema title can determine the generated type name."),
|
|
@@ -2532,7 +2779,56 @@ var apiImportSettingsSchema = z.strictObject({
|
|
|
2532
2779
|
resolveSchemaCollisions: z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
|
|
2533
2780
|
asyncApiMessageNaming: z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
|
|
2534
2781
|
defaultIntegerFormat: z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one."),
|
|
2535
|
-
respectByteFormat: z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
|
|
2782
|
+
respectByteFormat: z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes."),
|
|
2783
|
+
additionalPropertiesDefaultsTo: z.boolean().optional().describe(
|
|
2784
|
+
"Whether an object schema that does not declare additionalProperties admits any extra property."
|
|
2785
|
+
),
|
|
2786
|
+
optionalAdditionalProperties: z.boolean().optional().describe("Whether the values of a nullable map are also nullable."),
|
|
2787
|
+
anyOfSiblingPropertiesAsObject: z.boolean().optional().describe(
|
|
2788
|
+
"Whether an anyOf that only constrains which sibling properties are present imports as the object it sits beside."
|
|
2789
|
+
),
|
|
2790
|
+
preserveSingleSchemaOneOf: z.boolean().optional().describe(
|
|
2791
|
+
"Whether a oneOf with a single member stays a union instead of collapsing to that member."
|
|
2792
|
+
),
|
|
2793
|
+
preserveOneOfInAllOf: z.boolean().optional().describe(
|
|
2794
|
+
"Whether a oneOf inside an allOf stays a union of the merged variants instead of being flattened."
|
|
2795
|
+
),
|
|
2796
|
+
removeDiscriminantsFromSchemas: z.enum(["always", "never"]).optional().describe(
|
|
2797
|
+
"Whether the discriminator property is removed from the schemas of a discriminated union."
|
|
2798
|
+
),
|
|
2799
|
+
coerceConstsTo: z.enum(["literals", "enums", "enums-coerceable-to-literals"]).optional().describe(
|
|
2800
|
+
"What a const imports as: a literal, a single-value enum, or an enum that coerceEnumsToLiterals can turn into a literal."
|
|
2801
|
+
),
|
|
2802
|
+
resolveAliases: resolveAliasesSchema.optional().describe(
|
|
2803
|
+
"Whether references to alias-like schemas are replaced by the schema they alias, optionally keeping the named exceptions."
|
|
2804
|
+
),
|
|
2805
|
+
respectForwardCompatibleEnums: z.boolean().optional().describe(
|
|
2806
|
+
"Whether a query or header parameter that accepts an enum or any string keeps both options."
|
|
2807
|
+
),
|
|
2808
|
+
inferForwardCompatible: z.boolean().optional().describe(
|
|
2809
|
+
"Whether a oneOf or anyOf of an enum and a plain string imports as a forward-compatible enum."
|
|
2810
|
+
),
|
|
2811
|
+
respectOperationIdWordBoundaries: z.boolean().optional().describe(
|
|
2812
|
+
"Whether operation ids are split at every word boundary when method names are derived."
|
|
2813
|
+
),
|
|
2814
|
+
namespacedErrors: z.boolean().optional().describe("Whether an error response takes the x-fern-sdk-namespace it declares."),
|
|
2815
|
+
defaultFormParameterEncoding: z.enum(["form", "json"]).optional().describe("How multipart form properties without an explicit content type are encoded."),
|
|
2816
|
+
respectParameterContent: z.boolean().optional().describe(
|
|
2817
|
+
"Whether a header declared with a JSON content entry instead of a schema is typed by that content."
|
|
2818
|
+
),
|
|
2819
|
+
useBytesForBinaryResponse: z.boolean().optional().describe("Whether a binary response is returned as bytes instead of a file stream."),
|
|
2820
|
+
useReadVariantForResponses: z.boolean().optional().describe(
|
|
2821
|
+
"Whether responses use the read variant of a schema that has read-only properties. Needs respectReadonlySchemas."
|
|
2822
|
+
),
|
|
2823
|
+
exampleGeneration: exampleGenerationSchema.optional().describe("How deep the examples generated for operations without one go."),
|
|
2824
|
+
filter: endpointFilterSchema.optional().describe("Restricts the import to a list of endpoints."),
|
|
2825
|
+
groupEnvironmentsByHost: z.boolean().optional().describe("Whether HTTP and WebSocket servers with the same host become one environment."),
|
|
2826
|
+
multiServerStrategy: z.enum(["environment-per-server", "urls-per-environment"]).optional().describe(
|
|
2827
|
+
"Whether each named server is its own environment or a named URL of one environment."
|
|
2828
|
+
),
|
|
2829
|
+
inferDefaultEnvironment: z.boolean().optional().describe("Whether the first server becomes the default environment."),
|
|
2830
|
+
respectPerSpecBasePath: z.boolean().optional().describe("Whether each spec's plain x-fern-base-path applies to that spec's endpoints."),
|
|
2831
|
+
errorResponses: errorResponsesSchema.optional().describe("A shared error body schema applied to the 4xx/5xx responses of the specs.")
|
|
2536
2832
|
});
|
|
2537
2833
|
var sourceSpecTypeSchema = z.enum([
|
|
2538
2834
|
"openapi",
|
|
@@ -3037,7 +3333,7 @@ var sdkConfigV1Schema = z.strictObject({
|
|
|
3037
3333
|
docs: sdkConfigV1DocsConfigSchema.prefault({}).describe("Documentation settings inherited by every target."),
|
|
3038
3334
|
generation: sdkConfigV1GenerationConfigSchema.prefault({}).describe("Generation settings inherited by every target."),
|
|
3039
3335
|
targets: z.array(sdkConfigV1TargetSchema).min(1).describe("Language targets to generate; each language may appear once.")
|
|
3040
|
-
}).superRefine(({ output, package: globalPackage, targets }, context) => {
|
|
3336
|
+
}).superRefine(({ api, output, package: globalPackage, targets }, context) => {
|
|
3041
3337
|
const configuredLanguages = /* @__PURE__ */ new Set();
|
|
3042
3338
|
targets.forEach((target, targetIndex) => {
|
|
3043
3339
|
if (configuredLanguages.has(target.language)) {
|
|
@@ -3049,6 +3345,14 @@ var sdkConfigV1Schema = z.strictObject({
|
|
|
3049
3345
|
}
|
|
3050
3346
|
configuredLanguages.add(target.language);
|
|
3051
3347
|
validateTargetPublishing(target, targetIndex, globalPackage, output, context);
|
|
3348
|
+
if (target.language === "cli") {
|
|
3349
|
+
oauthTokenEndpointsIssues(target.generation?.oauthTokenEndpoints, api.auth?.schemes, [
|
|
3350
|
+
"targets",
|
|
3351
|
+
targetIndex,
|
|
3352
|
+
"generation",
|
|
3353
|
+
"oauthTokenEndpoints"
|
|
3354
|
+
]).forEach((issue) => context.addIssue({ code: "custom", ...issue }));
|
|
3355
|
+
}
|
|
3052
3356
|
});
|
|
3053
3357
|
});
|
|
3054
3358
|
function validateSdkConfigV1(value) {
|