@fern-api/fern-api-dev 5.67.0 → 5.68.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 +245 -40
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -67272,6 +67272,13 @@ var init_HeaderApiVersionScheme = __esm({
67272
67272
  }
67273
67273
  });
67274
67274
 
67275
+ // ../../ir-sdk/lib/sdk/api/resources/ir/types/IdempotencyKeyGeneration.js
67276
+ var init_IdempotencyKeyGeneration = __esm({
67277
+ "../../ir-sdk/lib/sdk/api/resources/ir/types/IdempotencyKeyGeneration.js"() {
67278
+ "use strict";
67279
+ }
67280
+ });
67281
+
67275
67282
  // ../../ir-sdk/lib/sdk/api/resources/ir/types/IntermediateRepresentation.js
67276
67283
  var init_IntermediateRepresentation = __esm({
67277
67284
  "../../ir-sdk/lib/sdk/api/resources/ir/types/IntermediateRepresentation.js"() {
@@ -67400,6 +67407,7 @@ var init_types63 = __esm({
67400
67407
  init_ExampleStyle();
67401
67408
  init_GenerationMetadata();
67402
67409
  init_HeaderApiVersionScheme();
67410
+ init_IdempotencyKeyGeneration();
67403
67411
  init_IntermediateRepresentation();
67404
67412
  init_InvocationSource();
67405
67413
  init_Package();
@@ -79542,6 +79550,20 @@ var init_GenerationMetadata2 = __esm({
79542
79550
  }
79543
79551
  });
79544
79552
 
79553
+ // ../../ir-sdk/lib/sdk/serialization/resources/ir/types/IdempotencyKeyGeneration.js
79554
+ var IdempotencyKeyGeneration;
79555
+ var init_IdempotencyKeyGeneration2 = __esm({
79556
+ "../../ir-sdk/lib/sdk/serialization/resources/ir/types/IdempotencyKeyGeneration.js"() {
79557
+ "use strict";
79558
+ init_core2();
79559
+ init_HttpMethod4();
79560
+ IdempotencyKeyGeneration = schemas_exports3.objectWithoutOptionalProperties({
79561
+ headerName: schemas_exports3.string(),
79562
+ methods: schemas_exports3.list(HttpMethod4)
79563
+ });
79564
+ }
79565
+ });
79566
+
79545
79567
  // ../../ir-sdk/lib/sdk/serialization/resources/publish/types/CratesPublishTarget.js
79546
79568
  var CratesPublishTarget;
79547
79569
  var init_CratesPublishTarget2 = __esm({
@@ -81375,13 +81397,15 @@ var init_SdkConfig2 = __esm({
81375
81397
  "../../ir-sdk/lib/sdk/serialization/resources/ir/types/SdkConfig.js"() {
81376
81398
  "use strict";
81377
81399
  init_core2();
81400
+ init_IdempotencyKeyGeneration2();
81378
81401
  init_PlatformHeaders2();
81379
81402
  SdkConfig = schemas_exports3.objectWithoutOptionalProperties({
81380
81403
  isAuthMandatory: schemas_exports3.boolean(),
81381
81404
  hasStreamingEndpoints: schemas_exports3.boolean(),
81382
81405
  hasPaginatedEndpoints: schemas_exports3.boolean(),
81383
81406
  hasFileDownloadEndpoints: schemas_exports3.boolean(),
81384
- platformHeaders: PlatformHeaders
81407
+ platformHeaders: PlatformHeaders,
81408
+ idempotencyKeyGeneration: IdempotencyKeyGeneration.optional()
81385
81409
  });
81386
81410
  }
81387
81411
  });
@@ -81521,6 +81545,7 @@ var init_types92 = __esm({
81521
81545
  init_ExampleStyle2();
81522
81546
  init_GenerationMetadata2();
81523
81547
  init_HeaderApiVersionScheme2();
81548
+ init_IdempotencyKeyGeneration2();
81524
81549
  init_IntermediateRepresentation2();
81525
81550
  init_InvocationSource2();
81526
81551
  init_Package2();
@@ -81549,6 +81574,7 @@ __export(ir_exports4, {
81549
81574
  ExampleStyle: () => ExampleStyle2,
81550
81575
  GenerationMetadata: () => GenerationMetadata,
81551
81576
  HeaderApiVersionScheme: () => HeaderApiVersionScheme,
81577
+ IdempotencyKeyGeneration: () => IdempotencyKeyGeneration,
81552
81578
  IntermediateRepresentation: () => IntermediateRepresentation,
81553
81579
  InvocationSource: () => InvocationSource2,
81554
81580
  Package: () => Package,
@@ -82851,6 +82877,7 @@ __export(serialization_exports2, {
82851
82877
  HttpResponse: () => HttpResponse,
82852
82878
  HttpResponseBody: () => HttpResponseBody2,
82853
82879
  HttpService: () => HttpService,
82880
+ IdempotencyKeyGeneration: () => IdempotencyKeyGeneration,
82854
82881
  InferredAuthScheme: () => InferredAuthScheme,
82855
82882
  InferredAuthSchemeTokenEndpoint: () => InferredAuthSchemeTokenEndpoint,
82856
82883
  InferredAuthenticatedRequestHeader: () => InferredAuthenticatedRequestHeader2,
@@ -83903,6 +83930,30 @@ function getUserAgentTemplateFromGeneratorConfig(generatorInvocation) {
83903
83930
  }
83904
83931
  return void 0;
83905
83932
  }
83933
+ function parseIdempotencyKeyMethods(value2) {
83934
+ if (!Array.isArray(value2)) {
83935
+ return DEFAULT_IDEMPOTENCY_KEY_METHODS;
83936
+ }
83937
+ const methods = value2.filter((entry) => typeof entry === "string").map((entry) => entry.toUpperCase()).filter((entry) => ALL_HTTP_METHODS.has(entry));
83938
+ return methods.length > 0 ? methods : DEFAULT_IDEMPOTENCY_KEY_METHODS;
83939
+ }
83940
+ function getIdempotencyKeyGenerationFromGeneratorConfig(generatorInvocation) {
83941
+ if (typeof generatorInvocation.raw?.config !== "object" || generatorInvocation.raw?.config === null) {
83942
+ return void 0;
83943
+ }
83944
+ const value2 = generatorInvocation.raw.config["auto-generate-idempotency-key"];
83945
+ if (value2 === true) {
83946
+ return { headerName: DEFAULT_IDEMPOTENCY_KEY_HEADER, methods: DEFAULT_IDEMPOTENCY_KEY_METHODS };
83947
+ }
83948
+ if (typeof value2 === "object" && value2 !== null) {
83949
+ const headerName = value2["header-name"];
83950
+ return {
83951
+ headerName: typeof headerName === "string" ? headerName : DEFAULT_IDEMPOTENCY_KEY_HEADER,
83952
+ methods: parseIdempotencyKeyMethods(value2["methods"])
83953
+ };
83954
+ }
83955
+ return void 0;
83956
+ }
83906
83957
  function stripCliConfigKeys(config5) {
83907
83958
  if (typeof config5 !== "object" || config5 === null) {
83908
83959
  return config5;
@@ -84068,13 +84119,16 @@ function getRegistryName(language) {
84068
84119
  return language;
84069
84120
  }
84070
84121
  }
84071
- var CLI_ONLY_CONFIG_KEYS, REGISTRY_TIMEOUT_MS;
84122
+ var DEFAULT_IDEMPOTENCY_KEY_HEADER, DEFAULT_IDEMPOTENCY_KEY_METHODS, ALL_HTTP_METHODS, CLI_ONLY_CONFIG_KEYS, REGISTRY_TIMEOUT_MS;
84072
84123
  var init_checkVersionExists = __esm({
84073
84124
  "../../commons/api-workspace-commons/lib/checkVersionExists.js"() {
84074
84125
  "use strict";
84075
84126
  init_lib4();
84076
84127
  init_lib6();
84077
- CLI_ONLY_CONFIG_KEYS = /* @__PURE__ */ new Set(["user-agent"]);
84128
+ DEFAULT_IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
84129
+ DEFAULT_IDEMPOTENCY_KEY_METHODS = ["POST", "PUT"];
84130
+ ALL_HTTP_METHODS = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"]);
84131
+ CLI_ONLY_CONFIG_KEYS = /* @__PURE__ */ new Set(["user-agent", "auto-generate-idempotency-key"]);
84078
84132
  REGISTRY_TIMEOUT_MS = 5e3;
84079
84133
  }
84080
84134
  });
@@ -276640,7 +276694,7 @@ var init_getIrGenerationSettings = __esm({
276640
276694
  });
276641
276695
 
276642
276696
  // ../generation/ir-generator/lib/generateIntermediateRepresentation.js
276643
- function generateIntermediateRepresentation({ workspace, generationLanguage, keywords: keywords3, smartCasing, exampleGeneration, audiences, readme, packageName, userAgentTemplate, organization, version: version7, context: context3, fdrApiDefinitionId, sourceResolver, disableDynamicExamples, dynamicGeneratorConfig, generationMetadata }) {
276697
+ function generateIntermediateRepresentation({ workspace, generationLanguage, keywords: keywords3, smartCasing, exampleGeneration, audiences, readme, packageName, userAgentTemplate, idempotencyKeyGeneration, organization, version: version7, context: context3, fdrApiDefinitionId, sourceResolver, disableDynamicExamples, dynamicGeneratorConfig, generationMetadata }) {
276644
276698
  const irSettings = getIrGenerationSettings({ workspace });
276645
276699
  const casingsGenerator = constructCasingsGenerator({ generationLanguage, keywords: keywords3, smartCasing });
276646
276700
  const irGraph = new IrGraph(audiences);
@@ -276978,6 +277032,7 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
276978
277032
  hasStreamingEndpoints,
276979
277033
  hasPaginatedEndpoints,
276980
277034
  hasFileDownloadEndpoints,
277035
+ idempotencyKeyGeneration,
276981
277036
  platformHeaders: {
276982
277037
  language: "X-Fern-Language",
276983
277038
  sdkName: "X-Fern-SDK-Name",
@@ -342420,6 +342475,7 @@ var init_AbstractSpecConverter = __esm({
342420
342475
  hasPaginatedEndpoints: false,
342421
342476
  hasStreamingEndpoints: false,
342422
342477
  isAuthMandatory: true,
342478
+ idempotencyKeyGeneration: void 0,
342423
342479
  platformHeaders: {
342424
342480
  language: "",
342425
342481
  sdkName: "",
@@ -564284,7 +564340,8 @@ var require_AutoVersioningService = __commonJS({
564284
564340
  contentLines.push(line);
564285
564341
  }
564286
564342
  }
564287
- let processedContent = this.removeVersionChangePairs(contentLines, mappedMagicVersion);
564343
+ let processedContent = this.removeGoModulePathSuffixPairs(contentLines);
564344
+ processedContent = this.removeVersionChangePairs(processedContent, mappedMagicVersion);
564288
564345
  processedContent = this.removeRemainingMagicVersionLines(processedContent, mappedMagicVersion);
564289
564346
  let hasChanges2 = false;
564290
564347
  for (const line of processedContent) {
@@ -564420,21 +564477,83 @@ var require_AutoVersioningService = __commonJS({
564420
564477
  * so non-Go diffs like API URL version changes are not affected.
564421
564478
  */
564422
564479
  isGoModulePathSuffixChange(minusLine, plusLine) {
564423
- const minusContent = minusLine.substring(1);
564424
- const plusContent = plusLine.substring(1);
564425
- const goModulePathPattern = /"[^"]*(?:github\.com|golang\.org|google\.golang\.org|gopkg\.in)\/[^"]*"/;
564426
- const goModuleDirectivePattern = /^\s*module\s+(?:github\.com|golang\.org|google\.golang\.org|gopkg\.in)\/\S+/;
564427
- const hasGoModulePath = goModulePathPattern.test(minusContent) || goModulePathPattern.test(plusContent) || goModuleDirectivePattern.test(minusContent.trim()) || goModuleDirectivePattern.test(plusContent.trim());
564428
- if (!hasGoModulePath) {
564480
+ const minus = this.analyzeGoModulePathLine(minusLine);
564481
+ const plus = this.analyzeGoModulePathLine(plusLine);
564482
+ if (minus == null || plus == null) {
564429
564483
  return false;
564430
564484
  }
564431
- const suffixPattern = /\/v\d+(?=\/|"\s*$|$)/g;
564432
- const minusWithoutSuffix = minusContent.replace(suffixPattern, "");
564433
- const plusWithoutSuffix = plusContent.replace(suffixPattern, "");
564434
- if (minusWithoutSuffix !== plusWithoutSuffix) {
564485
+ if (minus.strippedContent !== plus.strippedContent) {
564435
564486
  return false;
564436
564487
  }
564437
- return /\/v\d+(?=\/|"\s*$|$)/.test(minusContent) || /\/v\d+(?=\/|"\s*$|$)/.test(plusContent);
564488
+ return minus.hasSuffix || plus.hasSuffix;
564489
+ }
564490
+ /**
564491
+ * Removes Go module path `/vN` suffix-only churn from a diff section, regardless of how the
564492
+ * deletion and addition lines are laid out. `removeVersionChangePairs` only removes a deletion
564493
+ * when it can pair it with a *nearby* addition and keeps every line in between — so a diff that
564494
+ * groups all deletions before all additions (as Go import blocks do) leaks the suffix churn for
564495
+ * every line except the first. That churn then reaches the AI diff analyzer, which sees the
564496
+ * previously published `/vN` module path changing on every import and misclassifies a
564497
+ * no-op regeneration as a breaking change (spurious major bump).
564498
+ *
564499
+ * This pass matches each suffix-bearing deletion with any suffix-only-equivalent addition in
564500
+ * the section (by suffix-stripped content) and drops both, so only genuine content changes to
564501
+ * Go module path lines survive.
564502
+ */
564503
+ removeGoModulePathSuffixPairs(lines) {
564504
+ const additions = [];
564505
+ for (let index3 = 0; index3 < lines.length; index3++) {
564506
+ const line = lines[index3];
564507
+ if (line == null || !this.isAdditionLine(line)) {
564508
+ continue;
564509
+ }
564510
+ const info = this.analyzeGoModulePathLine(line);
564511
+ if (info != null) {
564512
+ additions.push({ index: index3, strippedContent: info.strippedContent });
564513
+ }
564514
+ }
564515
+ const removed = /* @__PURE__ */ new Set();
564516
+ const usedAdditions = /* @__PURE__ */ new Set();
564517
+ for (let index3 = 0; index3 < lines.length; index3++) {
564518
+ const line = lines[index3];
564519
+ if (line == null || !this.isDeletionLine(line)) {
564520
+ continue;
564521
+ }
564522
+ const info = this.analyzeGoModulePathLine(line);
564523
+ if (info == null || !info.hasSuffix) {
564524
+ continue;
564525
+ }
564526
+ const match3 = additions.find((addition) => !usedAdditions.has(addition.index) && addition.strippedContent === info.strippedContent);
564527
+ if (match3 != null) {
564528
+ usedAdditions.add(match3.index);
564529
+ removed.add(index3);
564530
+ removed.add(match3.index);
564531
+ }
564532
+ }
564533
+ if (removed.size === 0) {
564534
+ return lines;
564535
+ }
564536
+ return lines.filter((_5, index3) => !removed.has(index3));
564537
+ }
564538
+ /**
564539
+ * If a diff line (with its leading +/- stripped) references a Go module path — either a quoted
564540
+ * import path or a `module` directive — returns its content with any `/vN` module-version
564541
+ * suffixes removed, plus whether a suffix was present. Returns undefined for non-Go lines so
564542
+ * unrelated diffs (e.g. API URL version segments) are never touched.
564543
+ */
564544
+ analyzeGoModulePathLine(line) {
564545
+ const content5 = line.substring(1);
564546
+ const goModulePathPattern = /"[^"]*(?:github\.com|golang\.org|google\.golang\.org|gopkg\.in)\/[^"]*"/;
564547
+ const goModuleDirectivePattern = /^\s*module\s+(?:github\.com|golang\.org|google\.golang\.org|gopkg\.in)\/\S+/;
564548
+ const isGoModulePathLine = goModulePathPattern.test(content5) || goModuleDirectivePattern.test(content5.trim());
564549
+ if (!isGoModulePathLine) {
564550
+ return void 0;
564551
+ }
564552
+ const suffixPattern = /\/v\d+(?=\/|"|$)/g;
564553
+ return {
564554
+ strippedContent: content5.replace(suffixPattern, ""),
564555
+ hasSuffix: suffixPattern.test(content5)
564556
+ };
564438
564557
  }
564439
564558
  /**
564440
564559
  * Gets the latest semantic version from git tags in the given repository.
@@ -564733,8 +564852,8 @@ var require_VersionUtils = __commonJS({
564733
564852
  };
564734
564853
  Object.defineProperty(exports2, "__esModule", { value: true });
564735
564854
  exports2.VersionBump = exports2.MAX_RAW_DIFF_BYTES = exports2.MAX_CHUNKS = exports2.MAX_AI_DIFF_BYTES = exports2.MAGIC_VERSION_PYTHON = exports2.MAGIC_VERSION = exports2.AUTO_VERSION = void 0;
564736
- exports2.extractLanguageFromGeneratorName = extractLanguageFromGeneratorName2;
564737
- exports2.mapMagicVersionForLanguage = mapMagicVersionForLanguage3;
564855
+ exports2.extractLanguageFromGeneratorName = extractLanguageFromGeneratorName3;
564856
+ exports2.mapMagicVersionForLanguage = mapMagicVersionForLanguage4;
564738
564857
  exports2.maxVersionBump = maxVersionBump3;
564739
564858
  exports2.isAutoVersion = isAutoVersion5;
564740
564859
  exports2.isValidSemver = isValidSemver;
@@ -564742,7 +564861,7 @@ var require_VersionUtils = __commonJS({
564742
564861
  exports2.extractPreviousVersionFromDiffLine = extractPreviousVersionFromDiffLine;
564743
564862
  var semver_1 = __importDefault2(require_semver2());
564744
564863
  var AutoVersioningService_js_1 = require_AutoVersioningService();
564745
- function extractLanguageFromGeneratorName2(generatorName) {
564864
+ function extractLanguageFromGeneratorName3(generatorName) {
564746
564865
  const name2 = generatorName.toLowerCase();
564747
564866
  if (name2.includes("typescript") || name2.includes("ts-sdk") || name2.includes("node-sdk")) {
564748
564867
  return "typescript";
@@ -564779,7 +564898,7 @@ var require_VersionUtils = __commonJS({
564779
564898
  exports2.AUTO_VERSION = "AUTO";
564780
564899
  exports2.MAGIC_VERSION = "0.0.0-fern-placeholder";
564781
564900
  exports2.MAGIC_VERSION_PYTHON = "0.0.0.dev0";
564782
- function mapMagicVersionForLanguage3(magicVersion, language) {
564901
+ function mapMagicVersionForLanguage4(magicVersion, language) {
564783
564902
  if (magicVersion !== exports2.MAGIC_VERSION) {
564784
564903
  return magicVersion;
564785
564904
  }
@@ -582073,6 +582192,8 @@ var require_GithubStep = __commonJS({
582073
582192
  exports2.shouldCheckNoDiff = shouldCheckNoDiff;
582074
582193
  exports2.shouldPushGenerationBaseTag = shouldPushGenerationBaseTag;
582075
582194
  exports2.resolveBranchAction = resolveBranchAction;
582195
+ exports2.buildChangelogFileContents = buildChangelogFileContents;
582196
+ exports2.resolveChangelogUrl = resolveChangelogUrl;
582076
582197
  var core_utils_1 = (init_lib4(), __toCommonJS(lib_exports));
582077
582198
  var github_1 = (init_lib11(), __toCommonJS(lib_exports4));
582078
582199
  var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
@@ -582173,11 +582294,16 @@ var require_GithubStep = __commonJS({
582173
582294
  throw new Error(`Unexpected branch action: ${String(_exhaustive)}`);
582174
582295
  }
582175
582296
  }
582297
+ const createdChangelog = await this.ensureChangelogFile(resolved);
582176
582298
  if (!skipCommit) {
582177
582299
  await this.ensureFernignore();
582178
582300
  this.logger.debug("Committing changes...");
582179
582301
  await repository.commitAllChanges(resolved.commitMessage);
582180
582302
  this.logger.debug(`Committed changes to local copy of GitHub repository at ${this.outputDir}`);
582303
+ } else if (createdChangelog) {
582304
+ this.logger.debug("Committing reconstructed changelog.md on top of the replay commit...");
582305
+ await repository.add("changelog.md");
582306
+ await repository.commit(resolved.commitMessage);
582181
582307
  }
582182
582308
  if (shouldCheckNoDiff(this.config)) {
582183
582309
  const noDiff = await repository.treeHashEquals(`origin/${baseBranch}`);
@@ -582218,7 +582344,18 @@ var require_GithubStep = __commonJS({
582218
582344
  }
582219
582345
  }
582220
582346
  const headSha = await repository.getHeadSha();
582221
- const changelogUrl = resolved.changelogEntry ? `https://${remote}/${owner}/${repo}/blob/${headSha}/changelog.md` : void 0;
582347
+ const changelogCommitted = (await repository.listTrackedFiles()).includes("changelog.md");
582348
+ const changelogUrl = resolveChangelogUrl({
582349
+ changelogEntry: resolved.changelogEntry,
582350
+ changelogCommitted,
582351
+ remote,
582352
+ owner,
582353
+ repo,
582354
+ headSha
582355
+ });
582356
+ if (resolved.changelogEntry && !changelogCommitted) {
582357
+ this.logger.warn('changelog.md is not present in the committed tree; omitting the "See full changelog" link.');
582358
+ }
582222
582359
  const { prTitle, prBody } = (0, parseCommitMessage_1.parseCommitMessageForPR)(resolved.commitMessage, resolved.changelogEntry, resolved.prDescription, resolved.versionBumpReason, resolved.previousVersion, resolved.newVersion, resolved.versionBump, changelogUrl);
582223
582360
  const replaySection = (0, replay_summary_1.formatReplayPrBody)(replayResult, { branchName: prBranch, repoUri: this.config.uri });
582224
582361
  let enrichedBody = replaySection != null ? prBody + "\n\n---\n\n" + replaySection : prBody;
@@ -582284,6 +582421,7 @@ var require_GithubStep = __commonJS({
582284
582421
  this.logger.debug(`Checking out branch ${this.config.branch}`);
582285
582422
  await repository.checkout(this.config.branch);
582286
582423
  }
582424
+ await this.ensureChangelogFile(resolved);
582287
582425
  await this.ensureFernignore();
582288
582426
  this.logger.debug("Committing changes...");
582289
582427
  await repository.commitAllChanges(resolved.commitMessage);
@@ -582325,6 +582463,7 @@ var require_GithubStep = __commonJS({
582325
582463
  this.logger.debug(`Checking out branch ${this.config.branch}`);
582326
582464
  await repository.checkout(this.config.branch);
582327
582465
  }
582466
+ await this.ensureChangelogFile(resolved);
582328
582467
  await this.ensureFernignore();
582329
582468
  this.logger.debug("Committing changes...");
582330
582469
  await repository.commitAllChanges(resolved.commitMessage);
@@ -582400,6 +582539,33 @@ var require_GithubStep = __commonJS({
582400
582539
  await (0, promises_1.writeFile)(fernignorePath, "# Specify files that shouldn't be modified by Fern\n", "utf-8");
582401
582540
  }
582402
582541
  }
582542
+ /**
582543
+ * Guarantees `changelog.md` is present in the output directory whenever a changelog entry
582544
+ * exists for this run, so the file lands in the committed tree that GithubStep pushes and the
582545
+ * "See full changelog" link resolves. AutoVersionStep normally writes this file via
582546
+ * `prependChangelogEntry`; this is a safety net for paths where that write never reached the
582547
+ * directory GithubStep commits (e.g. non-replay self-hosted generation), which previously left
582548
+ * the link pointing at a non-existent blob (404).
582549
+ *
582550
+ * Returns `true` when it created the file, `false` when the file already existed (or there is
582551
+ * no changelog entry to write).
582552
+ */
582553
+ async ensureChangelogFile(resolved) {
582554
+ const entry = resolved.changelogEntry?.trim();
582555
+ if (entry == null || entry.length === 0) {
582556
+ return false;
582557
+ }
582558
+ const changelogPath = (0, path_1.join)(this.outputDir, "changelog.md");
582559
+ try {
582560
+ await (0, promises_1.access)(changelogPath);
582561
+ return false;
582562
+ } catch {
582563
+ const version7 = resolved.newVersion ?? resolved.previousVersion;
582564
+ await (0, promises_1.writeFile)(changelogPath, buildChangelogFileContents(entry, version7), "utf-8");
582565
+ this.logger.debug(`Wrote changelog.md${version7 != null ? ` for ${version7}` : ""}.`);
582566
+ return true;
582567
+ }
582568
+ }
582403
582569
  deriveSkipCommit(replayResult) {
582404
582570
  if (replayResult == null) {
582405
582571
  return false;
@@ -582480,6 +582646,24 @@ _Fern Run ID: \`${config5.runId}\`_`;
582480
582646
  }
582481
582647
  return "create-from-head";
582482
582648
  }
582649
+ function buildChangelogFileContents(entry, version7) {
582650
+ const trimmed2 = entry.trim();
582651
+ const now = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
582652
+ const header = version7 != null ? `## [${version7}] - ${now}
582653
+ ` : `## ${now}
582654
+ `;
582655
+ return `# Changelog
582656
+
582657
+ ${header}${trimmed2}
582658
+
582659
+ `;
582660
+ }
582661
+ function resolveChangelogUrl({ changelogEntry, changelogCommitted, remote, owner, repo, headSha }) {
582662
+ if (changelogEntry == null || changelogEntry.trim().length === 0 || !changelogCommitted) {
582663
+ return void 0;
582664
+ }
582665
+ return `https://${remote}/${owner}/${repo}/blob/${headSha}/changelog.md`;
582666
+ }
582483
582667
  }
582484
582668
  });
582485
582669
 
@@ -688959,7 +689143,7 @@ var AccessTokenPosthogManager = class {
688959
689143
  properties: {
688960
689144
  ...event,
688961
689145
  ...event.properties,
688962
- version: "5.67.0",
689146
+ version: "5.68.0",
688963
689147
  usingAccessToken: true,
688964
689148
  ...getRunIdProperties()
688965
689149
  }
@@ -689025,7 +689209,7 @@ var UserPosthogManager = class {
689025
689209
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
689026
689210
  event: "CLI",
689027
689211
  properties: {
689028
- version: "5.67.0",
689212
+ version: "5.68.0",
689029
689213
  ...event,
689030
689214
  ...event.properties,
689031
689215
  usingAccessToken: false,
@@ -870126,7 +870310,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
870126
870310
  var LOGS_FOLDER_NAME = "logs";
870127
870311
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
870128
870312
  function getCliSource() {
870129
- const version7 = "5.67.0";
870313
+ const version7 = "5.68.0";
870130
870314
  return `cli@${version7}`;
870131
870315
  }
870132
870316
  var DebugLogger = class {
@@ -899932,6 +900116,7 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
899932
900116
  }
899933
900117
  const effectiveIrVersion = resolvedVersion != null && (0, import_autoversion.isAutoVersion)(resolvedVersion) ? import_autoversion.MAGIC_VERSION : resolvedVersion;
899934
900118
  const userAgentTemplate = getUserAgentTemplateFromGeneratorConfig(generatorInvocation);
900119
+ const idempotencyKeyGeneration = getIdempotencyKeyGenerationFromGeneratorConfig(generatorInvocation);
899935
900120
  const ir3 = generateIntermediateRepresentation({
899936
900121
  workspace,
899937
900122
  generationLanguage: generatorInvocation.language,
@@ -899946,6 +900131,7 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
899946
900131
  readme,
899947
900132
  packageName,
899948
900133
  userAgentTemplate,
900134
+ idempotencyKeyGeneration,
899949
900135
  organization,
899950
900136
  version: effectiveIrVersion,
899951
900137
  context: interactiveTaskContext,
@@ -902685,7 +902871,7 @@ var LegacyDocsPublisher = class {
902685
902871
  previewId,
902686
902872
  disableTemplates: void 0,
902687
902873
  skipUpload,
902688
- cliVersion: "5.67.0",
902874
+ cliVersion: "5.68.0",
902689
902875
  loginCommand: "fern auth login"
902690
902876
  });
902691
902877
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -922249,6 +922435,8 @@ var Generation = class {
922249
922435
  extraDependencies: () => this.customConfig["extra-dependencies"] ?? {},
922250
922436
  /** When true, omits Fern platform headers (X-Fern-Language, SDK name/version, User-Agent) from generated SDK requests. Default: false. */
922251
922437
  omitFernHeaders: () => this.customConfig["omit-fern-headers"] ?? false,
922438
+ /** When true, emits the platform observability headers (X-Fern-Runtime, X-Fern-Runtime-Version, X-Fern-Platform). Default: false. Still subject to omitFernHeaders. */
922439
+ includePlatformHeaders: () => this.customConfig["include-platform-headers"] ?? false,
922252
922440
  /** When true, falls back to `<NuGetPackageId>/<version>` for the `User-Agent` header when the IR doesn't supply one. Default: false. */
922253
922441
  userAgentNameFromPackage: () => this.customConfig["user-agent-name-from-package"] ?? false,
922254
922442
  /** When true, moves auth params and IR headers into ClientOptions so the constructor takes only named arguments. Default: false. */
@@ -928836,6 +929024,7 @@ var BaseJavaCustomConfigSchema = external_exports2.object({
928836
929024
  "output-directory": external_exports2.enum(["source-root", "project-root"]).optional(),
928837
929025
  "custom-interceptors": external_exports2.boolean().optional(),
928838
929026
  "omit-fern-headers": external_exports2.boolean().optional(),
929027
+ includePlatformHeaders: external_exports2.boolean().optional(),
928839
929028
  "retry-status-codes": external_exports2.optional(external_exports2.enum(["legacy", "recommended"])),
928840
929029
  // Hidden options (for debugging).
928841
929030
  "enable-gradle-profiling": external_exports2.boolean().optional(),
@@ -952663,6 +952852,7 @@ var TypescriptCustomConfigSchema = external_exports2.strictObject({
952663
952852
  fetchSupport: external_exports2.optional(external_exports2.enum(["node-fetch", "native"])),
952664
952853
  packagePath: external_exports2.optional(external_exports2.string()),
952665
952854
  omitFernHeaders: external_exports2.optional(external_exports2.boolean()),
952855
+ includePlatformHeaders: external_exports2.optional(external_exports2.boolean()),
952666
952856
  useDefaultRequestParameterValues: external_exports2.optional(external_exports2.boolean()),
952667
952857
  packageManager: external_exports2.optional(external_exports2.enum(["pnpm", "yarn"])),
952668
952858
  flattenRequestParameters: external_exports2.optional(external_exports2.boolean()),
@@ -955539,6 +955729,7 @@ init_lib26();
955539
955729
  init_lib22();
955540
955730
  async function getIntermediateRepresentation({ workspace, audiences, generatorInvocation, context: context3, irVersionOverride, version: version7, packageName, userAgentTemplate, organization, sourceConfig, includeOptionalRequestPropertyExamples, ir: ir3 }) {
955541
955731
  const resolvedUserAgentTemplate = userAgentTemplate ?? getUserAgentTemplateFromGeneratorConfig(generatorInvocation);
955732
+ const idempotencyKeyGeneration = getIdempotencyKeyGenerationFromGeneratorConfig(generatorInvocation);
955542
955733
  const intermediateRepresentation = ir3 ?? generateIntermediateRepresentation({
955543
955734
  workspace,
955544
955735
  audiences,
@@ -955553,6 +955744,7 @@ async function getIntermediateRepresentation({ workspace, audiences, generatorIn
955553
955744
  version: version7,
955554
955745
  packageName,
955555
955746
  userAgentTemplate: resolvedUserAgentTemplate,
955747
+ idempotencyKeyGeneration,
955556
955748
  organization,
955557
955749
  context: context3,
955558
955750
  sourceResolver: new SourceResolverImpl(context3, workspace),
@@ -956877,7 +957069,10 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
956877
957069
  });
956878
957070
  const packageName = getPackageNameFromGeneratorConfig(generatorInvocation);
956879
957071
  const userAgentTemplate = getUserAgentTemplateFromGeneratorConfig(generatorInvocation);
957072
+ const idempotencyKeyGeneration = getIdempotencyKeyGenerationFromGeneratorConfig(generatorInvocation);
956880
957073
  version7 = version7 ?? await computeSemanticVersion({ packageName, generatorInvocation });
957074
+ const irLanguage = generatorInvocation.language ?? (0, import_autoversion4.extractLanguageFromGeneratorName)(generatorInvocation.name);
957075
+ const effectiveIrVersion = version7 != null && (0, import_autoversion4.isAutoVersion)(version7) ? (0, import_autoversion4.mapMagicVersionForLanguage)(import_autoversion4.MAGIC_VERSION, irLanguage) : version7;
956881
957076
  const intermediateRepresentation = generateIntermediateRepresentation({
956882
957077
  workspace: fernWorkspace,
956883
957078
  audiences: generatorGroup.audiences,
@@ -956889,9 +957084,10 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
956889
957084
  disabled: generatorInvocation.disableExamples
956890
957085
  },
956891
957086
  readme: generatorInvocation.readme,
956892
- version: version7 ?? await computeSemanticVersion({ packageName, generatorInvocation }),
957087
+ version: effectiveIrVersion,
956893
957088
  packageName,
956894
957089
  userAgentTemplate,
957090
+ idempotencyKeyGeneration,
956895
957091
  organization: projectConfig.organization,
956896
957092
  context: context3,
956897
957093
  sourceResolver: new SourceResolverImpl(context3, fernWorkspace),
@@ -957171,6 +957367,10 @@ async function getWorkspaceTempDir() {
957171
957367
  });
957172
957368
  }
957173
957369
  function getPublishConfig2({ generatorInvocation, org, version: version7, userProvidedVersion, packageName, context: context3, generateTests }) {
957370
+ const publishLanguage = generatorInvocation.language ?? (0, import_autoversion4.extractLanguageFromGeneratorName)(generatorInvocation.name);
957371
+ const substituteAutoVersion = (candidate) => candidate != null && (0, import_autoversion4.isAutoVersion)(candidate) ? (0, import_autoversion4.mapMagicVersionForLanguage)(import_autoversion4.MAGIC_VERSION, publishLanguage) : candidate;
957372
+ const effectiveVersion = substituteAutoVersion(version7);
957373
+ const effectiveUserProvidedVersion = substituteAutoVersion(userProvidedVersion);
957174
957374
  if (generatorInvocation.raw?.github != null && isGithubSelfhosted2(generatorInvocation.raw.github)) {
957175
957375
  const parsed = parseRepository(generatorInvocation.raw.github.uri);
957176
957376
  const irMode = generatorInvocation.raw.github.mode === "pull-request" ? "pull-request" : void 0;
@@ -957181,35 +957381,39 @@ function getPublishConfig2({ generatorInvocation, org, version: version7, userPr
957181
957381
  token: generatorInvocation.raw.github.token,
957182
957382
  mode: irMode,
957183
957383
  branch: generatorInvocation.raw.github.branch,
957184
- target: getPublishTarget({ outputSchema: generatorInvocation.raw.output, version: version7, packageName })
957384
+ target: getPublishTarget({
957385
+ outputSchema: generatorInvocation.raw.output,
957386
+ version: effectiveVersion,
957387
+ packageName
957388
+ })
957185
957389
  });
957186
957390
  }
957187
957391
  if (generatorInvocation.raw?.output?.location === "local-file-system") {
957188
957392
  let publishTarget = void 0;
957189
957393
  if (generatorInvocation.language === "python") {
957190
957394
  publishTarget = PublishTarget.pypi({
957191
- version: version7,
957395
+ version: effectiveVersion,
957192
957396
  packageName
957193
957397
  });
957194
- context3.logger.debug(`Created PyPiPublishTarget: version ${version7} package name: ${packageName}`);
957398
+ context3.logger.debug(`Created PyPiPublishTarget: version ${effectiveVersion} package name: ${packageName}`);
957195
957399
  } else if (generatorInvocation.language === "typescript") {
957196
- if (userProvidedVersion != null) {
957400
+ if (effectiveUserProvidedVersion != null) {
957197
957401
  const tsPackageName = packageName ?? (typeof generatorInvocation.raw?.config === "object" && generatorInvocation.raw?.config !== null ? generatorInvocation.raw.config.packageJson?.name : void 0);
957198
957402
  publishTarget = PublishTarget.npm({
957199
- version: userProvidedVersion,
957403
+ version: effectiveUserProvidedVersion,
957200
957404
  packageName: tsPackageName,
957201
957405
  tokenEnvironmentVariable: ""
957202
957406
  });
957203
- context3.logger.debug(`Created NpmPublishTarget: version ${userProvidedVersion} package name: ${tsPackageName}`);
957407
+ context3.logger.debug(`Created NpmPublishTarget: version ${effectiveUserProvidedVersion} package name: ${tsPackageName}`);
957204
957408
  }
957205
957409
  } else if (generatorInvocation.language === "rust") {
957206
957410
  publishTarget = PublishTarget.crates({
957207
- version: version7,
957411
+ version: effectiveVersion,
957208
957412
  packageName
957209
957413
  });
957210
- context3.logger.debug(`Created CratesPublishTarget: version ${version7} package name: ${packageName}`);
957414
+ context3.logger.debug(`Created CratesPublishTarget: version ${effectiveVersion} package name: ${packageName}`);
957211
957415
  } else if (generatorInvocation.language === "go") {
957212
- if (userProvidedVersion != null) {
957416
+ if (effectiveUserProvidedVersion != null) {
957213
957417
  const goModulePath = (() => {
957214
957418
  const config5 = generatorInvocation.raw?.config;
957215
957419
  if (typeof config5 !== "object" || config5 === null) {
@@ -957222,10 +957426,10 @@ function getPublishConfig2({ generatorInvocation, org, version: version7, userPr
957222
957426
  return module4.path;
957223
957427
  })();
957224
957428
  publishTarget = PublishTarget.go({
957225
- version: userProvidedVersion,
957429
+ version: effectiveUserProvidedVersion,
957226
957430
  modulePath: goModulePath
957227
957431
  });
957228
- context3.logger.debug(`Created GoPublishTarget: version ${userProvidedVersion} module path: ${goModulePath}`);
957432
+ context3.logger.debug(`Created GoPublishTarget: version ${effectiveUserProvidedVersion} module path: ${goModulePath}`);
957229
957433
  }
957230
957434
  } else if (generatorInvocation.language === "java") {
957231
957435
  const config5 = generatorInvocation.raw?.config;
@@ -957251,7 +957455,7 @@ function getPublishConfig2({ generatorInvocation, org, version: version7, userPr
957251
957455
  })();
957252
957456
  const coordinate = mavenCoordinate ? `${mavenCoordinate.groupId}:${mavenCoordinate.artifactId}` : void 0;
957253
957457
  if (coordinate) {
957254
- const mavenVersion = version7 ?? "0.0.0";
957458
+ const mavenVersion = effectiveVersion ?? "0.0.0";
957255
957459
  publishTarget = PublishTarget.maven({
957256
957460
  coordinate,
957257
957461
  version: mavenVersion,
@@ -957426,6 +957630,7 @@ var GenerationRunner = class {
957426
957630
  version: outputVersionOverride,
957427
957631
  packageName: generators_yml_exports.getPackageName({ generatorInvocation }),
957428
957632
  userAgentTemplate: getUserAgentTemplateFromGeneratorConfig(generatorInvocation),
957633
+ idempotencyKeyGeneration: getIdempotencyKeyGenerationFromGeneratorConfig(generatorInvocation),
957429
957634
  organization,
957430
957635
  context: context3,
957431
957636
  sourceResolver: new SourceResolverImpl(context3, workspace),
@@ -969014,7 +969219,7 @@ function getAutomationContextFromEnv() {
969014
969219
  config_branch: process.env.FERN_CONFIG_BRANCH,
969015
969220
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
969016
969221
  trigger: process.env.GITHUB_EVENT_NAME,
969017
- cli_version: "5.67.0"
969222
+ cli_version: "5.68.0"
969018
969223
  };
969019
969224
  }
969020
969225
  function isAutomationMode() {
@@ -969846,7 +970051,7 @@ var CliContext = class _CliContext {
969846
970051
  if (false) {
969847
970052
  this.logger.error("CLI_VERSION is not defined");
969848
970053
  }
969849
- return "5.67.0";
970054
+ return "5.68.0";
969850
970055
  }
969851
970056
  getCliName() {
969852
970057
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.67.0",
2
+ "version": "5.68.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",