fern-api 0.19.2 → 0.19.4

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/bundle.cjs +158 -71
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -797931,7 +797931,7 @@ var AccessTokenPosthogManager = class {
797931
797931
  properties: {
797932
797932
  ...event,
797933
797933
  ...event.properties,
797934
- version: "0.19.2",
797934
+ version: "0.19.4",
797935
797935
  usingAccessToken: true
797936
797936
  }
797937
797937
  });
@@ -797993,7 +797993,7 @@ var UserPosthogManager = class {
797993
797993
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
797994
797994
  event: "CLI",
797995
797995
  properties: {
797996
- version: "0.19.2",
797996
+ version: "0.19.4",
797997
797997
  ...event,
797998
797998
  ...event.properties
797999
797999
  }
@@ -814391,6 +814391,11 @@ var DummyOpenAPIV3ParserContext = class extends AbstractOpenAPIV3ParserContext {
814391
814391
  getErrors() {
814392
814392
  return {};
814393
814393
  }
814394
+ excludeSchema(_schemaId) {
814395
+ }
814396
+ isSchemaExcluded(_schemaId) {
814397
+ return false;
814398
+ }
814394
814399
  };
814395
814400
 
814396
814401
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getFernAvailability.js
@@ -814836,6 +814841,9 @@ function convertStreamingOperation({ operationContext, context, streamingExtensi
814836
814841
  streamingExtension,
814837
814842
  isStreaming: true
814838
814843
  });
814844
+ if ((streamingRequestBody == null ? void 0 : streamingRequestBody.schemaReference) != null) {
814845
+ context.excludeSchema(getSchemaIdFromReference(streamingRequestBody.schemaReference));
814846
+ }
814839
814847
  const streamingResponses = getResponses({
814840
814848
  operation: operationContext.operation,
814841
814849
  response: streamingExtension.responseStream
@@ -814849,7 +814857,7 @@ function convertStreamingOperation({ operationContext, context, streamingExtensi
814849
814857
  } : void 0,
814850
814858
  operation: {
814851
814859
  ...operationContext.operation,
814852
- requestBody: streamingRequestBody,
814860
+ requestBody: streamingRequestBody == null ? void 0 : streamingRequestBody.requestBody,
814853
814861
  responses: streamingResponses
814854
814862
  },
814855
814863
  baseBreadcrumbs: [...operationContext.baseBreadcrumbs, STREAM_SUFFIX]
@@ -814873,7 +814881,7 @@ function convertStreamingOperation({ operationContext, context, streamingExtensi
814873
814881
  ...operationContext,
814874
814882
  operation: {
814875
814883
  ...operationContext.operation,
814876
- requestBody: nonStreamingRequestBody,
814884
+ requestBody: nonStreamingRequestBody == null ? void 0 : nonStreamingRequestBody.requestBody,
814877
814885
  responses: nonStreamingResponses
814878
814886
  }
814879
814887
  },
@@ -814916,14 +814924,18 @@ function getRequestBody2({ context, operation, streamingExtension, isStreaming }
814916
814924
  ...streamingProperty ?? {}
814917
814925
  }
814918
814926
  },
814927
+ title: void 0,
814919
814928
  required: [...resolvedRequstBodySchema.required ?? [], streamingExtension.streamConditionProperty]
814920
814929
  };
814921
814930
  return {
814922
- content: {
814923
- "application/json": {
814924
- schema: requestBodySchemaWithLiteralProperty
814931
+ requestBody: {
814932
+ content: {
814933
+ "application/json": {
814934
+ schema: requestBodySchemaWithLiteralProperty
814935
+ }
814925
814936
  }
814926
- }
814937
+ },
814938
+ schemaReference: isReferenceObject(jsonMediaObject.schema) ? jsonMediaObject.schema : void 0
814927
814939
  };
814928
814940
  }
814929
814941
  function getResponses({ operation, response }) {
@@ -815355,6 +815367,7 @@ var OpenAPIV3ParserContext = class extends AbstractOpenAPIV3ParserContext {
815355
815367
  singleRequestReferencedSchemas = /* @__PURE__ */ new Set();
815356
815368
  discrminatedUnionReferences = {};
815357
815369
  errorBodies = {};
815370
+ schemasToExclude = /* @__PURE__ */ new Set();
815358
815371
  constructor({ document: document4, taskContext, authHeaders }) {
815359
815372
  super({ document: document4, taskContext, authHeaders });
815360
815373
  }
@@ -815414,6 +815427,12 @@ var OpenAPIV3ParserContext = class extends AbstractOpenAPIV3ParserContext {
815414
815427
  });
815415
815428
  return errors;
815416
815429
  }
815430
+ excludeSchema(schemaId) {
815431
+ this.schemasToExclude.add(schemaId);
815432
+ }
815433
+ isSchemaExcluded(schemaId) {
815434
+ return this.schemasToExclude.has(schemaId);
815435
+ }
815417
815436
  };
815418
815437
 
815419
815438
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getFernResolutions.js
@@ -815621,11 +815640,15 @@ function generateIr({ openApi, taskContext, disableExamples }) {
815621
815640
  examples
815622
815641
  };
815623
815642
  });
