@fern-api/fern-api-dev 5.58.0 → 5.59.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/cli.cjs +123 -6
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -76219,6 +76219,7 @@ var init_V2HttpEndpointExample2 = __esm({
|
|
|
76219
76219
|
init_V2HttpEndpointResponse2();
|
|
76220
76220
|
V2HttpEndpointExample = schemas_exports3.objectWithoutOptionalProperties({
|
|
76221
76221
|
displayName: schemas_exports3.string().optional(),
|
|
76222
|
+
contentType: schemas_exports3.string().optional(),
|
|
76222
76223
|
request: V2HttpEndpointRequest.optional(),
|
|
76223
76224
|
response: V2HttpEndpointResponse.optional(),
|
|
76224
76225
|
codeSamples: schemas_exports3.list(V2HttpEndpointCodeSample).optional()
|
|
@@ -263778,6 +263779,7 @@ function maybeCreateAndStoreExample({ key: key2, displayName, request: request7,
|
|
|
263778
263779
|
if (!exampleStore.has(key2)) {
|
|
263779
263780
|
const example = {
|
|
263780
263781
|
displayName,
|
|
263782
|
+
contentType: void 0,
|
|
263781
263783
|
request: request7,
|
|
263782
263784
|
response,
|
|
263783
263785
|
codeSamples: void 0
|
|
@@ -350712,6 +350714,19 @@ var init_OperationConverter = __esm({
|
|
|
350712
350714
|
}
|
|
350713
350715
|
}
|
|
350714
350716
|
}
|
|
350717
|
+
if (Object.keys(fernExamples.examples).length === 0 && Object.keys(fernExamples.streamExamples).length === 0 && convertedRequestBodies != null && convertedRequestBodies.length > 1) {
|
|
350718
|
+
const perContentTypeExamples = this.synthesizeEndpointExamplesFromPerContentTypeRequestBodies({
|
|
350719
|
+
convertedRequestBodies,
|
|
350720
|
+
httpPath: path119,
|
|
350721
|
+
httpMethod,
|
|
350722
|
+
baseUrl
|
|
350723
|
+
});
|
|
350724
|
+
if (perContentTypeExamples != null) {
|
|
350725
|
+
for (const [name2, example] of Object.entries(perContentTypeExamples)) {
|
|
350726
|
+
fernExamples.examples[name2] = example;
|
|
350727
|
+
}
|
|
350728
|
+
}
|
|
350729
|
+
}
|
|
350715
350730
|
const endpointLevelSecuritySchemes = new Set(this.operation.security?.flatMap((securityRequirement) => Object.keys(securityRequirement)) ?? []);
|
|
350716
350731
|
const securityHeaders = this.authSchemeToHeaders(Array.from(endpointLevelSecuritySchemes));
|
|
350717
350732
|
if (securityHeaders.length > 0) {
|
|
@@ -351235,6 +351250,7 @@ var init_OperationConverter = __esm({
|
|
|
351235
351250
|
if (resolvedValue != null) {
|
|
351236
351251
|
result[name2] = {
|
|
351237
351252
|
displayName: void 0,
|
|
351253
|
+
contentType: void 0,
|
|
351238
351254
|
request: {
|
|
351239
351255
|
docs: void 0,
|
|
351240
351256
|
endpoint: {
|
|
@@ -351298,6 +351314,104 @@ var init_OperationConverter = __esm({
|
|
|
351298
351314
|
}
|
|
351299
351315
|
return void 0;
|
|
351300
351316
|
}
|
|
351317
|
+
/**
|
|
351318
|
+
* Synthesizes endpoint-level v2Examples from per-content-type request body
|
|
351319
|
+
* examples that have already been extracted by the RequestBodyConverter.
|
|
351320
|
+
*
|
|
351321
|
+
* This handles the case where multiple content types (e.g. application/json
|
|
351322
|
+
* and application/ld+json) reference the same schema but have distinct
|
|
351323
|
+
* per-content-type examples. The RequestBodyConverter correctly extracts
|
|
351324
|
+
* these into each body's v2Examples, but they need to be elevated to
|
|
351325
|
+
* endpoint-level examples (tagged with contentType) for docs rendering.
|
|
351326
|
+
*/
|
|
351327
|
+
synthesizeEndpointExamplesFromPerContentTypeRequestBodies({ convertedRequestBodies, httpPath, httpMethod, baseUrl }) {
|
|
351328
|
+
const result = {};
|
|
351329
|
+
const responseExamplesByContentType = this.extractNativeResponseExamplesByContentType();
|
|
351330
|
+
for (const convertedBody of convertedRequestBodies) {
|
|
351331
|
+
const body = convertedBody.requestBody;
|
|
351332
|
+
const bodyContentType = body.contentType;
|
|
351333
|
+
const bodyV2Examples = body.v2Examples;
|
|
351334
|
+
if (bodyV2Examples == null) {
|
|
351335
|
+
continue;
|
|
351336
|
+
}
|
|
351337
|
+
const userExamples = bodyV2Examples.userSpecifiedExamples;
|
|
351338
|
+
if (Object.keys(userExamples).length === 0) {
|
|
351339
|
+
continue;
|
|
351340
|
+
}
|
|
351341
|
+
const matchedResponse = bodyContentType != null ? responseExamplesByContentType.get(bodyContentType) : void 0;
|
|
351342
|
+
for (const [exampleName, exampleValue] of Object.entries(userExamples)) {
|
|
351343
|
+
const key2 = convertedRequestBodies.length > 1 && bodyContentType != null ? `${exampleName} (${bodyContentType})` : exampleName;
|
|
351344
|
+
result[key2] = {
|
|
351345
|
+
displayName: convertedRequestBodies.length > 1 ? key2 : void 0,
|
|
351346
|
+
contentType: bodyContentType ?? void 0,
|
|
351347
|
+
request: {
|
|
351348
|
+
docs: void 0,
|
|
351349
|
+
endpoint: {
|
|
351350
|
+
method: httpMethod,
|
|
351351
|
+
path: this.buildExamplePath(httpPath, {})
|
|
351352
|
+
},
|
|
351353
|
+
baseUrl: void 0,
|
|
351354
|
+
environment: baseUrl,
|
|
351355
|
+
auth: void 0,
|
|
351356
|
+
pathParameters: {},
|
|
351357
|
+
queryParameters: {},
|
|
351358
|
+
headers: {},
|
|
351359
|
+
requestBody: exampleValue
|
|
351360
|
+
},
|
|
351361
|
+
response: matchedResponse ?? this.extractNativeResponseExample() ?? void 0,
|
|
351362
|
+
codeSamples: void 0
|
|
351363
|
+
};
|
|
351364
|
+
}
|
|
351365
|
+
}
|
|
351366
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
351367
|
+
}
|
|
351368
|
+
/**
|
|
351369
|
+
* Extracts native response examples grouped by content type from the
|
|
351370
|
+
* operation's successful (2xx) responses. Used by
|
|
351371
|
+
* synthesizeEndpointExamplesFromPerContentTypeRequestBodies to match
|
|
351372
|
+
* response examples to their corresponding request content types.
|
|
351373
|
+
*/
|
|
351374
|
+
extractNativeResponseExamplesByContentType() {
|
|
351375
|
+
const responsesByContentType = /* @__PURE__ */ new Map();
|
|
351376
|
+
if (this.operation.responses == null) {
|
|
351377
|
+
return responsesByContentType;
|
|
351378
|
+
}
|
|
351379
|
+
for (const [statusCode, response] of Object.entries(this.operation.responses)) {
|
|
351380
|
+
const statusCodeNum = parseInt(statusCode);
|
|
351381
|
+
if (isNaN(statusCodeNum) || statusCodeNum < 200 || statusCodeNum >= 300) {
|
|
351382
|
+
continue;
|
|
351383
|
+
}
|
|
351384
|
+
const resolvedResponse = this.context.resolveMaybeReference({
|
|
351385
|
+
schemaOrReference: response,
|
|
351386
|
+
breadcrumbs: [...this.breadcrumbs, "responses", statusCode]
|
|
351387
|
+
});
|
|
351388
|
+
if (resolvedResponse?.content == null) {
|
|
351389
|
+
continue;
|
|
351390
|
+
}
|
|
351391
|
+
for (const [responseContentType, responseMediaType] of Object.entries(resolvedResponse.content)) {
|
|
351392
|
+
if (responsesByContentType.has(responseContentType)) {
|
|
351393
|
+
continue;
|
|
351394
|
+
}
|
|
351395
|
+
const namedExamples = this.context.getNamedExamplesFromMediaTypeObject({
|
|
351396
|
+
mediaTypeObject: responseMediaType,
|
|
351397
|
+
breadcrumbs: [...this.breadcrumbs, "responses", statusCode],
|
|
351398
|
+
defaultExampleName: "Example"
|
|
351399
|
+
});
|
|
351400
|
+
for (const [, example] of namedExamples) {
|
|
351401
|
+
const resolvedValue = this.context.resolveExampleWithValue(example);
|
|
351402
|
+
if (resolvedValue != null) {
|
|
351403
|
+
responsesByContentType.set(responseContentType, {
|
|
351404
|
+
docs: void 0,
|
|
351405
|
+
statusCode: statusCodeNum,
|
|
351406
|
+
body: api_exports.V2HttpEndpointResponseBody.json(resolvedValue)
|
|
351407
|
+
});
|
|
351408
|
+
break;
|
|
351409
|
+
}
|
|
351410
|
+
}
|
|
351411
|
+
}
|
|
351412
|
+
}
|
|
351413
|
+
return responsesByContentType;
|
|
351414
|
+
}
|
|
351301
351415
|
convertStreamConditionExamples({ httpPath, httpMethod, baseUrl, fernExamples }) {
|
|
351302
351416
|
const filteredJsonExamples = fernExamples.filter((example) => !(example.response != null && "stream" in example.response));
|
|
351303
351417
|
const filteredStreamExamples = fernExamples.filter((example) => example.response != null && "stream" in example.response);
|
|
@@ -351321,6 +351435,7 @@ var init_OperationConverter = __esm({
|
|
|
351321
351435
|
this.getExampleName({ example, exampleIndex }),
|
|
351322
351436
|
{
|
|
351323
351437
|
displayName: void 0,
|
|
351438
|
+
contentType: void 0,
|
|
351324
351439
|
request: example.request != null || example["path-parameters"] != null || example["query-parameters"] != null || example.headers != null ? {
|
|
351325
351440
|
docs: void 0,
|
|
351326
351441
|
endpoint: {
|
|
@@ -352776,6 +352891,7 @@ var init_MethodConverter = __esm({
|
|
|
352776
352891
|
}
|
|
352777
352892
|
examples[exampleName] = {
|
|
352778
352893
|
displayName: void 0,
|
|
352894
|
+
contentType: void 0,
|
|
352779
352895
|
request: {
|
|
352780
352896
|
docs: void 0,
|
|
352781
352897
|
endpoint: {
|
|
@@ -686972,7 +687088,7 @@ var AccessTokenPosthogManager = class {
|
|
|
686972
687088
|
properties: {
|
|
686973
687089
|
...event,
|
|
686974
687090
|
...event.properties,
|
|
686975
|
-
version: "5.
|
|
687091
|
+
version: "5.59.0",
|
|
686976
687092
|
usingAccessToken: true,
|
|
686977
687093
|
...getRunIdProperties()
|
|
686978
687094
|
}
|
|
@@ -687038,7 +687154,7 @@ var UserPosthogManager = class {
|
|
|
687038
687154
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
687039
687155
|
event: "CLI",
|
|
687040
687156
|
properties: {
|
|
687041
|
-
version: "5.
|
|
687157
|
+
version: "5.59.0",
|
|
687042
687158
|
...event,
|
|
687043
687159
|
...event.properties,
|
|
687044
687160
|
usingAccessToken: false,
|
|
@@ -868133,7 +868249,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
868133
868249
|
var LOGS_FOLDER_NAME = "logs";
|
|
868134
868250
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
868135
868251
|
function getCliSource() {
|
|
868136
|
-
const version7 = "5.
|
|
868252
|
+
const version7 = "5.59.0";
|
|
868137
868253
|
return `cli@${version7}`;
|
|
868138
868254
|
}
|
|
868139
868255
|
var DebugLogger = class {
|
|
@@ -900614,7 +900730,7 @@ var LegacyDocsPublisher = class {
|
|
|
900614
900730
|
previewId,
|
|
900615
900731
|
disableTemplates: void 0,
|
|
900616
900732
|
skipUpload,
|
|
900617
|
-
cliVersion: "5.
|
|
900733
|
+
cliVersion: "5.59.0",
|
|
900618
900734
|
loginCommand: "fern auth login"
|
|
900619
900735
|
});
|
|
900620
900736
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -964455,6 +964571,7 @@ init_lib9();
|
|
|
964455
964571
|
function initializeEmptyServiceExample() {
|
|
964456
964572
|
return {
|
|
964457
964573
|
displayName: void 0,
|
|
964574
|
+
contentType: void 0,
|
|
964458
964575
|
request: {
|
|
964459
964576
|
endpoint: {
|
|
964460
964577
|
method: V2EndpointLocationHttpMethod.Post,
|
|
@@ -966883,7 +967000,7 @@ function getAutomationContextFromEnv() {
|
|
|
966883
967000
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
966884
967001
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
966885
967002
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
966886
|
-
cli_version: "5.
|
|
967003
|
+
cli_version: "5.59.0"
|
|
966887
967004
|
};
|
|
966888
967005
|
}
|
|
966889
967006
|
function isAutomationMode() {
|
|
@@ -967715,7 +967832,7 @@ var CliContext = class _CliContext {
|
|
|
967715
967832
|
if (false) {
|
|
967716
967833
|
this.logger.error("CLI_VERSION is not defined");
|
|
967717
967834
|
}
|
|
967718
|
-
return "5.
|
|
967835
|
+
return "5.59.0";
|
|
967719
967836
|
}
|
|
967720
967837
|
getCliName() {
|
|
967721
967838
|
if (false) {
|
package/package.json
CHANGED