@fern-api/fern-api-dev 5.68.0 → 5.70.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 +148 -21
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -83938,10 +83938,16 @@ function parseIdempotencyKeyMethods(value2) {
83938
83938
  return methods.length > 0 ? methods : DEFAULT_IDEMPOTENCY_KEY_METHODS;
83939
83939
  }
83940
83940
  function getIdempotencyKeyGenerationFromGeneratorConfig(generatorInvocation) {
83941
+ const value2 = generatorInvocation.idempotencyKeyGenerationConfig ?? getRawPerGeneratorIdempotencyKeyConfig(generatorInvocation);
83942
+ return resolveIdempotencyKeyGeneration(value2);
83943
+ }
83944
+ function getRawPerGeneratorIdempotencyKeyConfig(generatorInvocation) {
83941
83945
  if (typeof generatorInvocation.raw?.config !== "object" || generatorInvocation.raw?.config === null) {
83942
83946
  return void 0;
83943
83947
  }
83944
- const value2 = generatorInvocation.raw.config["auto-generate-idempotency-key"];
83948
+ return generatorInvocation.raw.config["auto-generate-idempotency-key"];
83949
+ }
83950
+ function resolveIdempotencyKeyGeneration(value2) {
83945
83951
  if (value2 === true) {
83946
83952
  return { headerName: DEFAULT_IDEMPOTENCY_KEY_HEADER, methods: DEFAULT_IDEMPOTENCY_KEY_METHODS };
83947
83953
  }
@@ -117172,7 +117178,8 @@ var init_DocsYmlSchemas = __esm({
117172
117178
  model: AIChatModel.optional(),
117173
117179
  "system-prompt": external_exports.string().optional(),
117174
117180
  location: external_exports.array(AIChatLocation).optional(),
117175
- datasources: external_exports.array(AIChatDatasource).optional()
117181
+ datasources: external_exports.array(AIChatDatasource).optional(),
117182
+ "mask-pii": external_exports.boolean().optional()
117176
117183
  });
117177
117184
  FontConfigVariant = external_exports.object({
117178
117185
  path: external_exports.string(),
@@ -121570,7 +121577,8 @@ var init_AiChatConfig2 = __esm({
121570
121577
  model: AiChatModel2.optional(),
121571
121578
  systemPrompt: schemas_exports6.property("system-prompt", schemas_exports6.string().optional()),
121572
121579
  location: schemas_exports6.list(AiChatLocation2).optional(),
121573
- datasources: schemas_exports6.list(AiChatDatasource).optional()
121580
+ datasources: schemas_exports6.list(AiChatDatasource).optional(),
121581
+ maskPii: schemas_exports6.property("mask-pii", schemas_exports6.boolean().optional())
121574
121582
  });
121575
121583
  }
121576
121584
  });
@@ -129759,7 +129767,9 @@ var init_ApiConfigurationV2SettingsSchema2 = __esm({
129759
129767
  init_core6();
129760
129768
  init_AsyncApiSettingsSchema2();
129761
129769
  init_OpenApiSettingsSchema2();
129762
- ApiConfigurationV2SettingsSchema = schemas_exports8.object({}).extend(OpenApiSettingsSchema).extend(AsyncApiSettingsSchema);
129770
+ ApiConfigurationV2SettingsSchema = schemas_exports8.object({
129771
+ "auto-generate-idempotency-key": schemas_exports8.unknown().optional()
129772
+ }).extend(OpenApiSettingsSchema).extend(AsyncApiSettingsSchema);
129763
129773
  }
129764
129774
  });
129765
129775
 
@@ -259646,6 +259656,8 @@ async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfigur
259646
259656
  const readme = rawGeneratorsConfiguration.readme;
259647
259657
  warnForDeprecatedConfiguration(context3, rawGeneratorsConfiguration);
259648
259658
  const parsedApiConfiguration = await parseAPIConfiguration(rawGeneratorsConfiguration);
259659
+ const apiConfiguration = rawGeneratorsConfiguration.api;
259660
+ const globalIdempotencyKeyGeneration = apiConfiguration != null && generators_yml_exports.isApiConfigurationV2Schema(apiConfiguration) ? apiConfiguration.settings?.["auto-generate-idempotency-key"] : void 0;
259649
259661
  return {
259650
259662
  absolutePathToConfiguration: absolutePathToGeneratorsConfiguration,
259651
259663
  api: parsedApiConfiguration,
@@ -259660,6 +259672,7 @@ async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfigur
259660
259672
  maybeTopLevelMetadata,
259661
259673
  maybeTopLevelReviewers: rawGeneratorsConfiguration.reviewers,
259662
259674
  maybeRootAutomation: rawGeneratorsConfiguration.automation,
259675
+ globalIdempotencyKeyGeneration,
259663
259676
  readme,
259664
259677
  context: context3
259665
259678
  }))) : [],
