@fern-api/fern-api-dev 3.49.7 → 3.50.0-5-g86adee64545

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.
Files changed (2) hide show
  1. package/cli.cjs +70 -12
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1430941,7 +1430941,7 @@ var AccessTokenPosthogManager = class {
1430941
1430941
  properties: {
1430942
1430942
  ...event,
1430943
1430943
  ...event.properties,
1430944
- version: "3.49.7",
1430944
+ version: "3.50.0-5-g86adee64545",
1430945
1430945
  usingAccessToken: true
1430946
1430946
  }
1430947
1430947
  });
@@ -1431040,7 +1431040,7 @@ var UserPosthogManager = class {
1431040
1431040
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1431041
1431041
  event: "CLI",
1431042
1431042
  properties: {
1431043
- version: "3.49.7",
1431043
+ version: "3.50.0-5-g86adee64545",
1431044
1431044
  ...event,
1431045
1431045
  ...event.properties,
1431046
1431046
  usingAccessToken: false,
@@ -1510475,7 +1510475,7 @@ var CliContext = class {
1510475
1510475
  if (false) {
1510476
1510476
  this.logger.error("CLI_VERSION is not defined");
1510477
1510477
  }
1510478
- return "3.49.7";
1510478
+ return "3.50.0-5-g86adee64545";
1510479
1510479
  }
1510480
1510480
  getCliName() {
1510481
1510481
  if (false) {
@@ -1558190,20 +1558190,22 @@ var ResponseErrorConverter = class extends converters_exports.AbstractConverters
1558190
1558190
  errorName,
1558191
1558191
  errorId,
1558192
1558192
  fernFilepath: convertedSchema.schema.typeDeclaration.name.fernFilepath,
1558193
- convertedSchema
1558193
+ convertedSchema,
1558194
+ mediaTypeObject
1558194
1558195
  });
1558195
1558196
  } else if (convertedSchema.type.type === "named") {
1558196
1558197
  return this.constructErrorConverterOutput({
1558197
1558198
  errorName,
1558198
1558199
  errorId,
1558199
1558200
  fernFilepath: convertedSchema.type.fernFilepath,
1558200
- convertedSchema
1558201
+ convertedSchema,
1558202
+ mediaTypeObject
1558201
1558203
  });
1558202
1558204
  }
1558203
1558205
  }
1558204
1558206
  return void 0;
1558205
1558207
  }
