@fern-api/fern-api-dev 4.46.4 → 4.46.6-1-g0b05d80f381

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 +76 -69
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -24501,7 +24501,7 @@ var init_esm2 = __esm({
24501
24501
  }
24502
24502
  });
24503
24503
 
24504
- // ../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/esm/index.js
24504
+ // ../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js
24505
24505
  function numeric(str3) {
24506
24506
  return !isNaN(str3) ? parseInt(str3, 10) : str3.charCodeAt(0);
24507
24507
  }
@@ -24595,7 +24595,7 @@ function expand_(str3, max, isTop) {
24595
24595
  const x15 = numeric(n6[0]);
24596
24596
  const y24 = numeric(n6[1]);
24597
24597
  const width = Math.max(n6[0].length, n6[1].length);
24598
- let incr = n6.length === 3 && n6[2] !== void 0 ? Math.abs(numeric(n6[2])) : 1;
24598
+ let incr = n6.length === 3 && n6[2] !== void 0 ? Math.max(Math.abs(numeric(n6[2])), 1) : 1;
24599
24599
  let test2 = lte;
24600
24600
  const reverse = y24 < x15;
24601
24601
  if (reverse) {
@@ -24646,7 +24646,7 @@ function expand_(str3, max, isTop) {
24646
24646
  }
24647
24647
  var escSlash, escOpen, escClose, escComma, escPeriod, escSlashPattern, escOpenPattern, escClosePattern, escCommaPattern, escPeriodPattern, slashPattern, openPattern, closePattern, commaPattern, periodPattern, EXPANSION_MAX;
24648
24648
  var init_esm3 = __esm({
24649
- "../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/esm/index.js"() {
24649
+ "../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js"() {
24650
24650
  "use strict";
24651
24651
  init_esm2();
24652
24652
  escSlash = "\0SLASH" + Math.random() + "\0";
@@ -24663,7 +24663,7 @@ var init_esm3 = __esm({
24663
24663
  openPattern = /\\{/g;
24664
24664
  closePattern = /\\}/g;
24665
24665
  commaPattern = /\\,/g;
24666
- periodPattern = /\\./g;
24666
+ periodPattern = /\\\./g;
24667
24667
  EXPANSION_MAX = 1e5;
24668
24668
  }
24669
24669
  });
@@ -50226,9 +50226,9 @@ var require_commonjs = __commonJS({
50226
50226
  }
50227
50227
  });
50228
50228
 
50229
- // ../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/commonjs/index.js
50229
+ // ../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/commonjs/index.js
50230
50230
  var require_commonjs2 = __commonJS({
50231
- "../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
50231
+ "../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
50232
50232
  "use strict";
50233
50233
  Object.defineProperty(exports2, "__esModule", { value: true });
50234
50234
  exports2.EXPANSION_MAX = void 0;
@@ -50248,7 +50248,7 @@ var require_commonjs2 = __commonJS({
50248
50248
  var openPattern2 = /\\{/g;
50249
50249
  var closePattern2 = /\\}/g;
50250
50250
  var commaPattern2 = /\\,/g;
50251
- var periodPattern2 = /\\./g;
50251
+ var periodPattern2 = /\\\./g;
50252
50252
  exports2.EXPANSION_MAX = 1e5;
50253
50253
  function numeric2(str3) {
50254
50254
  return !isNaN(str3) ? parseInt(str3, 10) : str3.charCodeAt(0);
@@ -50343,7 +50343,7 @@ var require_commonjs2 = __commonJS({
50343
50343
  const x15 = numeric2(n6[0]);
50344
50344
  const y24 = numeric2(n6[1]);
50345
50345
  const width = Math.max(n6[0].length, n6[1].length);
50346
- let incr = n6.length === 3 && n6[2] !== void 0 ? Math.abs(numeric2(n6[2])) : 1;
50346
+ let incr = n6.length === 3 && n6[2] !== void 0 ? Math.max(Math.abs(numeric2(n6[2])), 1) : 1;
50347
50347
  let test2 = lte2;
50348
50348
  const reverse = y24 < x15;
50349
50349
  if (reverse) {
@@ -365594,7 +365594,7 @@ var require_fernignore = __commonJS({
365594
365594
  var fs_1 = require("fs");
365595
365595
  var promises_1 = require("fs/promises");
365596
365596
  var path_1 = require("path");
365597
- exports2.REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock", ".fern/replay.yml"];
365597
+ exports2.REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock"];
365598
365598
  async function ensureReplayFernignoreEntries(outputDir) {
365599
365599
  const fernignorePath = (0, path_1.join)(outputDir, ".fernignore");
365600
365600
  let content5 = "";
@@ -365950,7 +365950,6 @@ var require_replay_init = __commonJS({
365950
365950
  exports2.formatBootstrapSummary = formatBootstrapSummary2;
365951
365951
  var github_1 = (init_lib7(), __toCommonJS(lib_exports3));
365952
365952
  var replay_1 = require_dist11();
365953
- var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
365954
365953
  var fs_1 = require("fs");
365955
365954
  var path_1 = require("path");
365956
365955
  var tmp_promise_1 = __importDefault2(require_tmp_promise());
@@ -365959,12 +365958,11 @@ var require_replay_init = __commonJS({
365959
365958
  const { githubRepo, token, dryRun } = params2;
365960
365959
  const tmpDir = await tmp_promise_1.default.dir({ unsafeCleanup: true });
365961
365960
  const repoPath = tmpDir.path;
365962
- const repository = await (0, github_1.cloneRepository)({
365961
+ await (0, github_1.cloneRepository)({
365963
365962
  githubRepository: githubRepo,
365964
365963
  installationToken: token,
365965
365964
  targetDirectory: repoPath
365966
365965
  });
365967
- const defaultBranch = await repository.getDefaultBranch();
365968
365966
  const bootstrapResult = await (0, replay_1.bootstrap)(repoPath, {
365969
365967
  dryRun,
365970
365968
  fernignoreAction: "skip",
@@ -365973,50 +365971,22 @@ var require_replay_init = __commonJS({
365973
365971
  importHistory: params2.importHistory
365974
365972
  });
365975
365973
  if (!bootstrapResult.generationCommit) {
365976
- return { bootstrap: bootstrapResult };
365974
+ return { bootstrap: bootstrapResult, fernignoreEntries: [] };
365977
365975
  }
365978
365976
  if (dryRun) {
365979
- return { bootstrap: bootstrapResult };
365977
+ return { bootstrap: bootstrapResult, fernignoreEntries: [] };
365980
365978
  }
365981
365979
  (0, fernignore_1.ensureReplayFernignoreEntriesSync)(repoPath);
365982
- const commitMessage = `[fern-replay] Initialize Replay
365983
-
365984
- Tracked ${bootstrapResult.patchesCreated} customization patch(es).
365985
- Base generation: ${bootstrapResult.generationCommit.sha.slice(0, 7)}`;
365986
- const filesToAdd = [".fern/replay.lock", ".fern/replay.yml", ".fernignore"].filter((f10) => (0, fs_1.existsSync)((0, path_1.join)(repoPath, f10)));
365987
- const branchName = `fern-replay/init-${Date.now()}`;
365988
- await repository.checkoutOrCreateLocal(branchName);
365989
- const git = new replay_1.GitClient(repoPath);
365990
- await git.exec(["add", ...filesToAdd]);
365991
- await git.exec([
365992
- "-c",
365993
- `user.name=${replay_1.FERN_BOT_NAME}`,
365994
- "-c",
365995
- `user.email=${replay_1.FERN_BOT_EMAIL}`,
365996
- "-c",
365997
- "commit.gpgsign=false",
365998
- "commit",
365999
- "--no-verify",
366000
- "-m",
366001
- commitMessage
366002
- ]);
366003
- await repository.pushUpstream(branchName);
366004
- const parsed = (0, github_1.parseRepository)(githubRepo);
366005
- const octokit = new rest_1.Octokit({ auth: token });
366006
- const prTitle = params2.prTitle ?? "[fern-replay] Initialize Replay for SDK customizations";
366007
- const prBody = params2.prBody ?? buildPrBody(bootstrapResult);
366008
- const { data: pr17 } = await octokit.pulls.create({
366009
- owner: parsed.owner,
366010
- repo: parsed.repo,
366011
- head: branchName,
366012
- base: defaultBranch,
366013
- title: prTitle,
366014
- body: prBody
366015
- });
365980
+ const lockfilePath = (0, path_1.join)(repoPath, ".fern", "replay.lock");
365981
+ const lockfileContent = (0, fs_1.existsSync)(lockfilePath) ? (0, fs_1.readFileSync)(lockfilePath, "utf-8") : void 0;
365982
+ const replayYmlPath = (0, path_1.join)(repoPath, ".fern", "replay.yml");
365983
+ const replayYmlContent = (0, fs_1.existsSync)(replayYmlPath) ? (0, fs_1.readFileSync)(replayYmlPath, "utf-8") : void 0;
366016
365984
  return {
366017
365985
  bootstrap: bootstrapResult,
366018
- prUrl: pr17.html_url,
366019
- branch: branchName
365986
+ lockfileContent,
365987
+ replayYmlContent,
365988
+ fernignoreEntries: fernignore_1.REPLAY_FERNIGNORE_ENTRIES,
365989
+ prBody: buildPrBody(bootstrapResult)
366020
365990
  };
366021
365991
  }
366022
365992
  function formatBootstrapSummary2(result) {
@@ -366075,14 +366045,6 @@ Base generation: ${bootstrapResult.generationCommit.sha.slice(0, 7)}`;
366075
366045
  entries21.push({ level: "warn", message: ` ${w20}` });
366076
366046
  }
366077
366047
  }
366078
- if (result.prUrl) {
366079
- entries21.push({ level: "info", message: `
366080
- PR created: ${result.prUrl}` });
366081
- entries21.push({ level: "info", message: "Merge the PR to enable Replay for this repository." });
366082
- } else if (result.branch) {
366083
- entries21.push({ level: "info", message: `
366084
- Pushed to branch: ${result.branch}` });
366085
- }
366086
366048
  return entries21;
366087
366049
  }
366088
366050
  function buildPrBody(result) {
@@ -601990,7 +601952,7 @@ var AccessTokenPosthogManager = class {
601990
601952
  properties: {
601991
601953
  ...event,
601992
601954
  ...event.properties,
601993
- version: "4.46.4",
601955
+ version: "4.46.6-1-g0b05d80f381",
601994
601956
  usingAccessToken: true
601995
601957
  }
601996
601958
  });
@@ -602041,7 +602003,7 @@ var UserPosthogManager = class {
602041
602003
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
602042
602004
  event: "CLI",
602043
602005
  properties: {
602044
- version: "4.46.4",
602006
+ version: "4.46.6-1-g0b05d80f381",
602045
602007
  ...event,
602046
602008
  ...event.properties,
602047
602009
  usingAccessToken: false,
@@ -780632,7 +780594,7 @@ var ApiReferenceNodeConverter = class {
780632
780594
  getTagDescriptionContent() {
780633
780595
  return this.#tagDescriptionContent;
780634
780596
  }
780635
- createTagDescriptionPageId(subpackage) {
780597
+ createTagDescriptionPageId(subpackage, packageLocator) {
780636
780598
  if (!this.apiSection.tagDescriptionPages || !this.openApiTags) {
780637
780599
  return void 0;
780638
780600
  }
@@ -780640,7 +780602,7 @@ var ApiReferenceNodeConverter = class {
780640
780602
  if (!subpackageName) {
780641
780603
  return void 0;
780642
780604
  }
780643
- const tagInfo = this.openApiTags[subpackageName];
780605
+ const tagInfo = this.openApiTags[subpackageName] ?? (packageLocator != null ? this.openApiTags[camelCase_default(packageLocator)] : void 0);
780644
780606
  if (!tagInfo || !tagInfo.description) {
780645
780607
  return void 0;
780646
780608
  }
@@ -780692,12 +780654,13 @@ ${tagInfo.description}`;
780692
780654
  });
780693
780655
  }
780694
780656
  #convertPackage(pkg2, parentSlug, parentAvailability) {
780695
- const overviewPageId = pkg2.overviewAbsolutePath != null ? navigation_exports2.V1.PageId(toRelativeFilepath(this.docsWorkspace, pkg2.overviewAbsolutePath)) : void 0;
780657
+ const explicitOverviewPageId = pkg2.overviewAbsolutePath != null ? navigation_exports2.V1.PageId(toRelativeFilepath(this.docsWorkspace, pkg2.overviewAbsolutePath)) : void 0;
780696
780658
  const maybeFullSlug = pkg2.overviewAbsolutePath != null ? this.markdownFilesToFullSlugs.get(pkg2.overviewAbsolutePath) : void 0;
780697
780659
  const pkgAvailability = pkg2.availability ?? parentAvailability;
780698
780660
  const subpackage = this.#holder.getSubpackageByIdOrLocator(pkg2.package);
780699
780661
  if (subpackage != null) {
780700
780662
  const subpackageId = ApiDefinitionHolder2.getSubpackageId(subpackage);
780663
+ const overviewPageId = explicitOverviewPageId ?? this.createTagDescriptionPageId(subpackage, pkg2.package);
780701
780664
  const subpackageNodeId = this.#idgen.get(overviewPageId ?? `${this.apiDefinitionId}:${subpackageId}`);
780702
780665
  if (this.#visitedSubpackages.has(subpackageId)) {
780703
780666
  this.taskContext.logger.warn(packageReuseError(pkg2.package));
@@ -780742,14 +780705,14 @@ ${tagInfo.description}`;
780742
780705
  });
780743
780706
  const convertedItems = this.#convertApiReferenceLayoutItems(pkg2.contents, void 0, slug, pkgAvailability);
780744
780707
  return {
780745
- id: this.#idgen.get(overviewPageId ?? `${this.apiDefinitionId}:${kebabCase_default(pkg2.package)}`),
780708
+ id: this.#idgen.get(explicitOverviewPageId ?? `${this.apiDefinitionId}:${kebabCase_default(pkg2.package)}`),
780746
780709
  type: "apiPackage",
780747
780710
  children: convertedItems,
780748
780711
  title: pkg2.title ?? pkg2.package,
780749
780712
  slug: slug.get(),
780750
780713
  icon: this.resolveIconFileId(pkg2.icon),
780751
780714
  hidden: this.hideChildren || pkg2.hidden,
780752
- overviewPageId,
780715
+ overviewPageId: explicitOverviewPageId,
780753
780716
  collapsible: void 0,
780754
780717
  collapsedByDefault: void 0,
780755
780718
  availability: pkgAvailability,
@@ -780837,7 +780800,7 @@ ${tagInfo.description}`;
780837
780800
  slug: slug.get(),
780838
780801
  icon: void 0,
780839
780802
  hidden: this.hideChildren,
780840
- overviewPageId: this.createTagDescriptionPageId(subpackage),
780803
+ overviewPageId: this.createTagDescriptionPageId(subpackage, unknownIdentifier),
780841
780804
  collapsible: void 0,
780842
780805
  collapsedByDefault: void 0,
780843
780806
  availability: parentAvailability,
@@ -825895,7 +825858,7 @@ var import_path54 = __toESM(require("path"), 1);
825895
825858
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
825896
825859
  var LOGS_FOLDER_NAME = "logs";
825897
825860
  function getCliSource() {
825898
- const version7 = "4.46.4";
825861
+ const version7 = "4.46.6-1-g0b05d80f381";
825899
825862
  return `cli@${version7}`;
825900
825863
  }
825901
825864
  var DebugLogger = class {
@@ -836862,7 +836825,7 @@ var LegacyDocsPublisher = class {
836862
836825
  previewId: void 0,
836863
836826
  disableTemplates: void 0,
836864
836827
  skipUpload,
836865
- cliVersion: "4.46.4"
836828
+ cliVersion: "4.46.6-1-g0b05d80f381"
836866
836829
  });
836867
836830
  if (taskContext.getResult() === TaskResult.Failure) {
836868
836831
  return { success: false };
@@ -909712,7 +909675,7 @@ var CliContext = class {
909712
909675
  if (false) {
909713
909676
  this.logger.error("CLI_VERSION is not defined");
909714
909677
  }
909715
- return "4.46.4";
909678
+ return "4.46.6-1-g0b05d80f381";
909716
909679
  }
909717
909680
  getCliName() {
909718
909681
  if (false) {
@@ -929241,7 +929204,41 @@ function addReplayInitCommand(cli, cliContext) {
929241
929204
  }
929242
929205
  if (argv.dryRun) {
929243
929206
  cliContext.logger.info("\nDry run complete. No changes made.");
929207
+ return;
929208
+ }
929209
+ if (result.lockfileContent == null) {
929210
+ return cliContext.failAndThrow("Bootstrap succeeded but lockfile content is missing.");
929244
929211
  }
929212
+ const fernToken = await cliContext.runTask((context3) => askToLogin(context3));
929213
+ const { owner, repo } = parseOwnerRepo(githubRepo);
929214
+ const fiddleOrigin = getFiddleOrigin();
929215
+ const response = await fetch(`${fiddleOrigin}/api/remote-gen/replay/init`, {
929216
+ method: "POST",
929217
+ headers: {
929218
+ "Content-Type": "application/json",
929219
+ Authorization: `Bearer ${fernToken.value}`
929220
+ },
929221
+ body: JSON.stringify({
929222
+ owner,
929223
+ repo,
929224
+ lockfileContents: result.lockfileContent,
929225
+ fernignoreEntries: result.fernignoreEntries,
929226
+ prBody: result.prBody
929227
+ })
929228
+ });
929229
+ if (!response.ok) {
929230
+ if (response.status === 404) {
929231
+ return cliContext.failAndThrow(
929232
+ "The Fern GitHub App is not installed on this repository. Install it at https://github.com/apps/fern-api to enable server-side PR creation."
929233
+ );
929234
+ }
929235
+ const body = await response.text();
929236
+ return cliContext.failAndThrow(`Failed to create PR via Fern: ${body}`);
929237
+ }
929238
+ const data2 = await response.json();
929239
+ cliContext.logger.info(`
929240
+ PR created: ${data2.prUrl}`);
929241
+ cliContext.logger.info("Merge the PR to enable Replay for this repository.");
929245
929242
  } catch (error50) {
929246
929243
  cliContext.failAndThrow(`Failed to initialize Replay: ${extractErrorMessage(error50)}`);
929247
929244
  }
@@ -929316,6 +929313,16 @@ Resolve the conflicts in your editor, then run \`fern replay resolve\` again to
929316
929313
  }
929317
929314
  );
929318
929315
  }
929316
+ function parseOwnerRepo(githubRepo) {
929317
+ const cleaned = githubRepo.replace(/^https?:\/\//, "").replace(/\.git$/, "").replace(/^github\.com\//, "");
929318
+ const parts = cleaned.split("/");
929319
+ const owner = parts[parts.length - 2];
929320
+ const repo = parts[parts.length - 1];
929321
+ if (owner == null || repo == null) {
929322
+ throw new Error(`Could not parse owner/repo from: ${githubRepo}`);
929323
+ }
929324
+ return { owner, repo };
929325
+ }
929319
929326
  /*! Bundled license information:
929320
929327
 
929321
929328
  yargs-parser/build/lib/string-utils.js:
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.46.4",
2
+ "version": "4.46.6-1-g0b05d80f381",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",