@@ -260044,7 +260057,7 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
260044
260057
  definitions: await parseAPIConfigurationToApiLocations(apiConfiguration, rawGeneratorsConfiguration, emptySettings)
260045
260058
  };
260046
260059
  }
260047
- async function convertGroup({ absolutePathToGeneratorsConfiguration, groupName, group, maybeTopLevelMetadata, maybeTopLevelReviewers, maybeRootAutomation, readme, context: context3 }) {
260060
+ async function convertGroup({ absolutePathToGeneratorsConfiguration, groupName, group, maybeTopLevelMetadata, maybeTopLevelReviewers, maybeRootAutomation, globalIdempotencyKeyGeneration, readme, context: context3 }) {
260048
260061
  const maybeGroupLevelMetadata = getOutputMetadata(group.metadata);
260049
260062
  return {
260050
260063
  groupName,
@@ -260059,6 +260072,7 @@ async function convertGroup({ absolutePathToGeneratorsConfiguration, groupName,
260059
260072
  maybeGroupLevelReviewers: group.reviewers,
260060
260073
  maybeRootAutomation,
260061
260074
  maybeGroupAutomation: group.automation,
260075
+ globalIdempotencyKeyGeneration,
260062
260076
  readme,
260063
260077
  context: context3
260064
260078
  })))
@@ -260080,10 +260094,12 @@ function getGeneratorNameAndImage(generator, context3) {
260080
260094
  containerImage: void 0
260081
260095
  };
260082
260096
  }