1558206
- constructErrorConverterOutput({ errorName, errorId, fernFilepath, convertedSchema }) {
1558208
+ constructErrorConverterOutput({ errorName, errorId, fernFilepath, convertedSchema, mediaTypeObject }) {
1558207
1558209
  return {
1558208
1558210
  error: {
1558209
1558211
  error: {
@@ -1558218,10 +1558220,54 @@ var ResponseErrorConverter = class extends converters_exports.AbstractConverters
1558218
1558220
  statusCode: this.statusCode,
1558219
1558221
  isWildcardStatusCode: this.isWildcardStatusCode,
1558220
1558222
  inlinedTypes: convertedSchema.inlinedTypes,
1558221
- examples: convertedSchema.examples,
1558223
+ examples: this.convertErrorExamples({ mediaTypeObject }),
1558222
1558224
  headers: this.convertResponseHeaders()
1558223
1558225
  };
1558224
1558226
  }
1558227
+ /**
1558228
+ * Converts error examples from the media type object, using the summary field
1558229
+ * as the example name when available (similar to how endpoint examples work).
1558230
+ */
1558231
+ convertErrorExamples({ mediaTypeObject }) {
1558232
+ const examples = this.context.getNamedExamplesFromMediaTypeObject({
1558233
+ mediaTypeObject,
1558234
+ breadcrumbs: this.breadcrumbs,
1558235
+ defaultExampleName: `${[...this.group, this.method].join("_")}_error_example`
1558236
+ });
1558237
+ if (examples.length === 0) {
1558238
+ return void 0;
1558239
+ }
1558240
+ const usedExampleNames = /* @__PURE__ */ new Set();
1558241
+ const result = {};
1558242
+ for (const [key, example] of examples) {
1558243
+ const resolvedExample = this.context.resolveExampleWithValue(example);
1558244
+ const resolvedExampleObject = this.context.resolveExampleRecursively({
1558245
+ example,
1558246
+ breadcrumbs: this.breadcrumbs
1558247
+ });
1558248
+ const exampleName = this.getIdForErrorExample({ key, example: resolvedExampleObject, usedExampleNames });
1558249
+ usedExampleNames.add(exampleName);
1558250
+ if (resolvedExample != null) {
1558251
+ result[exampleName] = resolvedExample;
1558252
+ }
1558253
+ }
1558254
+ return Object.keys(result).length > 0 ? result : void 0;
1558255
+ }
1558256
+ /**
1558257
+ * Determines the unique identifier for an error example, using the summary field
1558258
+ * when available and handling duplicate collisions.
1558259
+ */
1558260
+ getIdForErrorExample({ key, example, usedExampleNames }) {
1558261
+ if (this.context.isExampleWithSummary(example)) {
1558262
+ const summary = example.summary;
1558263
+ if (!usedExampleNames.has(summary)) {
1558264
+ return summary;
1558265
+ }
1558266
+ const disambiguatedName = `${summary} (${key})`;
1558267
+ return usedExampleNames.has(disambiguatedName) ? key : disambiguatedName;
1558268
+ }
1558269
+ return key;
1558270
+ }
1558225
1558271
  getErrorNameForStatusCode(statusCode, isWildcard) {
1558226
1558272
  if (isWildcard) {
1558227
1558273
  if (statusCode === 400) {
@@ -1611500,7 +1611546,7 @@ var import_path40 = __toESM(require("path"), 1);
1611500
1611546
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
1611501
1611547
  var LOGS_FOLDER_NAME = "logs";
1611502
1611548
  function getCliSource() {
1611503
- const version7 = "3.49.7";
1611549
+ const version7 = "3.50.0-5-g86adee64545";
1611504
1611550
  return `cli@${version7}`;
1611505
1611551
  }
1611506
1611552
  var DebugLogger = class {
@@ -1657279,7 +1657325,8 @@ async function generateAPIWorkspaces({
1657279
1657325
  inspect: inspect4,
1657280
1657326
  lfsOverride,
1657281
1657327
  fernignorePath,
1657282
- dynamicIrOnly
1657328
+ dynamicIrOnly,
1657329
+ outputDir
1657283
1657330
  }) {
1657284
1657331
  let token = void 0;
1657285
1657332
  if (!useLocalDocker) {
@@ -1657336,7 +1657383,7 @@ async function generateAPIWorkspaces({
1657336
1657383
  await Promise.all(
1657337
1657384
  project.apiWorkspaces.map(async (workspace) => {
1657338
1657385
  await cliContext.runTaskForWorkspace(workspace, async (context2) => {
1657339
- const absolutePathToPreview = preview ? join2(workspace.absoluteFilePath, RelativeFilePath2.of(PREVIEW_DIRECTORY)) : void 0;
1657386
+ const absolutePathToPreview = preview ? outputDir != null ? AbsoluteFilePath2.of(resolve5(cwd(), outputDir)) : join2(workspace.absoluteFilePath, RelativeFilePath2.of(PREVIEW_DIRECTORY)) : void 0;
1657340
1657387
  if (absolutePathToPreview != null) {
1657341
1657388
  context2.logger.info(`Writing preview to ${absolutePathToPreview}`);
1657342
1657389
  }
@@ -1664928,6 +1664975,9 @@ function addGenerateCommand2(cli, cliContext) {
1664928
1664975
  boolean: true,
1664929
1664976
  description: "Only upload dynamic IR for specified version, skip SDK generation (remote generation only)",
1664930
1664977
  default: false
1664978
+ }).option("output", {
1664979
+ type: "string",
1664980
+ description: "Custom output directory (currently only supported with --preview for SDK generation)"
1664931
1664981
  }),
1664932
1664982
  async (argv) => {
1664933
1664983
  if (argv.api != null && argv.docs != null) {
@@ -1664959,6 +1665009,12 @@ function addGenerateCommand2(cli, cliContext) {
1664959
1665009
  "The --dynamic-ir-only flag can only be used for API generation, not docs generation."
1664960
1665010
  );
1664961
1665011
  }
1665012
+ if (argv.output != null && !argv.preview) {
1665013
+ return cliContext.failWithoutThrowing("The --output flag currently only works with --preview.");
1665014
+ }
1665015
+ if (argv.output != null && argv.docs != null) {
1665016
+ return cliContext.failWithoutThrowing("The --output flag is not supported for docs generation.");
1665017
+ }
1664962
1665018
  if (argv.api != null) {
1664963
1665019
  return await generateAPIWorkspaces({
1664964
1665020
  project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
@@ -1664978,7 +1665034,8 @@ function addGenerateCommand2(cli, cliContext) {
1664978
1665034
  inspect: false,
1664979
1665035
  lfsOverride: argv.lfsOverride,
1664980
1665036
  fernignorePath: argv.fernignore,
1664981
- dynamicIrOnly: argv["dynamic-ir-only"]
1665037
+ dynamicIrOnly: argv["dynamic-ir-only"],
1665038
+ outputDir: argv.output
1664982
1665039
  });
1664983
1665040
  }
1664984
1665041
  if (argv.docs != null) {
@@ -1665025,7 +1665082,8 @@ function addGenerateCommand2(cli, cliContext) {
1665025
1665082
  inspect: false,
1665026
1665083
  lfsOverride: argv.lfsOverride,
1665027
1665084
  fernignorePath: argv.fernignore,
1665028
- dynamicIrOnly: argv["dynamic-ir-only"]
1665085
+ dynamicIrOnly: argv["dynamic-ir-only"],
1665086
+ outputDir: argv.output
1665029
1665087
  });
1665030
1665088
  }
1665031
1665089
  );
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.49.7",
2
+ "version": "3.50.0-5-g86adee64545",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",