@fern-api/fern-api-dev 5.109.0 → 5.109.2

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 +99 -28
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -373999,6 +373999,17 @@ async function getAuthFromOverrideFiles(specs) {
373999
373999
  }
374000
374000
  return void 0;
374001
374001
  }
374002
+ function getOrphanedAuthSchemeWarning(api2) {
374003
+ if (api2?.auth != null) {
374004
+ return void 0;
374005
+ }
374006
+ const names2 = Object.keys(api2?.["auth-schemes"] ?? {});
374007
+ const first3 = names2[0];
374008
+ if (first3 == null) {
374009
+ return void 0;
374010
+ }
374011
+ return `generators.yml declares auth-schemes (${names2.join(", ")}) but no \`api.auth\`, so the entire auth-schemes block is ignored \u2014 including any \`env:\` overrides. Add \`auth: ${first3}\` under \`api\`` + (names2.length > 1 ? ", or list them all under an `auth.any` key" : "") + ". Without it, auth is re-derived from the spec's securitySchemes and each generator falls back to its own default environment variable name.";
374012
+ }
374002
374013
  var import_promises41, OSSWorkspace;
374003
374014
  var init_OSSWorkspace = __esm({
374004
374015
  "../workspace/lazy-fern-workspace/lib/OSSWorkspace.js"() {
@@ -374176,6 +374187,10 @@ var init_OSSWorkspace = __esm({
374176
374187
  const specs = await this.getOpenAPISpecsCached({ context: context3 });
374177
374188
  const documents = await this.loader.loadDocuments({ context: context3, specs });
374178
374189
  let authOverrides = this.generatorsConfiguration?.api?.auth != null ? { ...this.generatorsConfiguration?.api } : void 0;
374190
+ const orphanedAuthSchemeWarning = getOrphanedAuthSchemeWarning(this.generatorsConfiguration?.api);
374191
+ if (orphanedAuthSchemeWarning != null) {
374192
+ context3.logger.warn(orphanedAuthSchemeWarning);
374193
+ }
374179
374194
  if (authOverrides == null) {
374180
374195
  authOverrides = await getAuthFromOverrideFiles(specs);
374181
374196
  }
@@ -705213,7 +705228,7 @@ var AccessTokenPosthogManager = class {
705213
705228
  properties: {
705214
705229
  ...event,
705215
705230
  ...event.properties,
705216
- version: "5.109.0",
705231
+ version: "5.109.2",
705217
705232
  usingAccessToken: true,
705218
705233
  ...getRunIdProperties()
705219
705234
  }
@@ -705279,7 +705294,7 @@ var UserPosthogManager = class {
705279
705294
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
705280
705295
  event: "CLI",
705281
705296
  properties: {
705282
- version: "5.109.0",
705297
+ version: "5.109.2",
705283
705298
  ...event,
705284
705299
  ...event.properties,
705285
705300
  usingAccessToken: false,
@@ -881625,9 +881640,54 @@ function createDocsResolverValidationContext() {
881625
881640
  function isV1RootNode2(value2) {
881626
881641
  return "type" in value2 && value2.type === "root";
881627
881642
  }
881643
+ async function getIntermediateRepresentation({ apiWorkspace, ossWorkspaces, useOpenApiParserV3, audiences, logger: logger4 }) {
881644
+ const ossWorkspace = useOpenApiParserV3 ? ossWorkspaces.find((ossWorkspace2) => ossWorkspace2 === apiWorkspace) : void 0;
881645
+ if (ossWorkspace != null) {
881646
+ try {
881647
+ return await ossWorkspace.getIntermediateRepresentation({
881648
+ context: NOOP_CONTEXT,
881649
+ audiences,
881650
+ enableUniqueErrorsPerEndpoint: true,
881651
+ generateV1Examples: false,
881652
+ logWarnings: false
881653
+ });
881654
+ } catch (error50) {
881655
+ logger4.debug(`Failed to load API definition with the OpenAPI parser: ${error50}`);
881656
+ }
881657
+ }
881658
+ try {
881659
+ const fernWorkspace = await apiWorkspace.toFernWorkspace({ context: NOOP_CONTEXT }, {
881660
+ enableUniqueErrorsPerEndpoint: true,
881661
+ detectGlobalHeaders: false,
881662
+ objectQueryParameters: true,
881663
+ preserveSchemaIds: true
881664
+ });
881665
+ return generateIntermediateRepresentation({
881666
+ workspace: fernWorkspace,
881667
+ audiences,
881668
+ generationLanguage: void 0,
881669
+ keywords: void 0,
881670
+ smartCasing: false,
881671
+ exampleGeneration: {
881672
+ disabled: false,
881673
+ skipAutogenerationIfManualExamplesExist: true,
881674
+ skipErrorAutogenerationIfManualErrorExamplesExist: true
881675
+ },
881676
+ readme: void 0,
881677
+ version: void 0,
881678
+ packageName: void 0,
881679
+ context: NOOP_CONTEXT,
881680
+ sourceResolver: new SourceResolverImpl(NOOP_CONTEXT, fernWorkspace)
881681
+ });
881682
+ } catch (error50) {
881683
+ logger4.debug(`Failed to load API definition; skipping link validation for it: ${error50}`);
881684
+ return void 0;
881685
+ }
881686
+ }
881628
881687
  var ValidMarkdownLinks = {
881629
881688
  name: "valid-markdown-links",
881630
- create: async ({ workspace, apiWorkspaces, ossWorkspaces }) => {
881689
+ create: async ({ workspace, apiWorkspaces, ossWorkspaces, logger: logger4 }) => {
881690
+ const useOpenApiParserV3 = workspace.config.experimental?.openapiParserV3 !== false;
881631
881691
  const instanceUrls = getInstanceUrls(workspace);
881632
881692
  const url3 = instanceUrls[0] ?? "http://localhost";
881633
881693
  const baseUrl = toBaseUrl(instanceUrls[0] ?? "http://localhost");
@@ -881737,23 +881797,20 @@ var ValidMarkdownLinks = {
881737
881797
  return [...violations, ...pathToCheckViolations.flat()];
881738
881798
  },
881739
881799
  apiSection: async ({ workspace: apiWorkspace, config: config5 }) => {
881740
- const fernWorkspace = await apiWorkspace.toFernWorkspace({ context: NOOP_CONTEXT }, { enableUniqueErrorsPerEndpoint: true, detectGlobalHeaders: false });
881741
- const ir3 = generateIntermediateRepresentation({
881742
- workspace: fernWorkspace,
881743
- audiences: config5.audiences ? {
881744
- type: "select",
881745
- audiences: Array.isArray(config5.audiences) ? config5.audiences : [config5.audiences]
881746
- } : { type: "all" },
881747
- generationLanguage: void 0,
881748
- keywords: void 0,
881749
- smartCasing: false,
881750
- exampleGeneration: { disabled: false },
881751
- readme: void 0,
881752
- version: void 0,
881753
- packageName: void 0,
881754
- context: NOOP_CONTEXT,
881755
- sourceResolver: new SourceResolverImpl(NOOP_CONTEXT, fernWorkspace)
881800
+ const audiences = config5.audiences ? {
881801
+ type: "select",
881802
+ audiences: Array.isArray(config5.audiences) ? config5.audiences : [config5.audiences]
881803
+ } : { type: "all" };
881804
+ const ir3 = await getIntermediateRepresentation({
881805
+ apiWorkspace,
881806
+ ossWorkspaces,
881807
+ useOpenApiParserV3,
881808
+ audiences,
881809
+ logger: logger4
881756
881810
  });
881811
+ if (ir3 == null) {
881812
+ return [];
881813
+ }
881757
881814
  const api2 = toLatest(convertIrToApiDefinition({ ir: ir3, apiDefinitionId: (0, import_crypto9.randomUUID)(), context: NOOP_CONTEXT }));
881758
881815
  const uniqueDescriptions = collectUniqueDescriptions(api2);
881759
881816
  const violations = [];
@@ -882430,8 +882487,22 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRulesWith
882430
882487
  for (const { ruleName, visitor } of allRulesWithVisitors) {
882431
882488
  const visitFromRule = visitor[nodeType];
882432
882489
  if (visitFromRule != null) {
882433
- const ruleViolations = await visitFromRule(node4);
882434
882490
  const severityOverride = severityOverrides?.get(ruleName);
882491
+ let ruleViolations;
882492
+ try {
882493
+ ruleViolations = await visitFromRule(node4);
882494
+ } catch (error50) {
882495
+ addViolations([
882496
+ {
882497
+ name: ruleName,
882498
+ severity: severityOverride ?? "fatal",
882499
+ relativeFilepath: RelativeFilePath2.of(""),
882500
+ nodePath,
882501
+ message: `Rule "${ruleName}" failed to run: ${formatInitError(error50)}`
882502
+ }
882503
+ ]);
882504
+ continue;
882505
+ }
882435
882506
  addViolations(ruleViolations.map((violation) => ({
882436
882507
  name: violation.name ?? ruleName,
882437
882508
  severity: severityOverride ?? violation.severity,
@@ -886897,7 +886968,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
886897
886968
  var LOGS_FOLDER_NAME = "logs";
886898
886969
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
886899
886970
  function getCliSource() {
886900
- const version7 = "5.109.0";
886971
+ const version7 = "5.109.2";
886901
886972
  return `cli@${version7}`;
886902
886973
  }
886903
886974
  var DebugLogger = class {
@@ -913861,7 +913932,7 @@ var LegacyDocsPublisher = class {
913861
913932
  previewId,
913862
913933
  disableTemplates: void 0,
913863
913934
  skipUpload,
913864
- cliVersion: "5.109.0",
913935
+ cliVersion: "5.109.2",
913865
913936
  loginCommand: "fern auth login"
913866
913937
  });
913867
913938
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -967278,7 +967349,7 @@ init_lib17();
967278
967349
  init_lib36();
967279
967350
  init_lib27();
967280
967351
  init_lib23();
967281
- async function getIntermediateRepresentation({ workspace, audiences, generatorInvocation, context: context3, irVersionOverride, version: version7, packageName, userAgentTemplate, organization, sourceConfig, includeOptionalRequestPropertyExamples, ir: ir3 }) {
967352
+ async function getIntermediateRepresentation2({ workspace, audiences, generatorInvocation, context: context3, irVersionOverride, version: version7, packageName, userAgentTemplate, organization, sourceConfig, includeOptionalRequestPropertyExamples, ir: ir3 }) {
967282
967353
  const resolvedUserAgentTemplate = userAgentTemplate ?? getUserAgentTemplateFromGeneratorConfig(generatorInvocation);
967283
967354
  const idempotencyKeyGeneration = getIdempotencyKeyGenerationFromGeneratorConfig(generatorInvocation);
967284
967355
  const intermediateRepresentation = ir3 ?? generateIntermediateRepresentation({
@@ -968448,7 +968519,7 @@ function extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig) {
968448
968519
  async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFernConfig, workspace, generatorInvocation, absolutePathToLocalOutput, absolutePathToLocalSnippetJSON, absolutePathToLocalSnippetTemplateJSON, audiences, version: version7, workspaceTempDir, keepDocker, context: context3, irVersionOverride, outputVersionOverride, writeUnitTests, generateOauthClients, generatePaginatedClients, includeOptionalRequestPropertyExamples, inspect: inspect6, executionEnvironment, runner, whiteLabel, publishToRegistry, ir: ir3, ai: ai2, autoVersioningCache, absolutePathToSpecRepo, skipFernignore, disableTelemetry, rawApiSpecs }) {
968449
968520
  const irVersion = version7 ?? outputVersionOverride;
968450
968521
  const effectiveIrVersion = irVersion != null && (0, import_autoversion4.isAutoVersion)(irVersion) ? import_autoversion4.MAGIC_VERSION : irVersion;
968451
- const { latest: latest2, migrated } = await getIntermediateRepresentation({
968522
+ const { latest: latest2, migrated } = await getIntermediateRepresentation2({
968452
968523
  workspace,
968453
968524
  audiences,
968454
968525
  generatorInvocation,
@@ -980781,7 +980852,7 @@ function getAutomationContextFromEnv() {
980781
980852
  config_branch: process.env.FERN_CONFIG_BRANCH,
980782
980853
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
980783
980854
  trigger: process.env.GITHUB_EVENT_NAME,
980784
- cli_version: "5.109.0"
980855
+ cli_version: "5.109.2"
980785
980856
  };
980786
980857
  }
980787
980858
  function isAutomationMode() {
@@ -981613,7 +981684,7 @@ var CliContext = class _CliContext {
981613
981684
  if (false) {
981614
981685
  this.logger.error("CLI_VERSION is not defined");
981615
981686
  }
981616
- return "5.109.0";
981687
+ return "5.109.2";
981617
981688
  }
981618
981689
  getCliName() {
981619
981690
  if (false) {
@@ -993853,7 +993924,7 @@ async function generateIrForWorkspaces({
993853
993924
  project.apiWorkspaces.map(async (workspace) => {
993854
993925
  await cliContext.runTaskForWorkspace(workspace, async (context3) => {
993855
993926
  cliContext.logger.info(`Generating IR for workspace ${workspace.workspaceName ?? "api"}`);
993856
- const intermediateRepresentation = await getIntermediateRepresentation2({
993927
+ const intermediateRepresentation = await getIntermediateRepresentation3({
993857
993928
  workspace,
993858
993929
  context: context3,
993859
993930
  generationLanguage,
@@ -993872,7 +993943,7 @@ async function generateIrForWorkspaces({
993872
993943
  })
993873
993944
  );
993874
993945
  }
993875
- async function getIntermediateRepresentation2({
993946
+ async function getIntermediateRepresentation3({
993876
993947
  workspace,
993877
993948
  context: context3,
993878
993949
  generationLanguage,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.109.0",
2
+ "version": "5.109.2",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",