260083
- async function convertGenerator({ absolutePathToGeneratorsConfiguration, generator, maybeGroupLevelMetadata, maybeTopLevelMetadata, maybeGroupLevelReviewers, maybeTopLevelReviewers, maybeRootAutomation, maybeGroupAutomation, readme, context: context3 }) {
260097
+ async function convertGenerator({ absolutePathToGeneratorsConfiguration, generator, maybeGroupLevelMetadata, maybeTopLevelMetadata, maybeGroupLevelReviewers, maybeTopLevelReviewers, maybeRootAutomation, maybeGroupAutomation, globalIdempotencyKeyGeneration, readme, context: context3 }) {
260084
260098
  const { normalizedName, containerImage } = getGeneratorNameAndImage(generator, context3);
260099
+ const perGeneratorIdempotencyKeyGeneration = typeof generator.config === "object" && generator.config !== null ? generator.config["auto-generate-idempotency-key"] : void 0;
260085
260100
  return {
260086
260101
  raw: generator,
260102
+ idempotencyKeyGenerationConfig: perGeneratorIdempotencyKeyGeneration ?? globalIdempotencyKeyGeneration,
260087
260103
  automation: generators_yml_exports.resolveAutomationConfig({
260088
260104
  rootAutomation: maybeRootAutomation,
260089
260105
  groupAutomation: maybeGroupAutomation,
@@ -461429,7 +461445,8 @@ var init_DocsDefinitionResolver = __esm({
461429
461445
  datasources: this.parsedDocsConfig.aiChatConfig.datasources?.map((ds2) => ({
461430
461446
  url: ds2.url,
461431
461447
  title: ds2.title
461432
- }))
461448
+ })),
461449
+ maskPii: this.parsedDocsConfig.aiChatConfig.maskPii
461433
461450
  } : void 0,
461434
461451
  hideNavLinks: void 0,
461435
461452
  title: this.parsedDocsConfig.title,
@@ -565872,7 +565889,8 @@ var require_AutoVersionStep = __commonJS({
565872
565889
  }
565873
565890
  async handleNormalFlow(params2) {
565874
565891
  const { prepared, service, language, mappedMagicVersion, previousGenerationSha } = params2;
565875
- const rawDiff = this.gitDiff(previousGenerationSha, prepared.currentGenerationSha);
565892
+ const diffBase = this.resolveReachableGenerationBase(previousGenerationSha, prepared.currentGenerationSha);
565893
+ const rawDiff = diffBase != null ? this.safeGitDiff(diffBase, prepared.currentGenerationSha) : "";
565876
565894
  const previousVersion = await this.resolvePreviousVersion({
565877
565895
  service,
565878
565896
  rawDiff,
@@ -566269,6 +566287,91 @@ var require_AutoVersionStep = __commonJS({
566269
566287
  maxBuffer: 256 * 1024 * 1024
566270
566288
  });
566271
566289
  }
566290
+ /**
566291
+ * Resolves a reachable base commit for the autoversion diff.
566292
+ *
566293
+ * `recordedSha` (the previous generation from replay.lock) is preferred when it exists
566294
+ * in this clone. When it doesn't — e.g. the signed-commit push recreated the
566295
+ * [fern-generated] commit under a new SHA, or the branch was squash-merged — we re-anchor
566296
+ * on the most recent reachable [fern-generated] commit in history. Returns null when no
566297
+ * generation baseline is reachable at all, in which case the caller resolves the previous
566298
+ * version from metadata/git-tags and still rewrites the placeholder.
566299
+ */
566300
+ resolveReachableGenerationBase(recordedSha, currentGenerationSha) {
566301
+ if (this.commitExists(recordedSha)) {
566302
+ return recordedSha;
566303
+ }
566304
+ this.logger.warn(`AutoVersionStep: recorded previous generation ${recordedSha.slice(0, 7)} is unreachable in this clone; deriving the baseline from history.`);
566305
+ const derived = this.findPreviousGenerationFromHistory(currentGenerationSha);
566306
+ if (derived != null) {
566307
+ this.logger.info(`AutoVersionStep: re-anchored autoversion baseline on ${derived.slice(0, 7)}.`);
566308
+ return derived;
566309
+ }
566310
+ this.logger.warn("AutoVersionStep: no reachable [fern-generated] baseline found; falling back to metadata/git-tags.");
566311
+ return null;
566312
+ }
566313
+ commitExists(sha) {
566314
+ if (!/^[0-9a-f]{7,40}$/.test(sha)) {
566315
+ return false;
566316
+ }
566317
+ try {
566318
+ (0, child_process_1.execFileSync)("git", ["cat-file", "-e", `${sha}^{commit}`], {
566319
+ cwd: this.outputDir,
566320
+ stdio: "pipe"
566321
+ });
566322
+ return true;
566323
+ } catch {
566324
+ return false;
566325
+ }
566326
+ }
566327
+ /**
566328
+ * Walks first-parent history from the current generation commit and returns the most
566329
+ * recent prior [fern-generated] commit — the reachable equivalent of replay.lock's
566330
+ * recorded baseline. Mirrors @fern-api/replay's `findPreviousGenerationFromHistory`.
566331
+ */
566332
+ findPreviousGenerationFromHistory(currentGenerationSha) {
566333
+ const start2 = this.commitExists(currentGenerationSha) ? currentGenerationSha : "HEAD";
566334
+ let log4;
566335
+ try {
566336
+ log4 = (0, child_process_1.execFileSync)("git", ["log", "--first-parent", "--format=%H%x00%s", start2], {
566337
+ cwd: this.outputDir,
566338
+ encoding: "utf-8",
566339
+ stdio: "pipe",
566340
+ maxBuffer: 64 * 1024 * 1024
566341
+ });
566342
+ } catch (error50) {
566343
+ this.logger.debug(`AutoVersionStep: git log history walk failed (${String(error50)}); no baseline derived.`);
566344
+ return null;
566345
+ }
566346
+ for (const line of log4.split("\n")) {
566347
+ if (line.trim().length === 0) {
566348
+ continue;
566349
+ }
566350
+ const [sha, subject = ""] = line.split("\0");
566351
+ if (sha == null || sha === currentGenerationSha) {
566352
+ continue;
566353
+ }
566354
+ if (subject.startsWith("[fern-generated]")) {
566355
+ return sha;
566356
+ }
566357
+ }
566358
+ return null;
566359
+ }
566360
+ /**
566361
+ * `gitDiff` that degrades to an empty diff instead of throwing. Both endpoints are
566362
+ * expected to be reachable (the base is resolved via resolveReachableGenerationBase and
566363
+ * `to` is this run's freshly-created HEAD), but we never want a `git diff` failure to
566364
+ * abort autoversion and leave the magic placeholder in the shipped SDK — the empty diff
566365
+ * routes version resolution to baseVersion/metadata/git-tags, which still rewrites it.
566366
+ */
566367
+ safeGitDiff(from4, to2) {
566368
+ try {
566369
+ return this.gitDiff(from4, to2);
566370
+ } catch (error50) {
566371
+ this.logger.warn(`AutoVersionStep: git diff ${from4.slice(0, 7)}..${to2.slice(0, 7)} failed (${error50 instanceof Error ? error50.message : String(error50)}); proceeding with an empty diff.`);
566372
+ return "";
566373
+ }
566374
+ }
566272
566375
  gitDiff(from4, to2) {
566273
566376
  return (0, child_process_1.execFileSync)("git", ["diff", from4, to2, "--", ".", ":(exclude).fern/metadata.json"], {
566274
566377
  cwd: this.outputDir,
@@ -689143,7 +689246,7 @@ var AccessTokenPosthogManager = class {
689143
689246
  properties: {
689144
689247
  ...event,
689145
689248
  ...event.properties,
689146
- version: "5.68.0",
689249
+ version: "5.70.0",
689147
689250
  usingAccessToken: true,
689148
689251
  ...getRunIdProperties()
689149
689252
  }
@@ -689209,7 +689312,7 @@ var UserPosthogManager = class {
689209
689312
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
689210
689313
  event: "CLI",
689211
689314
  properties: {
689212
- version: "5.68.0",
689315
+ version: "5.70.0",
689213
689316
  ...event,
689214
689317
  ...event.properties,
689215
689318
  usingAccessToken: false,
@@ -834305,8 +834408,8 @@ var V67_TO_V66_MIGRATION = {
834305
834408
  [GeneratorName.TYPESCRIPT_SDK]: "3.70.9-rc.0",
834306
834409
  [GeneratorName.TYPESCRIPT_EXPRESS]: GeneratorWasNeverUpdatedToConsumeNewIR,
834307
834410
  [GeneratorName.JAVA]: GeneratorWasNeverUpdatedToConsumeNewIR,
834308
- [GeneratorName.JAVA_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
834309
- [GeneratorName.JAVA_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
834411
+ [GeneratorName.JAVA_MODEL]: "1.9.0-rc.1",
834412
+ [GeneratorName.JAVA_SDK]: "4.13.3-rc.0",
834310
834413
  [GeneratorName.JAVA_SPRING]: GeneratorWasNeverUpdatedToConsumeNewIR,
834311
834414
  [GeneratorName.OPENAPI_PYTHON_CLIENT]: GeneratorWasNeverUpdatedToConsumeNewIR,
834312
834415
  [GeneratorName.OPENAPI]: GeneratorWasNeverUpdatedToConsumeNewIR,
@@ -834317,13 +834420,13 @@ var V67_TO_V66_MIGRATION = {
834317
834420
  [GeneratorName.POSTMAN]: GeneratorWasNeverUpdatedToConsumeNewIR,
834318
834421
  [GeneratorName.GO_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
834319
834422
  [GeneratorName.GO_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
834320
- [GeneratorName.RUBY_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
834423
+ [GeneratorName.RUBY_SDK]: "1.16.0-rc.0",
834321
834424
  [GeneratorName.CSHARP_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
834322
834425
  [GeneratorName.CSHARP_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
834323
834426
  [GeneratorName.SWIFT_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
834324
834427
  [GeneratorName.SWIFT_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
834325
834428
  [GeneratorName.PHP_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
834326
- [GeneratorName.PHP_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
834429
+ [GeneratorName.PHP_SDK]: "2.11.2-rc.0",
834327
834430
  [GeneratorName.RUST_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
834328
834431
  [GeneratorName.RUST_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
834329
834432
  [GeneratorName.CLI]: "0.0.1"
@@ -870310,7 +870413,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
870310
870413
  var LOGS_FOLDER_NAME = "logs";
870311
870414
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
870312
870415
  function getCliSource() {
870313
- const version7 = "5.68.0";
870416
+ const version7 = "5.70.0";
870314
870417
  return `cli@${version7}`;
870315
870418
  }
870316
870419
  var DebugLogger = class {
@@ -897106,6 +897209,17 @@ var definitions6 = {
897106
897209
  }
897107
897210
  ],
897108
897211
  description: "Additional content sources that Ask Fern should index and search."
897212
+ },
897213
+ "mask-pii": {
897214
+ oneOf: [
897215
+ {
897216
+ type: "boolean"
897217
+ },
897218
+ {
897219
+ type: "null"
897220
+ }
897221
+ ],
897222
+ description: "When enabled, personally identifiable information (PII) in user messages is masked before\nbeing sent to Ask Fern. Disabled by default."
897109
897223
  }
897110
897224
  },
897111
897225
  additionalProperties: false
@@ -902871,7 +902985,7 @@ var LegacyDocsPublisher = class {
902871
902985
  previewId,
902872
902986
  disableTemplates: void 0,
902873
902987
  skipUpload,
902874
- cliVersion: "5.68.0",
902988
+ cliVersion: "5.70.0",
902875
902989
  loginCommand: "fern auth login"
902876
902990
  });
902877
902991
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -938718,6 +938832,19 @@ var DynamicSnippetsGeneratorContext5 = class _DynamicSnippetsGeneratorContext ex
938718
938832
  }
938719
938833
  return name2.snakeCase.safeName;
938720
938834
  }
938835
+ /**
938836
+ * Module/subpackage directory name, preserving any leading/trailing underscores
938837
+ * from the original name that the casing functions would otherwise strip. This
938838
+ * keeps snippet accessors and module paths consistent with the generated module
938839
+ * directories (e.g. a group named `_agents` yields `client._agents`). It is scoped
938840
+ * to namespace/module names and intentionally not applied to property or method names.
938841
+ */
938842
+ getModuleName(name2) {
938843
+ const leading = name2.originalName.match(/^(_+)/)?.[1] ?? "";
938844
+ const core2 = name2.originalName.slice(leading.length);
938845
+ const trailing = core2.match(/(_+)$/)?.[1] ?? "";
938846
+ return `${leading}${name2.snakeCase.safeName}${trailing}`;
938847
+ }
938721
938848
  getRootClientClassReference() {
938722
938849
  return python_exports.reference({
938723
938850
  name: this.getRootClientClassName(),
@@ -938728,7 +938855,7 @@ var DynamicSnippetsGeneratorContext5 = class _DynamicSnippetsGeneratorContext ex
938728
938855
  const className = this.getClassName(declaration.name);
938729
938856
  const modulePath = [
938730
938857
  ...this.getRootModulePath(),
938731
- ...declaration.fernFilepath.allParts.map((part) => part.snakeCase.safeName)
938858
+ ...declaration.fernFilepath.allParts.map((part) => this.getModuleName(part))
938732
938859
  ];
938733
938860
  return python_exports.reference({ name: className, modulePath });
938734
938861
  }
@@ -938737,7 +938864,7 @@ var DynamicSnippetsGeneratorContext5 = class _DynamicSnippetsGeneratorContext ex
938737
938864
  const variantName = discriminantValue.name.pascalCase.safeName;
938738
938865
  const modulePath = [
938739
938866
  ...this.getRootModulePath(),
938740
- ...unionDeclaration.fernFilepath.allParts.map((part) => part.snakeCase.safeName)
938867
+ ...unionDeclaration.fernFilepath.allParts.map((part) => this.getModuleName(part))
938741
938868
  ];
938742
938869
  const name2 = this.customConfig.pydantic_config?.union_naming === "v1" ? `${variantName}${unionClassName}` : `${unionClassName}_${variantName}`;
938743
938870
  return python_exports.reference({ name: name2, modulePath });
@@ -939543,7 +939670,7 @@ var EndpointSnippetGenerator5 = class {
939543
939670
  }
939544
939671
  getMethod({ endpoint: endpoint3 }) {
939545
939672
  if (endpoint3.declaration.fernFilepath.allParts.length > 0) {
939546
- return `${endpoint3.declaration.fernFilepath.allParts.map((val) => this.context.getMethodName(val)).join(".")}.${this.context.getMethodName(endpoint3.declaration.name)}`;
939673
+ return `${endpoint3.declaration.fernFilepath.allParts.map((val) => this.context.getModuleName(val)).join(".")}.${this.context.getMethodName(endpoint3.declaration.name)}`;
939547
939674
  }
939548
939675
  return this.context.getMethodName(endpoint3.declaration.name);
939549
939676
  }
@@ -969219,7 +969346,7 @@ function getAutomationContextFromEnv() {
969219
969346
  config_branch: process.env.FERN_CONFIG_BRANCH,
969220
969347
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
969221
969348
  trigger: process.env.GITHUB_EVENT_NAME,
969222
- cli_version: "5.68.0"
969349
+ cli_version: "5.70.0"
969223
969350
  };
969224
969351
  }
969225
969352
  function isAutomationMode() {
@@ -970051,7 +970178,7 @@ var CliContext = class _CliContext {
970051
970178
  if (false) {
970052
970179
  this.logger.error("CLI_VERSION is not defined");
970053
970180
  }
970054
- return "5.68.0";
970181
+ return "5.70.0";
970055
970182
  }
970056
970183
  getCliName() {
970057
970184
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.68.0",
2
+ "version": "5.70.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",