@fern-api/fern-api-dev 5.44.13 → 5.45.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 +76 -49
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -559482,7 +559482,7 @@ __export(ai_exports, {
559482
559482
  var ModelProvider = {
559483
559483
  Openai: "openai",
559484
559484
  Anthropic: "anthropic",
559485
- Bedrock: "bedrock"
559485
+ AwsBedrock: "aws-bedrock"
559486
559486
  };
559487
559487
 
559488
559488
  // ../configuration/lib/generators-yml/schemas/api/resources/automation/index.js
@@ -561188,7 +561188,7 @@ function transformAndValidateUnion4({ value: value2, discriminant: discriminant2
561188
561188
  var ModelName = schemas_exports8.string();
561189
561189
 
561190
561190
  // ../configuration/lib/generators-yml/schemas/serialization/resources/ai/types/ModelProvider.js
561191
- var ModelProvider2 = schemas_exports8.enum_(["openai", "anthropic", "bedrock"]);
561191
+ var ModelProvider2 = schemas_exports8.enum_(["openai", "anthropic", "aws-bedrock"]);
561192
561192
 
561193
561193
  // ../configuration/lib/generators-yml/schemas/serialization/resources/ai/types/AiServicesSchema.js
561194
561194
  var AiServicesSchema = schemas_exports8.object({
@@ -661413,7 +661413,7 @@ var FernRcCliManager = class {
661413
661413
  };
661414
661414
 
661415
661415
  // ../config/lib/schemas/AiProviderSchema.js
661416
- var AiProviderSchema = external_exports.enum(["openai", "anthropic", "bedrock"]);
661416
+ var AiProviderSchema = external_exports.enum(["openai", "anthropic", "aws-bedrock"]);
661417
661417
 
661418
661418
  // ../config/lib/schemas/AiConfigSchema.js
661419
661419
  var AiConfigSchema = external_exports.object({
@@ -662223,7 +662223,7 @@ var FernRcAccountSchema = external_exports.object({
662223
662223
  });
662224
662224
 
662225
662225
  // ../config/lib/schemas/fernrc/FernRcAiSchema.js
662226
- var FernRcAiProviderSchema = external_exports.enum(["anthropic", "openai", "bedrock"]);
662226
+ var FernRcAiProviderSchema = external_exports.enum(["anthropic", "openai", "aws-bedrock"]);
662227
662227
  var FernRcAiSchema = external_exports.object({
662228
662228
  /**
662229
662229
  * Provider used for AI-powered fixes (`fern check` MDX fix suggestions).
@@ -669566,7 +669566,7 @@ var AccessTokenPosthogManager = class {
669566
669566
  properties: {
669567
669567
  ...event,
669568
669568
  ...event.properties,
669569
- version: "5.44.13",
669569
+ version: "5.45.0",
669570
669570
  usingAccessToken: true,
669571
669571
  ...getRunIdProperties()
669572
669572
  }
@@ -669630,7 +669630,7 @@ var UserPosthogManager = class {
669630
669630
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
669631
669631
  event: "CLI",
669632
669632
  properties: {
669633
- version: "5.44.13",
669633
+ version: "5.45.0",
669634
669634
  ...event,
669635
669635
  ...event.properties,
669636
669636
  usingAccessToken: false,
@@ -858299,7 +858299,7 @@ var import_path62 = __toESM(require("path"), 1);
858299
858299
  var KEYRING_ACCOUNT = {
858300
858300
  anthropic: "ai:anthropic",
858301
858301
  openai: "ai:openai",
858302
- bedrock: void 0
858302
+ "aws-bedrock": void 0
858303
858303
  // Bedrock uses AWS credentials chain, no API key stored here.
858304
858304
  };
858305
858305
  var AiCredentialStore = class {
@@ -858365,7 +858365,7 @@ async function resolveAiProvider({ aiConfig }) {
858365
858365
  }
858366
858366
  return { ok: true, provider, client: new OpenAiClient(key2) };
858367
858367
  }
858368
- case "bedrock":
858368
+ case "aws-bedrock":
858369
858369
  return { ok: true, provider, client: new BedrockClient() };
858370
858370
  }
858371
858371
  }
@@ -858444,7 +858444,7 @@ var OpenAiClient = class {
858444
858444
  };
858445
858445
  var BEDROCK_MODEL = "anthropic.claude-3-5-haiku-20241022-v1:0";
858446
858446
  var BedrockClient = class {
858447
- name = "bedrock";
858447
+ name = "aws-bedrock";
858448
858448
  model = BEDROCK_MODEL;
858449
858449
  async complete(prompt2) {
858450
858450
  const mod = await loadBedrockSdk();
@@ -859320,7 +859320,7 @@ function addCheckCommand2(cli) {
859320
859320
 
859321
859321
  // ../cli-v2/lib/commands/config/ai/command.js
859322
859322
  init_lib6();
859323
- var PROVIDERS = ["anthropic", "openai", "bedrock"];
859323
+ var PROVIDERS = ["anthropic", "openai", "aws-bedrock"];
859324
859324
  function isProvider(value2) {
859325
859325
  return PROVIDERS.includes(value2);
859326
859326
  }
@@ -859336,7 +859336,7 @@ var AiSetProviderCommand = class {
859336
859336
  const { data: data2 } = await loader2.load();
859337
859337
  await loader2.save({ ...data2, ai: { ...data2.ai, provider: args.provider } });
859338
859338
  context3.stderr.info(`${source_default.green("\u2713")} AI provider set to ${source_default.cyan(args.provider)} in ${source_default.cyan(loader2.absoluteFilePath)}`);
859339
- if (args.provider === "bedrock") {
859339
+ if (args.provider === "aws-bedrock") {
859340
859340
  context3.stderr.info(source_default.dim(" Bedrock uses AWS credentials from your environment (AWS_ACCESS_KEY_ID / AWS_PROFILE / etc.)"));
859341
859341
  } else {
859342
859342
  context3.stderr.info(source_default.dim(` Run 'fern config ai set-key <key>' to store the API key.`));
@@ -859354,9 +859354,9 @@ var AiSetKeyCommand = class {
859354
859354
  code: CliError.Code.ConfigError
859355
859355
  });
859356
859356
  }
859357
- if (providerInput === "bedrock") {
859357
+ if (providerInput === "aws-bedrock") {
859358
859358
  throw new CliError({
859359
- message: `Provider 'bedrock' does not use a stored API key.
859359
+ message: `Provider 'aws-bedrock' does not use a stored API key.
859360
859360
  Bedrock reads credentials from your AWS environment (AWS_ACCESS_KEY_ID, AWS_PROFILE, etc.).`,
859361
859361
  code: CliError.Code.ConfigError
859362
859362
  });
@@ -859378,9 +859378,9 @@ var AiGetKeyCommand = class {
859378
859378
  code: CliError.Code.ConfigError
859379
859379
  });
859380
859380
  }
859381
- if (providerInput === "bedrock") {
859381
+ if (providerInput === "aws-bedrock") {
859382
859382
  throw new CliError({
859383
- message: `Provider 'bedrock' does not use a stored API key (uses AWS credentials).`,
859383
+ message: `Provider 'aws-bedrock' does not use a stored API key (uses AWS credentials).`,
859384
859384
  code: CliError.Code.ConfigError
859385
859385
  });
859386
859386
  }
@@ -859418,7 +859418,7 @@ var AiStatusCommand = class {
859418
859418
  };
859419
859419
  function addAiSetProviderCommand(cli) {
859420
859420
  const cmd = new AiSetProviderCommand();
859421
- command2(cli, "set-provider <provider>", "Choose the AI provider for `fern check` fixes (anthropic, openai, or bedrock)", (context3, args) => cmd.handle(context3, args), (yargs) => yargs.positional("provider", {
859421
+ command2(cli, "set-provider <provider>", "Choose the AI provider for `fern check` fixes (anthropic, openai, or aws-bedrock)", (context3, args) => cmd.handle(context3, args), (yargs) => yargs.positional("provider", {
859422
859422
  type: "string",
859423
859423
  description: "AI provider name",
859424
859424
  choices: [...PROVIDERS],
@@ -861371,7 +861371,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
861371
861371
  var LOGS_FOLDER_NAME = "logs";
861372
861372
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
861373
861373
  function getCliSource() {
861374
- const version7 = "5.44.13";
861374
+ const version7 = "5.45.0";
861375
861375
  return `cli@${version7}`;
861376
861376
  }
861377
861377
  var DebugLogger = class {
@@ -892463,7 +892463,7 @@ var LegacyDocsPublisher = class {
892463
892463
  previewId,
892464
892464
  disableTemplates: void 0,
892465
892465
  skipUpload,
892466
- cliVersion: "5.44.13",
892466
+ cliVersion: "5.45.0",
892467
892467
  loginCommand: "fern auth login"
892468
892468
  });
892469
892469
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -923897,7 +923897,7 @@ var DynamicTypeLiteralMapper2 = class {
923897
923897
  name: this.context.getClassName(discriminatedUnion2.declaration.name),
923898
923898
  namespace: this.context.getTypesNamespace(discriminatedUnion2.declaration.fernFilepath)
923899
923899
  }),
923900
- method: this.context.getMethodName(unionVariant.discriminantValue.name),
923900
+ method: this.context.getPropertyName(unionVariant.discriminantValue.name),
923901
923901
  arguments_: this.convertDiscriminatedUnionVariantArgs({
923902
923902
  discriminatedUnionTypeInstance,
923903
923903
  unionVariant,
@@ -923942,12 +923942,14 @@ var DynamicTypeLiteralMapper2 = class {
923942
923942
  }
923943
923943
  ];
923944
923944
  }
923945
+ const wireValue = unionVariant.discriminantValue.wireValue;
923946
+ const singlePropertyValue = record23[wireValue] ?? record23["value"];
923945
923947
  return [
923946
923948
  {
923947
923949
  name: this.context.getPropertyName(unionVariant.discriminantValue.name),
923948
923950
  value: this.convert({
923949
923951
  typeReference: unionVariant.typeReference,
923950
- value: record23[unionVariant.discriminantValue.wireValue]
923952
+ value: singlePropertyValue
923951
923953
  })
923952
923954
  }
923953
923955
  ];
@@ -923962,20 +923964,14 @@ var DynamicTypeLiteralMapper2 = class {
923962
923964
  }
923963
923965
  }
923964
923966
  convertDiscriminatedUnionVariantArgs({ discriminatedUnionTypeInstance, unionVariant, unionProperties }) {
923965
- const baseFields = this.getBaseFields({
923967
+ const { required: requiredBaseFields, optional: optionalBaseFields } = this.getBaseFields({
923966
923968
  discriminatedUnionTypeInstance,
923967
923969
  singleDiscriminatedUnionType: unionVariant
923968
923970
  });
923969
923971
  if (unionVariant.type === "singleProperty") {
923970
- const record23 = this.context.getRecord(discriminatedUnionTypeInstance.value);
923971
- if (record23 == null && unionProperties.length === 1) {
923972
- return [
923973
- ...baseFields,
923974
- this.convert({
923975
- typeReference: unionVariant.typeReference,
923976
- value: discriminatedUnionTypeInstance.value
923977
- })
923978
- ];
923972
+ const singleProperty = unionProperties[0];
923973
+ if (singleProperty != null) {
923974
+ return [...requiredBaseFields, singleProperty.value, ...optionalBaseFields];
923979
923975
  }
923980
923976
  }
923981
923977
  if (unionVariant.type === "samePropertiesAsObject") {
@@ -923986,17 +923982,18 @@ var DynamicTypeLiteralMapper2 = class {
923986
923982
  return [];
923987
923983
  }
923988
923984
  return [
923989
- ...baseFields,
923985
+ ...requiredBaseFields,
923990
923986
  php_exports.TypeLiteral.class_({
923991
923987
  reference: php_exports.classReference({
923992
923988
  name: this.context.getClassName(named.declaration.name),
923993
923989
  namespace: this.context.getTypesNamespace(named.declaration.fernFilepath)
923994
923990
  }),
923995
923991
  fields: unionProperties
923996
- })
923992
+ }),
923993
+ ...optionalBaseFields
923997
923994
  ];
923998
923995
  }
923999
- return baseFields;
923996
+ return [...requiredBaseFields, ...optionalBaseFields];
924000
923997
  }
924001
923998
  getBaseFields({ discriminatedUnionTypeInstance, singleDiscriminatedUnionType }) {
924002
923999
  const properties7 = this.context.associateByWireValue({
@@ -924006,14 +924003,22 @@ var DynamicTypeLiteralMapper2 = class {
924006
924003
  // are handled by the union variant.
924007
924004
  ignoreMissingParameters: true
924008
924005
  });
924009
- return properties7.map((property24) => {
924006
+ const required6 = [];
924007
+ const optional23 = [];
924008
+ for (const property24 of properties7) {
924010
924009
  this.context.errors.scope(property24.name.wireValue);
924011
924010
  try {
924012
- return this.convert(property24);
924011
+ const converted = this.convert(property24);
924012
+ if (this.isOptionalOrNullable(property24.typeReference)) {
924013
+ optional23.push(converted);
924014
+ } else {
924015
+ required6.push(converted);
924016
+ }
924013
924017
  } finally {
924014
924018
  this.context.errors.unscope();
924015
924019
  }
924016
- });
924020
+ }
924021
+ return { required: required6, optional: optional23 };
924017
924022
  }
924018
924023
  convertObject({ object_, value: value2 }) {
924019
924024
  const record23 = this.context.getRecord(value2) ?? {};
@@ -957624,7 +957629,7 @@ function getAutomationContextFromEnv() {
957624
957629
  config_branch: process.env.FERN_CONFIG_BRANCH,
957625
957630
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
957626
957631
  trigger: process.env.GITHUB_EVENT_NAME,
957627
- cli_version: "5.44.13"
957632
+ cli_version: "5.45.0"
957628
957633
  };
957629
957634
  }
957630
957635
  function isAutomationMode() {
@@ -958450,7 +958455,7 @@ var CliContext = class _CliContext {
958450
958455
  if (false) {
958451
958456
  this.logger.error("CLI_VERSION is not defined");
958452
958457
  }
958453
- return "5.44.13";
958458
+ return "5.45.0";
958454
958459
  }
958455
958460
  getCliName() {
958456
958461
  if (false) {
@@ -968478,10 +968483,11 @@ function convertHttpEndpoint4({
968478
968483
  if (url3 == null) {
968479
968484
  throw new CliError({ message: "No URL defined for " + baseUrlId, code: CliError.Code.InternalError });
968480
968485
  }
968481
- const server = { url: url3 };
968482
- if (environment2.docs != null) {
968483
- server.description = environment2.docs;
968484
- }
968486
+ const envName = getOriginalName(environment2.name);
968487
+ const server = {
968488
+ url: url3,
968489
+ description: environment2.docs != null ? `${envName} (${environment2.docs})` : envName
968490
+ };
968485
968491
  return server;
968486
968492
  });
968487
968493
  }
@@ -969156,13 +969162,34 @@ function convertIrToOpenApi({
969156
969162
  securitySchemes: constructSecuritySchemes(ir11.auth)
969157
969163
  }
969158
969164
  };
969159
- if (ir11.environments != null && ir11.environments.environments.type === "singleBaseUrl") {
969160
- openAPISpec.servers = ir11.environments.environments.environments.map((environment2) => {
969161
- return {
969162
- url: environment2.url,
969163
- description: environment2.docs != null ? `${getOriginalName(environment2.name)} (${environment2.docs})` : getOriginalName(environment2.name)
969164
- };
969165
- });
969165
+ if (ir11.environments != null) {
969166
+ const envs = ir11.environments.environments;
969167
+ if (envs.type === "singleBaseUrl") {
969168
+ openAPISpec.servers = envs.environments.map((environment2) => {
969169
+ return {
969170
+ url: environment2.url,
969171
+ description: environment2.docs != null ? `${getOriginalName(environment2.name)} (${environment2.docs})` : getOriginalName(environment2.name)
969172
+ };
969173
+ });
969174
+ } else if (envs.type === "multipleBaseUrls") {
969175
+ const servers = [];
969176
+ for (const environment2 of envs.environments) {
969177
+ const envName = getOriginalName(environment2.name);
969178
+ for (const baseUrlDef of envs.baseUrls) {
969179
+ const url3 = environment2.urls[baseUrlDef.id];
969180
+ if (url3 != null) {
969181
+ const urlName = getOriginalName(baseUrlDef.name);
969182
+ servers.push({
969183
+ url: url3,
969184
+ description: environment2.docs != null ? `${envName} - ${urlName} (${environment2.docs})` : `${envName} (${urlName})`
969185
+ });
969186
+ }
969187
+ }
969188
+ }
969189
+ if (servers.length > 0) {
969190
+ openAPISpec.servers = servers;
969191
+ }
969192
+ }
969166
969193
  }
969167
969194
  return openAPISpec;
969168
969195
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.44.13",
2
+ "version": "5.45.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",