815624
- const schemas = Object.fromEntries(Object.entries(schemasWithExample).map(([key2, schemaWithExample]) => {
815625
- taskContext.logger.debug(`Converting schema ${key2}`);
815643
+ const schemas = {};
815644
+ for (const [key2, schemaWithExample] of Object.entries(schemasWithExample)) {
815626
815645
  const schema2 = convertSchemaWithExampleToSchema(schemaWithExample);
815627
- return [key2, schema2];
815628
- }));
815646
+ if (context.isSchemaExcluded(key2)) {
815647
+ continue;
815648
+ }
815649
+ schemas[key2] = schema2;
815650
+ taskContext.logger.debug(`Converted schema ${key2}`);
815651
+ }
815629
815652
  const ir = {
815630
815653
  title: openApi.info.title,
815631
815654
  description: openApi.info.description,
@@ -824771,10 +824794,10 @@ var CliContext = class {
824771
824794
  return "fern-api";
824772
824795
  }
824773
824796
  getPackageVersion() {
824774
- if ("0.19.2" == null) {
824797
+ if ("0.19.4" == null) {
824775
824798
  this.logger.error("CLI_VERSION is not defined");
824776
824799
  }
824777
- return "0.19.2";
824800
+ return "0.19.4";
824778
824801
  }
824779
824802
  getCliName() {
824780
824803
  if ("fern" == null) {
@@ -841003,10 +841026,6 @@ async function runRemoteGenerationForAPIWorkspace({ organization, workspace, con
841003
841026
  };
841004
841027
  }
841005
841028
 
841006
- // pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/parseDocsConfiguration.js
841007
- var import_fdr_sdk3 = __toESM(require_dist());
841008
- var import_promises40 = require("fs/promises");
841009
-
841010
841029
  // pnp:/home/circleci/project/.yarn/cache/tinycolor2-npm-1.6.0-8df41252c6-6df4d07fce.zip/node_modules/tinycolor2/esm/tinycolor.js
841011
841030
  function _typeof2(obj) {
841012
841031
  "@babel/helpers - typeof";
@@ -841986,6 +842005,7 @@ function validateWCAG2Parms(parms) {
841986
842005
 
841987
842006
  // pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/convertColorsConfiguration.js
841988
842007
  function convertColorsConfiguration(rawConfig, context) {
842008
+ rawConfig.accentPrimary = rawConfig.accentPrimary ?? rawConfig.accentPrimaryDeprecated;
841989
842009
  const colorType = getColorType(rawConfig);
841990
842010
  switch (colorType) {
841991
842011
  case "dark":
@@ -842041,74 +842061,46 @@ function getColorType({ background, accentPrimary, accentPrimaryDeprecated }) {
842041
842061
  }
842042
842062
  function convertThemedColorConfig(rawConfig, context, theme) {
842043
842063
  var _a2, _b2, _c2, _d;
842044
- let accentPrimaryColor = getColorInstanceFromRawConfig(rawConfig.accentPrimary, context, "accent-primary", theme) ?? tinycolor.random();
842045
- let backgroundColor = getColorInstanceFromRawConfig(rawConfig.background, context, "background", theme);
842046
- if (backgroundColor != null) {
842047
- const newBackgroundColor = enforceBackgroundTheme(tinycolor(backgroundColor.toString()), theme);
842048
- if (newBackgroundColor.toHexString() !== backgroundColor.toHexString()) {
842049
- context.logger.warn(`The chosen shade, 'colors.background' in ${theme} mode, fails to meet minimum contrast requirements. The brightness is ${backgroundColor.getBrightness()}. To enhance accessibility and ensure content readability, Fern will adjust from ${backgroundColor.toHexString()} to a more contrast-rich ${newBackgroundColor.toHexString()}.`);
842050
- backgroundColor = newBackgroundColor;
842051
- }
842052
- }
842053
- if (accentPrimaryColor != null) {
842054
- const backgroundColorWithFallback = backgroundColor ?? tinycolor(theme === "dark" ? "#000" : "#FFF");
842055
- const newAccentPrimaryColor = increaseForegroundContrast(tinycolor(accentPrimaryColor.toString()), backgroundColorWithFallback);
842056
- if (newAccentPrimaryColor.toHexString() !== accentPrimaryColor.toHexString()) {
842057
- const ratio = tinycolor.readability(accentPrimaryColor, backgroundColorWithFallback);
842058
- context.logger.warn(`The chosen shade, 'colors.accent-primary' in ${theme} mode, fails to meet minimum contrast requirements. The contrast ratio is ${ratio}, which is below WCAG AA requirements (4.5:1). To enhance accessibility and ensure content readability, Fern will adjust from ${accentPrimaryColor.toHexString()} to a more contrast-rich ${newAccentPrimaryColor.toHexString()}.`);
842059
- accentPrimaryColor = newAccentPrimaryColor;
842060
- }
842061
- }
842064
+ const accentPrimaryColor = getColorInstanceFromRawConfigOrThrow(rawConfig.accentPrimary ?? rawConfig.accentPrimaryDeprecated, context, "accent-primary", theme) ?? tinycolor.random();
842065
+ const backgroundColor = getColorInstanceFromRawConfigOrThrow(rawConfig.background, context, "background", theme);
842062
842066
  return {
842063
842067
  accentPrimary: accentPrimaryColor.toRgb(),
842064
842068
  background: backgroundColor == null ? void 0 : backgroundColor.toRgb(),
842065
- border: (_a2 = getColorInstanceFromRawConfig(rawConfig.border, context, "border", theme)) == null ? void 0 : _a2.toRgb(),
842066
- sidebarBackground: (_b2 = getColorInstanceFromRawConfig(rawConfig.sidebarBackground, context, "sidebar-background", theme)) == null ? void 0 : _b2.toRgb(),
842067
- headerBackground: (_c2 = getColorInstanceFromRawConfig(rawConfig.headerBackground, context, "header-background", theme)) == null ? void 0 : _c2.toRgb(),
842068
- cardBackground: (_d = getColorInstanceFromRawConfig(rawConfig.cardBackground, context, "card-background", theme)) == null ? void 0 : _d.toRgb()
842069
+ border: (_a2 = getColorInstanceFromRawConfigOrThrow(rawConfig.border, context, "border", theme)) == null ? void 0 : _a2.toRgb(),
842070
+ sidebarBackground: (_b2 = getColorInstanceFromRawConfigOrThrow(rawConfig.sidebarBackground, context, "sidebar-background", theme)) == null ? void 0 : _b2.toRgb(),
842071
+ headerBackground: (_c2 = getColorInstanceFromRawConfigOrThrow(rawConfig.headerBackground, context, "header-background", theme)) == null ? void 0 : _c2.toRgb(),
842072
+ cardBackground: (_d = getColorInstanceFromRawConfigOrThrow(rawConfig.cardBackground, context, "card-background", theme)) == null ? void 0 : _d.toRgb()
842069
842073
  };
842070
842074
  }
842071
- function increaseForegroundContrast(foregroundColor, backgroundColor) {
842072
- let newForgroundColor = foregroundColor;
842073
- const dark = backgroundColor.isDark();
842074
- while (!tinycolor.isReadable(newForgroundColor, backgroundColor)) {
842075
- if (dark ? newForgroundColor.getBrightness() === 255 : newForgroundColor.getBrightness() === 0) {
842076
- break;
842077
- }
842078
- newForgroundColor = dark ? newForgroundColor.lighten(1) : newForgroundColor.darken(1);
842075
+ function getColorFromRawConfig(raw, key2, theme) {
842076
+ if (raw == null) {
842077
+ return void 0;
842079
842078
  }
842080
- return newForgroundColor;
842081
- }
842082
- function enforceBackgroundTheme(color3, theme) {
842083
- if (theme === "dark" && color3.isDark()) {
842084
- return color3;
842085
- } else if (theme === "light" && color3.isLight()) {
842086
- return color3;
842079
+ let rawColor = typeof raw === "string" ? raw : raw[theme];
842080
+ if (rawColor == null && key2 === "accent-primary" && typeof raw !== "string") {
842081
+ rawColor = raw[theme === "dark" ? "light" : "dark"];
842087
842082
  }
842088
- return getOppositeBrightness(color3);
842089
- }
842090
- function getOppositeBrightness(color3) {
842091
- if (color3 == null) {
842083
+ if (rawColor == null) {
842092
842084
  return void 0;
842093
842085
  }
842094
- const { h: h3, s: s2, v: v2 } = color3.toHsv();
842095
- return tinycolor({ h: h3, s: s2, v: 1 - v2 });
842086
+ return rawColor;
842096
842087
  }
842097
- function getColorInstanceFromRawConfig(raw, context, key2, theme) {
842098
- if (raw == null) {
842099
- return void 0;
842100
- }
842101
- const rawColor = typeof raw === "string" ? raw : raw[theme];
842102
- if (rawColor == null) {
842088
+ function getColorInstanceFromRawConfigOrThrow(raw, context, key2, theme) {
842089
+ const color3 = getColorFromRawConfig(raw, key2, theme);
842090
+ if (color3 == null) {
842103
842091
  return void 0;
842104
842092
  }
842105
- const color3 = tinycolor(rawColor);
842106
- if (!color3.isValid()) {
842093
+ const instance = tinycolor(color3);
842094
+ if (!instance.isValid()) {
842107
842095
  context.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF`);
842108
842096
  }
842109
- return color3;
842097
+ return instance;
842110
842098
  }
842111
842099
 
842100
+ // pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/parseDocsConfiguration.js
842101
+ var import_fdr_sdk3 = __toESM(require_dist());
842102
+ var import_promises40 = require("fs/promises");
842103
+
842112
842104
  // pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/getAllPages.js
842113
842105
  var import_promises39 = require("fs/promises");
842114
842106
  async function getAllPages({ navigation, absolutePathToFernFolder }) {
@@ -843441,6 +843433,95 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
843441
843433
  };
843442
843434
  }
843443
843435
 
843436
+ // pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/rules/accent-color-contrast/index.js
843437
+ var AccentColorContrastRule = {
843438
+ name: "accent-color-contrast",
843439
+ create: () => {
843440
+ return {
843441
+ file: async ({ config }) => {
843442
+ if (config.colors == null) {
843443
+ return [];
843444
+ }
843445
+ const colorType = getColorType(config.colors);
843446
+ if (colorType === "dark") {
843447
+ return validateTheme(config.colors, "dark");
843448
+ } else if (colorType === "light") {
843449
+ return validateTheme(config.colors, "light");
843450
+ } else if (colorType === "darkAndLight") {
843451
+ return [...validateTheme(config.colors, "dark"), ...validateTheme(config.colors, "light")];
843452
+ }
843453
+ return [];
843454
+ }
843455
+ };
843456
+ }
843457
+ };
843458
+ function validateTheme(colors, theme) {
843459
+ const accentPrimaryColor = getColorFromRawConfig(colors.accentPrimary ?? colors.accentPrimaryDeprecated, "accent-primary", theme);
843460
+ let backgroundColor = getColorFromRawConfig(colors.background, "background", theme) ?? (theme === "dark" ? "#000" : "#FFF");
843461
+ const ruleViolations = [];
843462
+ if (!tinycolor(backgroundColor).isValid()) {
843463
+ ruleViolations.push({
843464
+ severity: "error",
843465
+ message: `Invalid background color provided for colors.background.${theme}: ${backgroundColor}.`
843466
+ });
843467
+ } else {
843468
+ const newBackground = enforceBackgroundTheme(tinycolor(backgroundColor), theme);
843469
+ if (tinycolor(backgroundColor).toHexString() !== newBackground.toHexString()) {
843470
+ ruleViolations.push({
843471
+ severity: "warning",
843472
+ message: `The provided background color for ${theme} mode is not ${theme} enough. It will be adjusted to ${newBackground.toHexString()}.`
843473
+ });
843474
+ }
843475
+ backgroundColor = newBackground.toHexString();
843476
+ }
843477
+ if (accentPrimaryColor == null) {
843478
+ ruleViolations.push({
843479
+ severity: "warning",
843480
+ message: `No accent-color provided for ${theme} mode. A random color will be used.`
843481
+ });
843482
+ } else if (!tinycolor(accentPrimaryColor).isValid()) {
843483
+ ruleViolations.push({
843484
+ severity: "error",
843485
+ message: `Invalid accent-color provided for colors.accent-primary.${theme}: ${accentPrimaryColor}.`
843486
+ });
843487
+ } else {
843488
+ const ratio = tinycolor.readability(accentPrimaryColor, backgroundColor);
843489
+ const readableRatio = `${ratio.toFixed(2)}:1`;
843490
+ if (ratio < 3) {
843491
+ ruleViolations.push({
843492
+ severity: "warning",
843493
+ message: `The contrast ratio between the accent color and the background color for ${theme} mode is ${readableRatio}. It should be at least 3:1.`
843494
+ });
843495
+ } else if (ratio < 4.5) {
843496
+ ruleViolations.push({
843497
+ severity: "warning",
843498
+ message: `The contrast ratio between the accent color and the background color for ${theme} mode is ${readableRatio}. Fern will adjust the color to meet the minimum contrast ratio of 4.5:1 for WCAG AA and 7:1 for WCAG AAA.`
843499
+ });
843500
+ } else if (ratio < 7) {
843501
+ ruleViolations.push({
843502
+ severity: "warning",
843503
+ message: `The contrast ratio between the accent color and the background color for ${theme} mode is ${readableRatio}. Fern will adjust the color to meet the minimum contrast ratio of 7:1 for WCAG AAA.`
843504
+ });
843505
+ }
843506
+ }
843507
+ return ruleViolations;
843508
+ }
843509
+ function enforceBackgroundTheme(color3, theme) {
843510
+ if (theme === "dark" && color3.isDark()) {
843511
+ return color3;
843512
+ } else if (theme === "light" && color3.isLight()) {
843513
+ return color3;
843514
+ }
843515
+ return getOppositeBrightness(color3);
843516
+ }
843517
+ function getOppositeBrightness(color3) {
843518
+ if (color3 == null) {
843519
+ return void 0;
843520
+ }
843521
+ const { h: h3, s: s2, v: v2 } = color3.toHsv();
843522
+ return tinycolor({ h: h3, s: s2, v: 1 - v2 });
843523
+ }
843524
+
843444
843525
  // pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/rules/filepaths-exist/filepaths-exist.js
843445
843526
  var FilepathsExistRule = {
843446
843527
  name: "filepaths-exist",
@@ -868868,7 +868949,13 @@ var ValidateVersionFileRule = {
868868
868949
 
868869
868950
  // pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/getAllRules.js
868870
868951
  function getAllRules2() {
868871
- return [FilepathsExistRule, ValidMarkdownRule, OnlyVersionedNavigation, ValidateVersionFileRule];
868952
+ return [
868953
+ FilepathsExistRule,
868954
+ ValidMarkdownRule,
868955
+ OnlyVersionedNavigation,
868956
+ ValidateVersionFileRule,
868957
+ AccentColorContrastRule
868958
+ ];
868872
868959
  }
868873
868960
 
868874
868961
  // pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/validateDocsWorkspace.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",