@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."),
|
|
@@ -586,6 +663,9 @@ var RESERVED_PROFILES_COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
|
586
663
|
var binaryNameSchema = nonEmptyStringSchema.regex(ALPHANUMERIC_PATTERN, {
|
|
587
664
|
message: "binaryName must contain at least one ASCII letter or digit"
|
|
588
665
|
});
|
|
666
|
+
var crateNameSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,63}$/, {
|
|
667
|
+
message: "crateName must start with a letter, contain only letters, digits, hyphens, and underscores, and be at most 64 characters"
|
|
668
|
+
});
|
|
589
669
|
var rootGroupSchema = z.string().regex(ROOT_GROUP_PATTERN, {
|
|
590
670
|
message: "rootGroup must start with a lowercase letter and contain only lowercase letters, digits, hyphens, and underscores"
|
|
591
671
|
});
|
|
@@ -635,6 +715,28 @@ function fieldNameMapSchema(field) {
|
|
|
635
715
|
}
|
|
636
716
|
});
|
|
637
717
|
}
|
|
718
|
+
var SAFE_TEXT_PATTERN = /^[^"\\\x00-\x1f]*$/;
|
|
719
|
+
var HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/;
|
|
720
|
+
var provisionFlagSchema = z.string().regex(KEBAB_NAME_PATTERN, {
|
|
721
|
+
message: 'profiles.provisionOperation.flag must be a kebab-case flag name without dashes, such as "api-key"'
|
|
722
|
+
});
|
|
723
|
+
var provisionParametersSchema = z.record(z.string(), z.string()).superRefine((value, context) => {
|
|
724
|
+
for (const [key, text] of Object.entries(value)) {
|
|
725
|
+
if (!FIELD_NAME_PATTERN.test(key)) {
|
|
726
|
+
context.addIssue({
|
|
727
|
+
code: "custom",
|
|
728
|
+
message: "profiles.provisionOperation.parameters keys must be field names containing only [A-Za-z0-9_.-]",
|
|
729
|
+
path: [key]
|
|
730
|
+
});
|
|
731
|
+
} else if (!SAFE_TEXT_PATTERN.test(text)) {
|
|
732
|
+
context.addIssue({
|
|
733
|
+
code: "custom",
|
|
734
|
+
message: "profiles.provisionOperation.parameters values must not contain quotes, backslashes or control characters",
|
|
735
|
+
path: [key]
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
});
|
|
638
740
|
var profilesProvisionOperationSchema = z.strictObject({
|
|
639
741
|
operation: dottedCommandPathSchema("profiles.provisionOperation.operation").describe(
|
|
640
742
|
"The dotted command path of the operation that mints a profile credential."
|
|
@@ -642,7 +744,16 @@ var profilesProvisionOperationSchema = z.strictObject({
|
|
|
642
744
|
credential: fieldNameMapSchema("profiles.provisionOperation.credential").refine((value) => Object.keys(value).length > 0, {
|
|
643
745
|
message: "profiles.provisionOperation.credential must map at least one credential field"
|
|
644
746
|
}).describe("Maps each stored credential field to the response field that supplies it."),
|
|
645
|
-
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it.")
|
|
747
|
+
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it."),
|
|
748
|
+
flag: provisionFlagSchema.optional().describe(
|
|
749
|
+
'The long name of the "profiles create" flag, without "--". The generator defaults it to "provision", which stays accepted as a hidden alias.'
|
|
750
|
+
),
|
|
751
|
+
parameters: provisionParametersSchema.optional().describe(
|
|
752
|
+
"Extra request values sent with the operation. {cli}, {profile}, {user} and {host} are substituted; a value the profile sets wins."
|
|
753
|
+
),
|
|
754
|
+
profileParameters: fieldNameMapSchema("profiles.provisionOperation.profileParameters").optional().describe(
|
|
755
|
+
"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."
|
|
756
|
+
)
|
|
646
757
|
});
|
|
647
758
|
var profilesConfigSchema = z.strictObject({
|
|
648
759
|
enabled: z.boolean().describe("Whether the CLI emits profile commands and the global --profile flag."),
|
|
@@ -650,17 +761,99 @@ var profilesConfigSchema = z.strictObject({
|
|
|
650
761
|
revokeOperation: dottedCommandPathSchema("profiles.revokeOperation").optional().describe('The dotted command path called by "profiles remove --revoke".'),
|
|
651
762
|
provisionOperation: profilesProvisionOperationSchema.optional().describe('The operation called by "profiles create --provision" and its response mapping.')
|
|
652
763
|
});
|
|
764
|
+
var bannerColorsSchema = (field) => z.array(
|
|
765
|
+
z.string().regex(HEX_COLOR_PATTERN, {
|
|
766
|
+
message: `banner.${field} must hold 6-digit hex colours such as "#4949F2"`
|
|
767
|
+
})
|
|
768
|
+
);
|
|
769
|
+
var bannerObjectSchema = z.strictObject({
|
|
770
|
+
text: nonEmptyStringSchema.describe("The banner text. May span several lines."),
|
|
771
|
+
colors: bannerColorsSchema("colors").optional().describe("One colour for a solid banner, or several for a gradient along the direction."),
|
|
772
|
+
lineColors: bannerColorsSchema("lineColors").optional().describe("One colour per line of the banner. Exclusive with colors."),
|
|
773
|
+
direction: z.enum(["horizontal", "vertical", "diagonal"]).optional().describe("The direction of the gradient. The generator defaults to horizontal."),
|
|
774
|
+
animate: z.boolean().optional().describe(
|
|
775
|
+
"Whether root --help on an interactive terminal plays a short shimmer across the banner before printing it."
|
|
776
|
+
)
|
|
777
|
+
}).refine((banner) => banner.colors === void 0 || banner.lineColors === void 0, {
|
|
778
|
+
message: "banner must set either colors (a gradient) or lineColors (one colour per line), not both",
|
|
779
|
+
path: ["lineColors"]
|
|
780
|
+
});
|
|
781
|
+
var bannerSchema = z.union([nonEmptyStringSchema, bannerObjectSchema]);
|
|
782
|
+
var oauthPropertyPathSchema = z.string().regex(FIELD_NAME_PATTERN, {
|
|
783
|
+
message: 'must be a property name, or a dotted path to a nested property, such as "data.token"'
|
|
784
|
+
}).regex(/^[^.]+(\.[^.]+)*$/, { message: "must not have an empty path segment" });
|
|
785
|
+
var oauthTokenRequestPropertiesSchema = z.strictObject({
|
|
786
|
+
clientId: oauthPropertyPathSchema.optional().describe('The request property that carries the client ID. Defaults to "client_id".'),
|
|
787
|
+
clientSecret: oauthPropertyPathSchema.optional().describe('The request property that carries the client secret. Defaults to "client_secret".'),
|
|
788
|
+
scopes: oauthPropertyPathSchema.optional().describe('The request property that carries the scopes. Defaults to "scope".')
|
|
789
|
+
});
|
|
790
|
+
var oauthTokenResponsePropertiesSchema = z.strictObject({
|
|
791
|
+
accessToken: oauthPropertyPathSchema.optional().describe('The response property that holds the access token. Defaults to "access_token".'),
|
|
792
|
+
expiresIn: oauthPropertyPathSchema.optional().describe(
|
|
793
|
+
'The response property that holds the lifetime in seconds. Defaults to "expires_in".'
|
|
794
|
+
),
|
|
795
|
+
refreshToken: oauthPropertyPathSchema.optional().describe('The response property that holds the refresh token. Defaults to "refresh_token".')
|
|
796
|
+
});
|
|
797
|
+
var oauthTokenEndpointsSchema = z.strictObject({
|
|
798
|
+
token: z.strictObject({
|
|
799
|
+
requestProperties: oauthTokenRequestPropertiesSchema.optional().describe("The names of the properties of the token request."),
|
|
800
|
+
responseProperties: oauthTokenResponsePropertiesSchema.optional().describe("The names of the properties of the token response.")
|
|
801
|
+
}).optional().describe("The token endpoint of the client credentials flow (its tokenUrl)."),
|
|
802
|
+
refresh: z.strictObject({
|
|
803
|
+
requestProperties: z.strictObject({
|
|
804
|
+
refreshToken: oauthPropertyPathSchema.optional().describe(
|
|
805
|
+
'The request property that carries the refresh token. Defaults to "refresh_token".'
|
|
806
|
+
)
|
|
807
|
+
}).optional().describe("The names of the properties of the refresh request."),
|
|
808
|
+
responseProperties: oauthTokenResponsePropertiesSchema.optional().describe("The names of the properties of the refresh response.")
|
|
809
|
+
}).optional().describe("The refresh endpoint of the client credentials flow (its refreshUrl).")
|
|
810
|
+
});
|
|
811
|
+
function oauthTokenEndpointsIssues(oauthTokenEndpoints, schemes, basePath) {
|
|
812
|
+
const flowsById = /* @__PURE__ */ new Map();
|
|
813
|
+
for (const scheme of schemes ?? []) {
|
|
814
|
+
const flow = scheme.type === "oauth2" ? scheme.flows?.find((f) => f.type === "client-credentials") : void 0;
|
|
815
|
+
if (flow !== void 0) {
|
|
816
|
+
flowsById.set(scheme.id, flow);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return Object.entries(oauthTokenEndpoints ?? {}).flatMap(([id, endpoints]) => {
|
|
820
|
+
const flow = flowsById.get(id);
|
|
821
|
+
if (flow === void 0) {
|
|
822
|
+
return [
|
|
823
|
+
{
|
|
824
|
+
message: `oauthTokenEndpoints "${id}" must name an OAuth scheme with a client-credentials flow`,
|
|
825
|
+
path: [...basePath, id]
|
|
826
|
+
}
|
|
827
|
+
];
|
|
828
|
+
}
|
|
829
|
+
return endpoints.refresh !== void 0 && flow.refreshUrl === void 0 ? [
|
|
830
|
+
{
|
|
831
|
+
message: `oauthTokenEndpoints "${id}" has refresh settings, but its flow has no refreshUrl`,
|
|
832
|
+
path: [...basePath, id, "refresh"]
|
|
833
|
+
}
|
|
834
|
+
] : [];
|
|
835
|
+
});
|
|
836
|
+
}
|
|
653
837
|
var cliGenerationConfigSchema = z.strictObject({
|
|
654
838
|
paginationParameters: z.array(nonEmptyStringSchema).optional().describe("Request parameter names treated as pagination controls by the CLI."),
|
|
655
839
|
skills: z.boolean().optional().describe("Whether the generated CLI includes skills that teach AI agents to invoke commands."),
|
|
656
840
|
binaryName: binaryNameSchema.optional().describe(
|
|
657
841
|
"The CLI executable name. The generator kebab-cases it and also uses it for the source directory and env-var prefix."
|
|
658
842
|
),
|
|
843
|
+
crateName: crateNameSchema.optional().describe(
|
|
844
|
+
"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."
|
|
845
|
+
),
|
|
659
846
|
customCommands: z.boolean().optional().describe("Whether hand-written command support is generated. The generator defaults to true."),
|
|
660
847
|
rootGroup: rootGroupSchema.optional().describe("A command group that every spec-derived command is nested under."),
|
|
661
848
|
profiles: profilesConfigSchema.optional().describe("Named profile command configuration."),
|
|
662
849
|
splitTypeCrates: z.boolean().optional().describe("Whether generated types are split into one crate per API behind a facade crate."),
|
|
663
|
-
userAgentSuffixFlag: userAgentSuffixFlagSchema.optional().describe('The long flag name, without "--", that appends a product token to the User-Agent.')
|
|
850
|
+
userAgentSuffixFlag: userAgentSuffixFlagSchema.optional().describe('The long flag name, without "--", that appends a product token to the User-Agent.'),
|
|
851
|
+
banner: bannerSchema.optional().describe(
|
|
852
|
+
"The banner printed above root --help: a string, or text with colours, a gradient direction, per-line colours and an animation switch."
|
|
853
|
+
),
|
|
854
|
+
oauthTokenEndpoints: z.record(nonEmptyStringSchema, oauthTokenEndpointsSchema).optional().describe(
|
|
855
|
+
"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."
|
|
856
|
+
)
|
|
664
857
|
});
|
|
665
858
|
var csharpGenerationConfigSchema = z.strictObject({
|
|
666
859
|
useOptionalWrapper: z.boolean().optional().describe("Whether optional values use an explicit Optional wrapper."),
|
|
@@ -1334,6 +1527,52 @@ var outputConfigSchema = z.discriminatedUnion(
|
|
|
1334
1527
|
var replayConfigSchema = z.strictObject({
|
|
1335
1528
|
enabled: z.boolean().describe("Whether regeneration reapplies customer-authored repository changes.")
|
|
1336
1529
|
});
|
|
1530
|
+
var errorResponsesHttpMethodSchema = z.enum([
|
|
1531
|
+
"get",
|
|
1532
|
+
"post",
|
|
1533
|
+
"put",
|
|
1534
|
+
"patch",
|
|
1535
|
+
"delete",
|
|
1536
|
+
"head",
|
|
1537
|
+
"options",
|
|
1538
|
+
"trace"
|
|
1539
|
+
]);
|
|
1540
|
+
var errorResponsesEnsureSchema = z.strictObject({
|
|
1541
|
+
statusCode: z.number().int().min(400).max(599).describe("The 4xx or 5xx status code added to an operation that does not declare it."),
|
|
1542
|
+
methods: z.array(errorResponsesHttpMethodSchema).optional().describe("The HTTP methods whose operations receive the response. Defaults to all methods.")
|
|
1543
|
+
});
|
|
1544
|
+
var errorResponsesSchema = z.strictObject({
|
|
1545
|
+
schema: z.record(z.string(), z.unknown()).describe(
|
|
1546
|
+
"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."
|
|
1547
|
+
),
|
|
1548
|
+
name: nonEmptyStringSchema.optional().describe(
|
|
1549
|
+
"The name of the generated error body type. Defaults to the schema title, then ProblemDetails."
|
|
1550
|
+
),
|
|
1551
|
+
applyTo: z.enum(["all", "untyped"]).optional().describe(
|
|
1552
|
+
"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."
|
|
1553
|
+
),
|
|
1554
|
+
ensure: z.array(errorResponsesEnsureSchema).optional().describe("Error responses added to operations that do not already declare them.")
|
|
1555
|
+
});
|
|
1556
|
+
var exampleDepthSchema = z.strictObject({
|
|
1557
|
+
maxDepth: z.number().int().min(0).optional().describe("How many levels of optional properties an example includes. 0 leaves them out.")
|
|
1558
|
+
});
|
|
1559
|
+
var exampleGenerationSchema = z.strictObject({
|
|
1560
|
+
request: exampleDepthSchema.optional().describe("Depth of generated request examples."),
|
|
1561
|
+
response: exampleDepthSchema.optional().describe("Depth of generated response examples.")
|
|
1562
|
+
});
|
|
1563
|
+
var resolveAliasesSchema = z.union([
|
|
1564
|
+
z.boolean(),
|
|
1565
|
+
z.strictObject({
|
|
1566
|
+
except: z.array(nonEmptyStringSchema).optional().describe("Component schema names whose aliases are kept.")
|
|
1567
|
+
})
|
|
1568
|
+
]);
|
|
1569
|
+
var endpointFilterSchema = z.strictObject({
|
|
1570
|
+
endpoints: z.array(
|
|
1571
|
+
nonEmptyStringSchema.describe(
|
|
1572
|
+
'An endpoint to keep, as "METHOD /path/template". An entry in another shape is ignored.'
|
|
1573
|
+
)
|
|
1574
|
+
).describe("The only endpoints imported. Every other operation is dropped before conversion.")
|
|
1575
|
+
});
|
|
1337
1576
|
var apiImportSettingsSchema = z.strictObject({
|
|
1338
1577
|
respectNullableSchemas: z.boolean().optional().describe("Whether nullable schemas remain nullable in generated types."),
|
|
1339
1578
|
titleAsSchemaName: z.boolean().optional().describe("Whether a schema title can determine the generated type name."),
|
|
@@ -1362,7 +1601,56 @@ var apiImportSettingsSchema = z.strictObject({
|
|
|
1362
1601
|
resolveSchemaCollisions: z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
|
|
1363
1602
|
asyncApiMessageNaming: z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
|
|
1364
1603
|
defaultIntegerFormat: z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one."),
|
|
1365
|
-
respectByteFormat: z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
|
|
1604
|
+
respectByteFormat: z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes."),
|
|
1605
|
+
additionalPropertiesDefaultsTo: z.boolean().optional().describe(
|
|
1606
|
+
"Whether an object schema that does not declare additionalProperties admits any extra property."
|
|
1607
|
+
),
|
|
1608
|
+
optionalAdditionalProperties: z.boolean().optional().describe("Whether the values of a nullable map are also nullable."),
|
|
1609
|
+
anyOfSiblingPropertiesAsObject: z.boolean().optional().describe(
|
|
1610
|
+
"Whether an anyOf that only constrains which sibling properties are present imports as the object it sits beside."
|
|
1611
|
+
),
|
|
1612
|
+
preserveSingleSchemaOneOf: z.boolean().optional().describe(
|
|
1613
|
+
"Whether a oneOf with a single member stays a union instead of collapsing to that member."
|
|
1614
|
+
),
|
|
1615
|
+
preserveOneOfInAllOf: z.boolean().optional().describe(
|
|
1616
|
+
"Whether a oneOf inside an allOf stays a union of the merged variants instead of being flattened."
|
|
1617
|
+
),
|
|
1618
|
+
removeDiscriminantsFromSchemas: z.enum(["always", "never"]).optional().describe(
|
|
1619
|
+
"Whether the discriminator property is removed from the schemas of a discriminated union."
|
|
1620
|
+
),
|
|
1621
|
+
coerceConstsTo: z.enum(["literals", "enums", "enums-coerceable-to-literals"]).optional().describe(
|
|
1622
|
+
"What a const imports as: a literal, a single-value enum, or an enum that coerceEnumsToLiterals can turn into a literal."
|
|
1623
|
+
),
|
|
1624
|
+
resolveAliases: resolveAliasesSchema.optional().describe(
|
|
1625
|
+
"Whether references to alias-like schemas are replaced by the schema they alias, optionally keeping the named exceptions."
|
|
1626
|
+
),
|
|
1627
|
+
respectForwardCompatibleEnums: z.boolean().optional().describe(
|
|
1628
|
+
"Whether a query or header parameter that accepts an enum or any string keeps both options."
|
|
1629
|
+
),
|
|
1630
|
+
inferForwardCompatible: z.boolean().optional().describe(
|
|
1631
|
+
"Whether a oneOf or anyOf of an enum and a plain string imports as a forward-compatible enum."
|
|
1632
|
+
),
|
|
1633
|
+
respectOperationIdWordBoundaries: z.boolean().optional().describe(
|
|
1634
|
+
"Whether operation ids are split at every word boundary when method names are derived."
|
|
1635
|
+
),
|
|
1636
|
+
namespacedErrors: z.boolean().optional().describe("Whether an error response takes the x-fern-sdk-namespace it declares."),
|
|
1637
|
+
defaultFormParameterEncoding: z.enum(["form", "json"]).optional().describe("How multipart form properties without an explicit content type are encoded."),
|
|
1638
|
+
respectParameterContent: z.boolean().optional().describe(
|
|
1639
|
+
"Whether a header declared with a JSON content entry instead of a schema is typed by that content."
|
|
1640
|
+
),
|
|
1641
|
+
useBytesForBinaryResponse: z.boolean().optional().describe("Whether a binary response is returned as bytes instead of a file stream."),
|
|
1642
|
+
useReadVariantForResponses: z.boolean().optional().describe(
|
|
1643
|
+
"Whether responses use the read variant of a schema that has read-only properties. Needs respectReadonlySchemas."
|
|
1644
|
+
),
|
|
1645
|
+
exampleGeneration: exampleGenerationSchema.optional().describe("How deep the examples generated for operations without one go."),
|
|
1646
|
+
filter: endpointFilterSchema.optional().describe("Restricts the import to a list of endpoints."),
|
|
1647
|
+
groupEnvironmentsByHost: z.boolean().optional().describe("Whether HTTP and WebSocket servers with the same host become one environment."),
|
|
1648
|
+
multiServerStrategy: z.enum(["environment-per-server", "urls-per-environment"]).optional().describe(
|
|
1649
|
+
"Whether each named server is its own environment or a named URL of one environment."
|
|
1650
|
+
),
|
|
1651
|
+
inferDefaultEnvironment: z.boolean().optional().describe("Whether the first server becomes the default environment."),
|
|
1652
|
+
respectPerSpecBasePath: z.boolean().optional().describe("Whether each spec's plain x-fern-base-path applies to that spec's endpoints."),
|
|
1653
|
+
errorResponses: errorResponsesSchema.optional().describe("A shared error body schema applied to the 4xx/5xx responses of the specs.")
|
|
1366
1654
|
});
|
|
1367
1655
|
var sourceSpecTypeSchema = z.enum([
|
|
1368
1656
|
"openapi",
|
|
@@ -1548,63 +1836,71 @@ var sdkConfigIrV1Schema = z.strictObject({
|
|
|
1548
1836
|
"Shared and language-specific generation behavior."
|
|
1549
1837
|
),
|
|
1550
1838
|
compatibility: compatibilityConfigSchema.optional().describe("Temporary provenance and diagnostics retained during legacy migration.")
|
|
1551
|
-
}).superRefine(
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
[
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1839
|
+
}).superRefine(
|
|
1840
|
+
({ api, compatibility, generation, output, package: packageConfig, target }, context) => {
|
|
1841
|
+
const configuredLanguages = Object.keys(generation.language ?? {});
|
|
1842
|
+
const requiresExternalPublishIdentity = output.delivery === "github" || output.publish !== void 0;
|
|
1843
|
+
if (requiresExternalPublishIdentity) {
|
|
1844
|
+
[
|
|
1845
|
+
["apiName", "target.apiName is required for external publishing"],
|
|
1846
|
+
["organizationName", "target.organizationName is required for external publishing"]
|
|
1847
|
+
].forEach(([field, message]) => {
|
|
1848
|
+
if (!target[field]) {
|
|
1849
|
+
context.addIssue({
|
|
1850
|
+
code: "custom",
|
|
1851
|
+
message,
|
|
1852
|
+
path: ["target", field]
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
oauthTokenEndpointsIssues(generation.language?.cli?.oauthTokenEndpoints, api.auth?.schemes, [
|
|
1858
|
+
"generation",
|
|
1859
|
+
"language",
|
|
1860
|
+
"cli",
|
|
1861
|
+
"oauthTokenEndpoints"
|
|
1862
|
+
]).forEach((issue) => context.addIssue({ code: "custom", ...issue }));
|
|
1863
|
+
configuredLanguages.forEach((language) => {
|
|
1864
|
+
if (language !== target.language) {
|
|
1560
1865
|
context.addIssue({
|
|
1561
1866
|
code: "custom",
|
|
1562
|
-
message
|
|
1563
|
-
path: ["
|
|
1867
|
+
message: `generation.language.${language} does not match target language "${target.language}"`,
|
|
1868
|
+
path: ["generation", "language", language]
|
|
1564
1869
|
});
|
|
1565
1870
|
}
|
|
1566
1871
|
});
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1872
|
+
if (output.publish && !publishRegistryLanguages[output.publish.registry].some(
|
|
1873
|
+
(language) => language === target.language
|
|
1874
|
+
)) {
|
|
1570
1875
|
context.addIssue({
|
|
1571
1876
|
code: "custom",
|
|
1572
|
-
message: `
|
|
1573
|
-
path: ["
|
|
1877
|
+
message: `registry "${output.publish.registry}" is not supported for target language "${target.language}"`,
|
|
1878
|
+
path: ["output", "publish", "registry"]
|
|
1574
1879
|
});
|
|
1575
1880
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
}
|
|
1586
|
-
if (output.publish) {
|
|
1587
|
-
validatePublishingIdentity(packageConfig, output.publish.registry, context);
|
|
1588
|
-
if (output.delivery !== "github" && output.publish.shouldGeneratePublishWorkflow === true) {
|
|
1589
|
-
context.addIssue({
|
|
1590
|
-
code: "custom",
|
|
1591
|
-
message: "output.publish.shouldGeneratePublishWorkflow requires GitHub delivery",
|
|
1592
|
-
path: ["output", "publish", "shouldGeneratePublishWorkflow"]
|
|
1593
|
-
});
|
|
1881
|
+
if (output.publish) {
|
|
1882
|
+
validatePublishingIdentity(packageConfig, output.publish.registry, context);
|
|
1883
|
+
if (output.delivery !== "github" && output.publish.shouldGeneratePublishWorkflow === true) {
|
|
1884
|
+
context.addIssue({
|
|
1885
|
+
code: "custom",
|
|
1886
|
+
message: "output.publish.shouldGeneratePublishWorkflow requires GitHub delivery",
|
|
1887
|
+
path: ["output", "publish", "shouldGeneratePublishWorkflow"]
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1594
1890
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
}
|
|
1891
|
+
validateCliOutput(output, target.language, context);
|
|
1892
|
+
if (compatibility?.legacyInput) {
|
|
1893
|
+
const expectedKind = target.sourceOrigin === "postman" ? "postman-build-parameters" : "fern-generator-invocation";
|
|
1894
|
+
if (compatibility.legacyInput.kind !== expectedKind) {
|
|
1895
|
+
context.addIssue({
|
|
1896
|
+
code: "custom",
|
|
1897
|
+
message: `compatibility.legacyInput kind "${compatibility.legacyInput.kind}" does not match target.sourceOrigin "${target.sourceOrigin}"`,
|
|
1898
|
+
path: ["compatibility", "legacyInput", "kind"]
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1605
1901
|
}
|
|
1606
1902
|
}
|
|
1607
|
-
|
|
1903
|
+
);
|
|
1608
1904
|
function parseSdkConfigIrV1(value) {
|
|
1609
1905
|
return sdkConfigIrV1Schema.parse(value);
|
|
1610
1906
|
}
|
|
@@ -1754,6 +2050,6 @@ function parseSdkConfigIrV1ForConsumption(value) {
|
|
|
1754
2050
|
return parseSdkConfigIrV1(stripUnknownProperties(value, sdkConfigIrV1InputJsonSchema));
|
|
1755
2051
|
}
|
|
1756
2052
|
|
|
1757
|
-
export { CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, SDK_CONFIG_IR_V1_SCHEMA_VERSION, apiConfigSchema, apiImportSettingsSchema, authConfigSchema, authSchemeSchema, cliDistributionConfigSchema, cliDistributionGithubAppSchema, cliDistributionHomebrewSchema, cliDistributionScoopSchema, cliGenerationConfigSchema, clientConfigOverrideSchema, clientConfigSchema, clientRetryOverrideSchema, compatibilityConfigSchema, composerPackageNameSchema, csharpGenerationConfigSchema, dependencySchema, docsConfigSchema, exactSemverSchema, generationConfigSchema, getSdkConfigIrV1Diagnostics, githubActionsSecretNameSchema, goGenerationConfigSchema, goModulePathSchema, javaGenerationConfigSchema, jsonObjectSchema, jsonValueSchema, kotlinGenerationConfigSchema, languageGenerationConfigSchema, legacyInputSchema, mcpAvailabilityStatuses, mcpGenerationConfigSchema, nonEmptyStringSchema, outputConfigSchema, packageConfigSchema, parentRelativePathSchema, parseSdkConfigIrV1, parseSdkConfigIrV1ForConsumption, phpGenerationConfigSchema, publishConfigSchema, publishRegistrySchema, pythonGenerationConfigSchema, readmeCustomSectionSchema, readmeEndpointSchema, relativePathSchema, replayConfigSchema, rubyGenerationConfigSchema, rustGenerationConfigSchema, sdkConfigIrCapabilitySchema, sdkConfigIrV1Schema, serializeSdkConfigIrV1, sourceConfigSchema, sourceSpecConfigSchema, sourceSpecOriginSchema, sourceSpecTypeSchema, swiftGenerationConfigSchema, targetConfigSchema, targetLanguageSchema, terraformGenerationConfigSchema, typescriptGenerationConfigSchema, unsupportedFieldSchema, webhookSignatureSchema };
|
|
2053
|
+
export { CLI_DISTRIBUTION_NON_RELEASE_MODE_CODE, SDK_CONFIG_IR_V1_SCHEMA_VERSION, apiConfigSchema, apiImportSettingsSchema, authConfigSchema, authSchemeSchema, cliDistributionConfigSchema, cliDistributionGithubAppSchema, cliDistributionHomebrewSchema, cliDistributionScoopSchema, cliGenerationConfigSchema, clientConfigOverrideSchema, clientConfigSchema, clientRetryOverrideSchema, compatibilityConfigSchema, composerPackageNameSchema, csharpGenerationConfigSchema, dependencySchema, docsConfigSchema, exactSemverSchema, generationConfigSchema, getSdkConfigIrV1Diagnostics, githubActionsSecretNameSchema, goGenerationConfigSchema, goModulePathSchema, javaGenerationConfigSchema, jsonObjectSchema, jsonValueSchema, kotlinGenerationConfigSchema, languageGenerationConfigSchema, legacyInputSchema, mcpAvailabilityStatuses, mcpGenerationConfigSchema, nonEmptyStringSchema, oauthTokenEndpointsIssues, outputConfigSchema, packageConfigSchema, parentRelativePathSchema, parseSdkConfigIrV1, parseSdkConfigIrV1ForConsumption, phpGenerationConfigSchema, publishConfigSchema, publishRegistrySchema, pythonGenerationConfigSchema, readmeCustomSectionSchema, readmeEndpointSchema, relativePathSchema, replayConfigSchema, rubyGenerationConfigSchema, rustGenerationConfigSchema, sdkConfigIrCapabilitySchema, sdkConfigIrV1Schema, serializeSdkConfigIrV1, sourceConfigSchema, sourceSpecConfigSchema, sourceSpecOriginSchema, sourceSpecTypeSchema, swiftGenerationConfigSchema, targetConfigSchema, targetLanguageSchema, terraformGenerationConfigSchema, typescriptGenerationConfigSchema, unsupportedFieldSchema, webhookSignatureSchema };
|
|
1758
2054
|
//# sourceMappingURL=index.js.map
|
|
1759
2055
|
//# sourceMappingURL=index.js.map
|