@fern-api/fern-api-dev 3.42.3 → 3.43.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.
Files changed (2) hide show
  1. package/cli.cjs +56 -22
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1309445,7 +1309445,8 @@ var ExperimentalConfig = schemas_exports.object({
1309445
1309445
  openapiParserV3: schemas_exports.property("openapi-parser-v3", schemas_exports.boolean().optional()),
1309446
1309446
  dynamicSnippets: schemas_exports.property("dynamic-snippets", schemas_exports.boolean().optional()),
1309447
1309447
  aiExamples: schemas_exports.property("ai-examples", schemas_exports.boolean().optional()),
1309448
- aiExampleStyleInstructions: schemas_exports.property("ai-example-style-instructions", schemas_exports.string().optional())
1309448
+ aiExampleStyleInstructions: schemas_exports.property("ai-example-style-instructions", schemas_exports.string().optional()),
1309449
+ excludeApis: schemas_exports.property("exclude-apis", schemas_exports.boolean().optional())
1309449
1309450
  });
1309450
1309451
 
1309451
1309452
  // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/AiChatModel.js
@@ -1415659,7 +1415660,7 @@ var AccessTokenPosthogManager = class {
1415659
1415660
  properties: {
1415660
1415661
  ...event,
1415661
1415662
  ...event.properties,
1415662
- version: "3.42.3",
1415663
+ version: "3.43.0",
1415663
1415664
  usingAccessToken: true
1415664
1415665
  }
1415665
1415666
  });
