@fern-api/fern-api-dev 5.38.2 → 5.40.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 +182 -34
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -555128,6 +555128,7 @@ __export(DocsYmlSchemas_exports, {
555128
555128
  RelativeProductPath: () => RelativeProductPath,
555129
555129
  Role: () => Role,
555130
555130
  RoleId: () => RoleId,
555131
+ SearchSettingsConfig: () => SearchSettingsConfig,
555131
555132
  SearchbarPlacement: () => SearchbarPlacement,
555132
555133
  SectionConfiguration: () => SectionConfiguration,
555133
555134
  SegmentConfig: () => SegmentConfig,
@@ -555366,11 +555367,16 @@ var LayoutConfig = external_exports.object({
555366
555367
  "hide-feedback": external_exports.boolean().optional(),
555367
555368
  "mobile-toc": external_exports.boolean().optional()
555368
555369
  });
555370
+ var SearchSettingsConfig = external_exports.object({
555371
+ "prioritize-current-product": external_exports.boolean().optional(),
555372
+ "default-filter-by-current-product": external_exports.boolean().optional()
555373
+ });
555369
555374
  var DocsSettingsConfig = external_exports.object({
555370
555375
  "search-text": external_exports.string().optional(),
555371
555376
  "disable-search": external_exports.boolean().optional(),
555372
555377
  "dark-mode-code": external_exports.boolean().optional(),
555373
555378
  "default-search-filters": external_exports.boolean().optional(),
555379
+ search: SearchSettingsConfig.optional(),
555374
555380
  "http-snippets": HttpSnippetsConfig.optional(),
555375
555381
  "hide-404-page": external_exports.boolean().optional(),
555376
555382
  "use-javascript-as-typescript": external_exports.boolean().optional(),
@@ -556567,6 +556573,7 @@ __export(serialization_exports3, {
556567
556573
  RelativeProductPath: () => RelativeProductPath2,
556568
556574
  Role: () => Role2,
556569
556575
  RoleId: () => RoleId2,
556576
+ SearchSettingsConfig: () => SearchSettingsConfig2,
556570
556577
  SearchbarPlacement: () => SearchbarPlacement3,
556571
556578
  SectionConfiguration: () => SectionConfiguration2,
556572
556579
  SegmentConfig: () => SegmentConfig2,
@@ -556721,6 +556728,7 @@ __export(docs_exports2, {
556721
556728
  RelativeProductPath: () => RelativeProductPath2,
556722
556729
  Role: () => Role2,
556723
556730
  RoleId: () => RoleId2,
556731
+ SearchSettingsConfig: () => SearchSettingsConfig2,
556724
556732
  SearchbarPlacement: () => SearchbarPlacement3,
556725
556733
  SectionConfiguration: () => SectionConfiguration2,
556726
556734
  SegmentConfig: () => SegmentConfig2,
@@ -558657,6 +558665,12 @@ var HttpSnippetsConfig2 = schemas_exports6.undiscriminatedUnion([
558657
558665
  // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/Language.js
558658
558666
  var Language2 = schemas_exports6.string();
558659
558667
 
558668
+ // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/SearchSettingsConfig.js
558669
+ var SearchSettingsConfig2 = schemas_exports6.object({
558670
+ prioritizeCurrentProduct: schemas_exports6.property("prioritize-current-product", schemas_exports6.boolean().optional()),
558671
+ defaultFilterByCurrentProduct: schemas_exports6.property("default-filter-by-current-product", schemas_exports6.boolean().optional())
558672
+ });
558673
+
558660
558674
  // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/TitleSource.js
558661
558675
  var TitleSource3 = schemas_exports6.enum_(["frontmatter", "filename"]);
558662
558676
 
@@ -558669,6 +558683,7 @@ var DocsSettingsConfig2 = schemas_exports6.object({
558669
558683
  disableSearch: schemas_exports6.property("disable-search", schemas_exports6.boolean().optional()),
558670
558684
  darkModeCode: schemas_exports6.property("dark-mode-code", schemas_exports6.boolean().optional()),
558671
558685
  defaultSearchFilters: schemas_exports6.property("default-search-filters", schemas_exports6.boolean().optional()),
558686
+ search: SearchSettingsConfig2.optional(),
558672
558687
  httpSnippets: schemas_exports6.property("http-snippets", HttpSnippetsConfig2.optional()),
558673
558688
  hide404Page: schemas_exports6.property("hide-404-page", schemas_exports6.boolean().optional()),
558674
558689
  useJavascriptAsTypescript: schemas_exports6.property("use-javascript-as-typescript", schemas_exports6.boolean().optional()),
@@ -587657,9 +587672,15 @@ function convertSettingsConfig(settings) {
587657
587672
  if (settings == null) {
587658
587673
  return void 0;
587659
587674
  }
587675
+ const defaultFilterByCurrentProduct = (settings.search?.defaultFilterByCurrentProduct ?? false) || (settings.defaultSearchFilters ?? false);
587676
+ const prioritizeCurrentProduct = settings.search?.prioritizeCurrentProduct ?? false;
587660
587677
  return {
587661
587678
  darkModeCode: settings.darkModeCode ?? false,
587662
- defaultSearchFilters: settings.defaultSearchFilters ?? false,
587679
+ defaultSearchFilters: defaultFilterByCurrentProduct,
587680
+ search: {
587681
+ prioritizeCurrentProduct,
587682
+ defaultFilterByCurrentProduct
587683
+ },
587663
587684
  language: settings.language ?? "en",
587664
587685
  disableSearch: settings.disableSearch ?? false,
587665
587686
  hide404Page: settings.hide404Page ?? false,
@@ -669329,7 +669350,7 @@ var AccessTokenPosthogManager = class {
669329
669350
  properties: {
669330
669351
  ...event,
669331
669352
  ...event.properties,
669332
- version: "5.38.2",
669353
+ version: "5.40.0",
669333
669354
  usingAccessToken: true,
669334
669355
  ...getRunIdProperties()
669335
669356
  }
@@ -669393,7 +669414,7 @@ var UserPosthogManager = class {
669393
669414
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
669394
669415
  event: "CLI",
669395
669416
  properties: {
669396
- version: "5.38.2",
669417
+ version: "5.40.0",
669397
669418
  ...event,
669398
669419
  ...event.properties,
669399
669420
  usingAccessToken: false,
@@ -860306,7 +860327,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860306
860327
  var LOGS_FOLDER_NAME = "logs";
860307
860328
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860308
860329
  function getCliSource() {
860309
- const version7 = "5.38.2";
860330
+ const version7 = "5.40.0";
860310
860331
  return `cli@${version7}`;
860311
860332
  }
860312
860333
  var DebugLogger = class {
@@ -877519,6 +877540,34 @@ og:description, headline, excerpt).`
877519
877540
  },
877520
877541
  additionalProperties: false
877521
877542
  },
877543
+ "docs.SearchSettingsConfig": {
877544
+ type: "object",
877545
+ properties: {
877546
+ "prioritize-current-product": {
877547
+ oneOf: [
877548
+ {
877549
+ type: "boolean"
877550
+ },
877551
+ {
877552
+ type: "null"
877553
+ }
877554
+ ],
877555
+ description: "If set to true, search results from the current product/version are\nboosted in Algolia's ranking (via `optionalFilters`) without excluding\nresults from other products/versions.\n\n@default: false"
877556
+ },
877557
+ "default-filter-by-current-product": {
877558
+ oneOf: [
877559
+ {
877560
+ type: "boolean"
877561
+ },
877562
+ {
877563
+ type: "null"
877564
+ }
877565
+ ],
877566
+ description: "If set to true, the current product is automatically selected as a\nfacet filter, so only results from the current product are shown by\ndefault. Equivalent to the legacy `settings.default-search-filters`\nsetting, which is preserved as an alias for backwards compatibility.\n\n@default: false"
877567
+ }
877568
+ },
877569
+ additionalProperties: false
877570
+ },
877522
877571
  "docs.HttpSnippetLanguage": {
877523
877572
  type: "string",
877524
877573
  enum: [
@@ -877599,7 +877648,18 @@ og:description, headline, excerpt).`
877599
877648
  type: "null"
877600
877649
  }
877601
877650
  ],
877602
- description: "By default (`false`), search will display results for pages across all products and versions.\nIf set to true, search will display results for pages within the current product and version.\n\n@default: false"
877651
+ description: "By default (`false`), search will display results for pages across all products and versions.\nIf set to true, search will display results for pages within the current product and version.\n\nPreserved for backwards compatibility. Equivalent to\n`search.default-filter-by-current-product`.\n\n@default: false"
877652
+ },
877653
+ search: {
877654
+ oneOf: [
877655
+ {
877656
+ $ref: "#/definitions/docs.SearchSettingsConfig"
877657
+ },
877658
+ {
877659
+ type: "null"
877660
+ }
877661
+ ],
877662
+ description: "Controls product-aware search behavior. See `SearchSettingsConfig` for\nindividual options."
877603
877663
  },
877604
877664
  "http-snippets": {
877605
877665
  oneOf: [
@@ -880907,7 +880967,7 @@ var LegacyDocsPublisher = class {
880907
880967
  previewId,
880908
880968
  disableTemplates: void 0,
880909
880969
  skipUpload,
880910
- cliVersion: "5.38.2",
880970
+ cliVersion: "5.40.0",
880911
880971
  loginCommand: "fern auth login"
880912
880972
  });
880913
880973
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -955827,7 +955887,7 @@ function getAutomationContextFromEnv() {
955827
955887
  config_branch: process.env.FERN_CONFIG_BRANCH,
955828
955888
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
955829
955889
  trigger: process.env.GITHUB_EVENT_NAME,
955830
- cli_version: "5.38.2"
955890
+ cli_version: "5.40.0"
955831
955891
  };
955832
955892
  }
955833
955893
  function isAutomationMode() {
@@ -956653,7 +956713,7 @@ var CliContext = class _CliContext {
956653
956713
  if (false) {
956654
956714
  this.logger.error("CLI_VERSION is not defined");
956655
956715
  }
956656
- return "5.38.2";
956716
+ return "5.40.0";
956657
956717
  }
956658
956718
  getCliName() {
956659
956719
  if (false) {
@@ -965377,6 +965437,99 @@ Found ${previewDeployments.length} preview deployment(s):
965377
965437
  });
965378
965438
  }
965379
965439
 
965440
+ // src/commands/docs-theme/deleteDocsTheme.ts
965441
+ var import_node_readline6 = require("readline");
965442
+ init_lib6();
965443
+
965444
+ // src/commands/docs-theme/themeOrigin.ts
965445
+ var FDR_ORIGIN = process.env.OVERRIDE_FDR_ORIGIN ?? "https://registry.buildwithfern.com";
965446
+ function describeFetchError(error50) {
965447
+ if (!(error50 instanceof Error)) {
965448
+ return String(error50);
965449
+ }
965450
+ const cause = error50.cause;
965451
+ if (cause instanceof Error) {
965452
+ return cause.message;
965453
+ }
965454
+ return error50.message;
965455
+ }
965456
+ function parseErrorDetail(body) {
965457
+ try {
965458
+ const parsed = JSON.parse(body);
965459
+ const message = parsed.message ?? parsed.error?.message;
965460
+ if (typeof message === "string") {
965461
+ return message;
965462
+ }
965463
+ } catch {
965464
+ }
965465
+ return void 0;
965466
+ }
965467
+
965468
+ // src/commands/docs-theme/deleteDocsTheme.ts
965469
+ async function confirmDeletion(themeName) {
965470
+ const rl5 = (0, import_node_readline6.createInterface)({ input: process.stdin, output: process.stderr });
965471
+ return new Promise((resolve15) => {
965472
+ rl5.question(`Are you sure you want to delete the theme "${themeName}"? (y/N) `, (answer) => {
965473
+ rl5.close();
965474
+ resolve15(answer.trim().toLowerCase() === "y");
965475
+ });
965476
+ });
965477
+ }
965478
+ async function deleteDocsTheme({
965479
+ cliContext,
965480
+ name: name2,
965481
+ force
965482
+ }) {
965483
+ const token = await cliContext.runTask(async (context3) => {
965484
+ return askToLogin(context3);
965485
+ });
965486
+ if (token == null) {
965487
+ cliContext.failAndThrow("Failed to authenticate. Please run 'fern login' first.", void 0, {
965488
+ code: CliError.Code.AuthError
965489
+ });
965490
+ return;
965491
+ }
965492
+ const project = await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
965493
+ commandLineApiWorkspace: void 0,
965494
+ defaultToAllApiWorkspaces: true
965495
+ });
965496
+ const orgId = project.config.organization;
965497
+ if (!force) {
965498
+ const confirmed = await confirmDeletion(name2);
965499
+ if (!confirmed) {
965500
+ cliContext.logger.info("Deletion cancelled.");
965501
+ return;
965502
+ }
965503
+ }
965504
+ await cliContext.runTask(async (context3) => {
965505
+ const deleteUrl = `${FDR_ORIGIN}/v2/registry/themes/${orgId}/${encodeURIComponent(name2)}`;
965506
+ context3.logger.debug(`Deleting theme at ${deleteUrl}`);
965507
+ let res;
965508
+ try {
965509
+ res = await fetch(deleteUrl, {
965510
+ method: "DELETE",
965511
+ headers: { Authorization: `Bearer ${token.value}` }
965512
+ });
965513
+ } catch (err) {
965514
+ context3.failAndThrow(
965515
+ `Failed to delete theme "${name2}" \u2014 could not reach ${FDR_ORIGIN}: ${describeFetchError(err)}`,
965516
+ void 0,
965517
+ { code: CliError.Code.NetworkError }
965518
+ );
965519
+ return;
965520
+ }
965521
+ if (!res.ok) {
965522
+ const body = await res.text();
965523
+ const detail = parseErrorDetail(body) ?? body;
965524
+ context3.failAndThrow(`Failed to delete theme "${name2}": HTTP ${res.status} \u2014 ${detail}`, void 0, {
965525
+ code: CliError.Code.NetworkError
965526
+ });
965527
+ return;
965528
+ }
965529
+ context3.logger.info(`Theme "${name2}" deleted for org "${orgId}"`);
965530
+ });
965531
+ }
965532
+
965380
965533
  // src/commands/docs-theme/exportDocsTheme.ts
965381
965534
  init_lib6();
965382
965535
 
@@ -965465,32 +965618,6 @@ async function exportDocsTheme({
965465
965618
 
965466
965619
  // src/commands/docs-theme/listDocsThemes.ts
965467
965620
  init_lib6();
965468
-
965469
- // src/commands/docs-theme/themeOrigin.ts
965470
- var FDR_ORIGIN = process.env.OVERRIDE_FDR_ORIGIN ?? "https://registry.buildwithfern.com";
965471
- function describeFetchError(error50) {
965472
- if (!(error50 instanceof Error)) {
965473
- return String(error50);
965474
- }
965475
- const cause = error50.cause;
965476
- if (cause instanceof Error) {
965477
- return cause.message;
965478
- }
965479
- return error50.message;
965480
- }
965481
- function parseErrorDetail(body) {
965482
- try {
965483
- const parsed = JSON.parse(body);
965484
- const message = parsed.message ?? parsed.error?.message;
965485
- if (typeof message === "string") {
965486
- return message;
965487
- }
965488
- } catch {
965489
- }
965490
- return void 0;
965491
- }
965492
-
965493
- // src/commands/docs-theme/listDocsThemes.ts
965494
965621
  async function listDocsThemes({
965495
965622
  cliContext,
965496
965623
  org,
@@ -972975,12 +973102,33 @@ function addDocsCommand2(cli, cliContext) {
972975
973102
  }
972976
973103
  function addDocsThemeCommand(cli, cliContext) {
972977
973104
  cli.command("theme", "Manage org-level themes for your documentation", (yargs) => {
973105
+ addDocsThemeDeleteCommand(yargs, cliContext);
972978
973106
  addDocsThemeExportCommand(yargs, cliContext);
972979
973107
  addDocsThemeListCommand(yargs, cliContext);
972980
973108
  addDocsThemeUploadCommand(yargs, cliContext);
972981
973109
  return yargs;
972982
973110
  });
972983
973111
  }
973112
+ function addDocsThemeDeleteCommand(cli, cliContext) {
973113
+ cli.command(
973114
+ "delete",
973115
+ false,
973116
+ (yargs) => yargs.option("name", {
973117
+ alias: "n",
973118
+ type: "string",
973119
+ description: "Name of the theme to delete",
973120
+ demandOption: true
973121
+ }).option("force", {
973122
+ alias: "f",
973123
+ type: "boolean",
973124
+ description: "Skip the confirmation prompt"
973125
+ }).example("$0 docs theme delete --name dark", "Delete the theme named 'dark'").example("$0 docs theme delete --name dark --force", "Delete without confirmation"),
973126
+ async (argv) => {
973127
+ cliContext.instrumentPostHogEvent({ command: "fern docs theme delete" });
973128
+ await deleteDocsTheme({ cliContext, name: argv.name, force: argv.force });
973129
+ }
973130
+ );
973131
+ }
972984
973132
  function addDocsThemeExportCommand(cli, cliContext) {
972985
973133
  cli.command(
972986
973134
  "export",
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.38.2",
2
+ "version": "5.40.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",