@@ -1415758,7 +1415759,7 @@ var UserPosthogManager = class {
1415758
1415759
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1415759
1415760
  event: "CLI",
1415760
1415761
  properties: {
1415761
- version: "3.42.3",
1415762
+ version: "3.43.0",
1415762
1415763
  ...event,
1415763
1415764
  ...event.properties,
1415764
1415765
  usingAccessToken: false,
@@ -1495952,7 +1495953,7 @@ var CliContext = class {
1495952
1495953
  if (false) {
1495953
1495954
  this.logger.error("CLI_VERSION is not defined");
1495954
1495955
  }
1495955
- return "3.42.3";
1495956
+ return "3.43.0";
1495956
1495957
  }
1495957
1495958
  getCliName() {
1495958
1495959
  if (false) {
@@ -1546283,6 +1546284,16 @@ var definitions4 = {
1546283
1546284
  type: "null"
1546284
1546285
  }
1546285
1546286
  ]
1546287
+ },
1546288
+ "exclude-apis": {
1546289
+ oneOf: [
1546290
+ {
1546291
+ type: "boolean"
1546292
+ },
1546293
+ {
1546294
+ type: "null"
1546295
+ }
1546296
+ ]
1546286
1546297
  }
1546287
1546298
  },
1546288
1546299
  additionalProperties: false
@@ -1591733,7 +1591744,7 @@ var import_path37 = __toESM(require("path"), 1);
1591733
1591744
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
1591734
1591745
  var LOGS_FOLDER_NAME = "logs";
1591735
1591746
  function getCliSource() {
1591736
- const version6 = "3.42.3";
1591747
+ const version6 = "3.43.0";
1591737
1591748
  return `cli@${version6}`;
1591738
1591749
  }
1591739
1591750
  var DebugLogger = class {
@@ -1610734,7 +1610745,8 @@ function getErrorTypeNameKey(declaredErrorName) {
1610734
1610745
  async function generateOpenAPIForWorkspaces({
1610735
1610746
  project,
1610736
1610747
  cliContext,
1610737
- outputPath
1610748
+ outputPath,
1610749
+ indent: indent3
1610738
1610750
  }) {
1610739
1610751
  await Promise.all(
1610740
1610752
  project.apiWorkspaces.map(async (workspace) => {
@@ -1610761,7 +1610773,7 @@ async function generateOpenAPIForWorkspaces({
1610761
1610773
  await (0, import_promises84.mkdir)(dirname2(outputPath), { recursive: true });
1610762
1610774
  await (0, import_promises84.writeFile)(
1610763
1610775
  outputPath,
1610764
- outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, 2) : jsYaml.dump(openapi)
1610776
+ outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent3) : jsYaml.dump(openapi, { indent: indent3 })
1610765
1610777
  );
1610766
1610778
  });
1610767
1610779
  })
@@ -1626832,9 +1626844,12 @@ async function calculateFileHash(absoluteFilePath) {
1626832
1626844
  const fileBuffer = await (0, import_promises97.readFile)(absoluteFilePath);
1626833
1626845
  return (0, import_crypto9.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
1626834
1626846
  }
1626835
- async function publishDocs({ token, organization, docsWorkspace, domain: domain2, customDomains, apiWorkspaces, ossWorkspaces, context: context2, preview, editThisPage, isPrivate = false, disableTemplates = false, skipUpload = false, withAiExamples = true, targetAudiences }) {
1626847
+ async function publishDocs({ token, organization, docsWorkspace, domain: domain2, customDomains, apiWorkspaces, ossWorkspaces, context: context2, preview, editThisPage, isPrivate = false, disableTemplates = false, skipUpload = false, withAiExamples = true, excludeApis = false, targetAudiences }) {
1626836
1626848
  const fdr = createFdrService({ token: token.value });
1626837
1626849
  const authConfig = isPrivate ? { type: "private", authType: "sso" } : { type: "public" };
1626850
+ if (excludeApis) {
1626851
+ context2.logger.debug("Experimental flag 'exclude-apis' is enabled - API references will be excluded from S3 upload");
1626852
+ }
1626838
1626853
  let docsRegistrationId;
1626839
1626854
  let urlToOutput = customDomains[0] ?? domain2;
1626840
1626855
  const basePath = parseBasePath(domain2);
@@ -1627103,7 +1627118,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
1627103
1627118
  const publishStart = performance.now();
1627104
1627119
  const registerDocsResponse = await fdr.docs.v2.write.finishDocsRegister(DocsV1Write_exports.DocsRegistrationId(docsRegistrationId), {
1627105
1627120
  docsDefinition,
1627106
- excludeApis: false,
1627121
+ excludeApis,
1627107
1627122
  libraryDocs: libraryDocsConfig
1627108
1627123
  });
1627109
1627124
  if (registerDocsResponse.ok) {
@@ -1627693,6 +1627708,7 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
1627693
1627708
  disableTemplates,
1627694
1627709
  skipUpload,
1627695
1627710
  withAiExamples: docsWorkspace.config.aiExamples?.enabled ?? docsWorkspace.config.experimental?.aiExamples ?? true,
1627711
+ excludeApis: docsWorkspace.config.experimental?.excludeApis ?? false,
1627696
1627712
  targetAudiences: maybeInstance.audiences ? Array.isArray(maybeInstance.audiences) ? maybeInstance.audiences : [maybeInstance.audiences] : void 0
1627697
1627713
  });
1627698
1627714
  const publishTime = performance.now() - publishStart;
@@ -1639471,7 +1639487,7 @@ var fs22 = __toESM(require("fs"), 1);
1639471
1639487
  var import_promises104 = require("fs/promises");
1639472
1639488
  var import_stream9 = require("stream");
1639473
1639489
  var import_promises105 = require("stream/promises");
1639474
- async function fetchAndWriteFile(url2, path69, logger) {
1639490
+ async function fetchAndWriteFile(url2, path69, logger, indent3) {
1639475
1639491
  const resp = await fetch(url2);
1639476
1639492
  if (resp.ok && resp.body) {
1639477
1639493
  logger.debug("Origin successfully fetched, writing to file");
@@ -1639479,16 +1639495,17 @@ async function fetchAndWriteFile(url2, path69, logger) {
1639479
1639495
  await (0, import_promises105.finished)(import_stream9.Readable.fromWeb(resp.body).pipe(fileStream));
1639480
1639496
  const fileContents = await (0, import_promises104.readFile)(path69, "utf8");
1639481
1639497
  try {
1639482
- await (0, import_promises104.writeFile)(path69, JSON.stringify(JSON.parse(fileContents), void 0, 2), "utf8");
1639498
+ await (0, import_promises104.writeFile)(path69, JSON.stringify(JSON.parse(fileContents), void 0, indent3), "utf8");
1639483
1639499
  } catch (e6) {
1639484
- await (0, import_promises104.writeFile)(path69, jsYaml.dump(jsYaml.load(fileContents)), "utf8");
1639500
+ await (0, import_promises104.writeFile)(path69, jsYaml.dump(jsYaml.load(fileContents), { indent: indent3 }), "utf8");
1639485
1639501
  }
1639486
1639502
  logger.debug("File written successfully");
1639487
1639503
  }
1639488
1639504
  }
1639489
1639505
  async function updateApiSpec({
1639490
1639506
  cliContext,
1639491
- project: { apiWorkspaces }
1639507
+ project: { apiWorkspaces },
1639508
+ indent: indent3
1639492
1639509
  }) {
1639493
1639510
  for (const workspace of apiWorkspaces) {
1639494
1639511
  if (workspace.type === "fern") {
@@ -1639512,7 +1639529,8 @@ async function updateApiSpec({
1639512
1639529
  await processDefinitions({
1639513
1639530
  cliContext,
1639514
1639531
  workspacePath: workspace.absoluteFilePath,
1639515
- apiLocations: generatorConfig.api.definitions
1639532
+ apiLocations: generatorConfig.api.definitions,
1639533
+ indent: indent3
1639516
1639534
  });
1639517
1639535
  return;
1639518
1639536
  } else if (generatorConfig.api.type === "multiNamespace") {
@@ -1639520,14 +1639538,16 @@ async function updateApiSpec({
1639520
1639538
  await processDefinitions({
1639521
1639539
  cliContext,
1639522
1639540
  workspacePath: workspace.absoluteFilePath,
1639523
- apiLocations: generatorConfig.api.rootDefinitions
1639541
+ apiLocations: generatorConfig.api.rootDefinitions,
1639542
+ indent: indent3
1639524
1639543
  });
1639525
1639544
  }
1639526
1639545
  for (const [_15, apiLocations] of Object.entries(generatorConfig.api.definitions)) {
1639527
1639546
  await processDefinitions({
1639528
1639547
  cliContext,
1639529
1639548
  workspacePath: workspace.absoluteFilePath,
1639530
- apiLocations
1639549
+ apiLocations,
1639550
+ indent: indent3
1639531
1639551
  });
1639532
1639552
  }
1639533
1639553
  }
@@ -1639539,7 +1639559,8 @@ async function updateApiSpec({
1639539
1639559
  async function getAndFetchFromAPIDefinitionLocation({
1639540
1639560
  cliContext,
1639541
1639561
  workspacePath,
1639542
- apiLocation
1639562
+ apiLocation,
1639563
+ indent: indent3
1639543
1639564
  }) {
1639544
1639565
  if (apiLocation.schema.type === "protobuf") {
1639545
1639566
  cliContext.logger.info("Encountered conjure API definition, skipping API update.");
@@ -1639550,20 +1639571,23 @@ async function getAndFetchFromAPIDefinitionLocation({
1639550
1639571
  await fetchAndWriteFile(
1639551
1639572
  apiLocation.origin,
1639552
1639573
  join2(workspacePath, RelativeFilePath2.of(apiLocation.schema.path)),
1639553
- cliContext.logger
1639574
+ cliContext.logger,
1639575
+ indent3
1639554
1639576
  );
1639555
1639577
  }
1639556
1639578
  }
1639557
1639579
  async function processDefinitions({
1639558
1639580
  cliContext,
1639559
1639581
  workspacePath,
1639560
- apiLocations
1639582
+ apiLocations,
1639583
+ indent: indent3
1639561
1639584
  }) {
1639562
1639585
  for (const apiLocation of apiLocations) {
1639563
1639586
  await getAndFetchFromAPIDefinitionLocation({
1639564
1639587
  cliContext,
1639565
1639588
  workspacePath,
1639566
- apiLocation
1639589
+ apiLocation,
1639590
+ indent: indent3
1639567
1639591
  });
1639568
1639592
  }
1639569
1639593
  }
@@ -1645564,6 +1645588,10 @@ function addUpdateApiSpecCommand(cli, cliContext) {
1645564
1645588
  (yargs) => yargs.option("api", {
1645565
1645589
  string: true,
1645566
1645590
  description: "The API to update the spec for. If not specified, all APIs with a declared origin will be updated."
1645591
+ }).option("indent", {
1645592
+ type: "number",
1645593
+ description: "Indentation width in spaces (default: 2)",
1645594
+ default: 2
1645567
1645595
  }),
1645568
1645596
  async (argv) => {
1645569
1645597
  await cliContext.instrumentPostHogEvent({
@@ -1645574,7 +1645602,8 @@ function addUpdateApiSpecCommand(cli, cliContext) {
1645574
1645602
  project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
1645575
1645603
  commandLineApiWorkspace: argv.api,
1645576
1645604
  defaultToAllApiWorkspaces: true
1645577
- })
1645605
+ }),
1645606
+ indent: argv.indent
1645578
1645607
  });
1645579
1645608
  }
1645580
1645609
  );
@@ -1646100,6 +1646129,10 @@ function addExportCommand(cli, cliContext) {
1646100
1646129
  }).option("api", {
1646101
1646130
  string: true,
1646102
1646131
  description: "Only run the command on the provided API"
1646132
+ }).option("indent", {
1646133
+ type: "number",
1646134
+ description: "Indentation width in spaces (default: 2)",
1646135
+ default: 2
1646103
1646136
  }),
1646104
1646137
  async (argv) => {
1646105
1646138
  await cliContext.instrumentPostHogEvent({
@@ -1646114,7 +1646147,8 @@ function addExportCommand(cli, cliContext) {
1646114
1646147
  defaultToAllApiWorkspaces: false
1646115
1646148
  }),
1646116
1646149
  cliContext,
1646117
- outputPath: resolve(cwd(), argv.outputPath)
1646150
+ outputPath: resolve(cwd(), argv.outputPath),
1646151
+ indent: argv.indent
1646118
1646152
  });
1646119
1646153
  }
1646120
1646154
  );
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.42.3",
2
+ "version": "3.43.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",