@fern-api/fern-api-dev 3.58.0 → 3.59.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 +121 -37
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1435488,9 +1435488,47 @@ var ApiSpecSchema = external_exports.union([
1435488
1435488
  OpenRpcSpecSchema
1435489
1435489
  ]);
1435490
1435490
 
1435491
+ // ../config/lib/schemas/AuthSchemesSchema.js
1435492
+ var AuthSchemesSchema = external_exports.record(external_exports.string(), external_exports.unknown());
1435493
+
1435494
+ // ../config/lib/schemas/MultipleBaseUrlEnvironmentSchema.js
1435495
+ var MultipleBaseUrlsEnvironmentSchema = external_exports.object({
1435496
+ urls: external_exports.record(external_exports.string(), external_exports.string()),
1435497
+ docs: external_exports.string().optional()
1435498
+ });
1435499
+
1435500
+ // ../config/lib/schemas/SingleBaseUrlEnvironmentSchema.js
1435501
+ var SingleBaseUrlEnvironmentSchema = external_exports.object({
1435502
+ url: external_exports.string(),
1435503
+ docs: external_exports.string().optional()
1435504
+ });
1435505
+
1435506
+ // ../config/lib/schemas/EnvironmentSchema.js
1435507
+ var EnvironmentSchema = external_exports.union([
1435508
+ external_exports.string(),
1435509
+ SingleBaseUrlEnvironmentSchema,
1435510
+ MultipleBaseUrlsEnvironmentSchema
1435511
+ ]);
1435512
+
1435513
+ // ../config/lib/schemas/HeaderConfigSchema.js
1435514
+ var HeaderConfigSchema = external_exports.object({
1435515
+ name: external_exports.string().optional(),
1435516
+ env: external_exports.string().optional(),
1435517
+ docs: external_exports.string().optional()
1435518
+ });
1435519
+
1435520
+ // ../config/lib/schemas/HeaderSchema.js
1435521
+ var HeaderSchema = external_exports.union([external_exports.string(), HeaderConfigSchema]);
1435522
+
1435491
1435523
  // ../config/lib/schemas/ApiDefinitionSchema.js
1435492
1435524
  var ApiDefinitionSchema = external_exports.object({
1435493
- specs: external_exports.array(ApiSpecSchema)
1435525
+ specs: external_exports.array(ApiSpecSchema),
1435526
+ auth: external_exports.string().optional(),
1435527
+ defaultUrl: external_exports.string().optional(),
1435528
+ defaultEnvironment: external_exports.string().optional(),
1435529
+ environments: external_exports.record(external_exports.string(), EnvironmentSchema).optional(),
1435530
+ headers: external_exports.record(external_exports.string(), HeaderSchema).optional(),
1435531
+ authSchemes: AuthSchemesSchema.optional()
1435494
1435532
  });
1435495
1435533
 
1435496
1435534
  // ../config/lib/schemas/ApisSchema.js
@@ -1436849,8 +1436887,17 @@ var ApiDefinitionConverter = class {
1436849
1436887
  specs: api.specs,
1436850
1436888
  sourced: sourcedApi.specs
1436851
1436889
  });
1436890
+ const apiDefinition = {
1436891
+ specs,
1436892
+ auth: api.auth,
1436893
+ authSchemes: api.authSchemes,
1436894
+ defaultUrl: api.defaultUrl,
1436895
+ defaultEnvironment: api.defaultEnvironment,
1436896
+ environments: api.environments,
1436897
+ headers: api.headers
1436898
+ };
1436852
1436899
  return {
1436853
- [DEFAULT_API_NAME]: { specs }
1436900
+ [DEFAULT_API_NAME]: apiDefinition
1436854
1436901
  };
1436855
1436902
  }
1436856
1436903
  async convertApis({ absoluteFernYmlPath, apis, sourcedApis }) {
@@ -1436868,7 +1436915,15 @@ var ApiDefinitionConverter = class {
1436868
1436915
  specs: apiDef.specs,
1436869
1436916
  sourced: sourcedApiDef.specs
1436870
1436917
  });
1436871
- result[apiName] = { specs };
1436918
+ result[apiName] = {
1436919
+ specs,
1436920
+ auth: apiDef.auth,
1436921
+ authSchemes: apiDef.authSchemes,
1436922
+ defaultUrl: apiDef.defaultUrl,
1436923
+ defaultEnvironment: apiDef.defaultEnvironment,
1436924
+ environments: apiDef.environments,
1436925
+ headers: apiDef.headers
1436926
+ };
1436872
1436927
  }
1436873
1436928
  return result;
1436874
1436929
  }
@@ -1437971,7 +1438026,7 @@ __export(serialization_exports2, {
1437971
1438026
  EnumSchema: () => EnumSchema,
1437972
1438027
  EnumValue: () => EnumValue,
1437973
1438028
  EnumValueSchema: () => EnumValueSchema,
1437974
- EnvironmentSchema: () => EnvironmentSchema,
1438029
+ EnvironmentSchema: () => EnvironmentSchema2,
1437975
1438030
  ErrorDeclarationSchema: () => ErrorDeclarationSchema,
1437976
1438031
  ErrorDiscriminationSchema: () => ErrorDiscriminationSchema,
1437977
1438032
  ExampleBodyResponseSchema: () => ExampleBodyResponseSchema,
@@ -1438021,7 +1438076,7 @@ __export(serialization_exports2, {
1438021
1438076
  InferredGetTokenEndpointSchemaObject: () => InferredGetTokenEndpointSchemaObject,
1438022
1438077
  ListValidationSchema: () => ListValidationSchema,
1438023
1438078
  MapValidationSchema: () => MapValidationSchema,
1438024
- MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema,
1438079
+ MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema2,
1438025
1438080
  Navigation: () => Navigation,
1438026
1438081
  NumberValidationSchema: () => NumberValidationSchema,
1438027
1438082
  OAuthAccessTokenRequestPropertiesSchema: () => OAuthAccessTokenRequestPropertiesSchema,
@@ -1438057,7 +1438112,7 @@ __export(serialization_exports2, {
1438057
1438112
  RetriesDisabledSchema: () => RetriesDisabledSchema,
1438058
1438113
  RootApiFileSchema: () => RootApiFileSchema,
1438059
1438114
  ServiceTransport: () => ServiceTransport,
1438060
- SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema,
1438115
+ SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema2,
1438061
1438116
  SingleUndiscriminatedUnionTypeDetailedSchema: () => SingleUndiscriminatedUnionTypeDetailedSchema,
1438062
1438117
  SingleUndiscriminatedUnionTypeSchema: () => SingleUndiscriminatedUnionTypeSchema,
1438063
1438118
  SingleUnionTypeDetailedSchema: () => SingleUnionTypeDetailedSchema,
@@ -1439817,34 +1439872,34 @@ var EncodingSchema = schemas_exports5.object({
1439817
1439872
  // ../fern-definition/schema/lib/schemas/serialization/resources/environments/index.js
1439818
1439873
  var environments_exports3 = {};
1439819
1439874
  __export(environments_exports3, {
1439820
- EnvironmentSchema: () => EnvironmentSchema,
1439821
- MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema,
1439822
- SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema,
1439875
+ EnvironmentSchema: () => EnvironmentSchema2,
1439876
+ MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema2,
1439877
+ SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema2,
1439823
1439878
  WithEnvironmentsSchema: () => WithEnvironmentsSchema
1439824
1439879
  });
1439825
1439880
 
1439826
1439881
  // ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/MultipleBaseUrlsEnvironmentSchema.js
1439827
- var MultipleBaseUrlsEnvironmentSchema = schemas_exports5.object({
1439882
+ var MultipleBaseUrlsEnvironmentSchema2 = schemas_exports5.object({
1439828
1439883
  urls: schemas_exports5.record(schemas_exports5.string(), schemas_exports5.string())
1439829
1439884
  }).extend(WithAudiences).extend(WithDocsSchema);
1439830
1439885
 
1439831
1439886
  // ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/SingleBaseUrlEnvironmentSchema.js
1439832
- var SingleBaseUrlEnvironmentSchema = schemas_exports5.object({
1439887
+ var SingleBaseUrlEnvironmentSchema2 = schemas_exports5.object({
1439833
1439888
  url: schemas_exports5.string()
1439834
1439889
  }).extend(WithAudiences).extend(WithDocsSchema);
1439835
1439890
 
1439836
1439891
  // ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/EnvironmentSchema.js
1439837
- var EnvironmentSchema = schemas_exports5.undiscriminatedUnion([
1439892
+ var EnvironmentSchema2 = schemas_exports5.undiscriminatedUnion([
1439838
1439893
  schemas_exports5.string(),
1439839
- SingleBaseUrlEnvironmentSchema,
1439840
- MultipleBaseUrlsEnvironmentSchema
1439894
+ SingleBaseUrlEnvironmentSchema2,
1439895
+ MultipleBaseUrlsEnvironmentSchema2
1439841
1439896
  ]);
1439842
1439897
 
1439843
1439898
  // ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/WithEnvironmentsSchema.js
1439844
1439899
  var WithEnvironmentsSchema = schemas_exports5.object({
1439845
1439900
  "default-url": schemas_exports5.string().optional(),
1439846
1439901
  "default-environment": schemas_exports5.string().optional(),
1439847
- environments: schemas_exports5.record(schemas_exports5.string(), EnvironmentSchema).optional()
1439902
+ environments: schemas_exports5.record(schemas_exports5.string(), EnvironmentSchema2).optional()
1439848
1439903
  });
1439849
1439904
 
1439850
1439905
  // ../fern-definition/schema/lib/schemas/serialization/resources/errors/index.js
@@ -1469780,7 +1469835,7 @@ __export(fernDefinition_exports2, {
1469780
1469835
  EncodingSchema: () => EncodingSchema2,
1469781
1469836
  EndpointSecuritySchema: () => EndpointSecuritySchema2,
1469782
1469837
  EndpointSecuritySchemaDetails: () => EndpointSecuritySchemaDetails2,
1469783
- EnvironmentSchema: () => EnvironmentSchema2,
1469838
+ EnvironmentSchema: () => EnvironmentSchema3,
1469784
1469839
  HeaderAuthSchemeSchema: () => HeaderAuthSchemeSchema2,
1469785
1469840
  HttpHeaderSchema: () => HttpHeaderSchema2,
1469786
1469841
  InferredAuthenticatedRequestHeader: () => InferredAuthenticatedRequestHeader3,
@@ -1469789,7 +1469844,7 @@ __export(fernDefinition_exports2, {
1469789
1469844
  InferredGetTokenEndpointSchemaObject: () => InferredGetTokenEndpointSchemaObject2,
1469790
1469845
  ListValidationSchema: () => ListValidationSchema2,
1469791
1469846
  MapValidationSchema: () => MapValidationSchema2,
1469792
- MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema2,
1469847
+ MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema3,
1469793
1469848
  NumberValidationSchema: () => NumberValidationSchema2,
1469794
1469849
  OAuthAccessTokenRequestPropertiesSchema: () => OAuthAccessTokenRequestPropertiesSchema2,
1469795
1469850
  OAuthAccessTokenResponsePropertiesSchema: () => OAuthAccessTokenResponsePropertiesSchema2,
@@ -1469799,7 +1469854,7 @@ __export(fernDefinition_exports2, {
1469799
1469854
  OAuthRefreshTokenResponsePropertiesSchema: () => OAuthRefreshTokenResponsePropertiesSchema2,
1469800
1469855
  OAuthSchemeSchema: () => OAuthSchemeSchema2,
1469801
1469856
  ProtobufTypeSchema: () => ProtobufTypeSchema2,
1469802
- SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema2,
1469857
+ SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema3,
1469803
1469858
  StringValidationSchema: () => StringValidationSchema2,
1469804
1469859
  TokenBearerAuthSchema: () => TokenBearerAuthSchema2,
1469805
1469860
  TypeReferenceDeclarationWithEnvOverride: () => TypeReferenceDeclarationWithEnvOverride2,
@@ -1470072,34 +1470127,34 @@ var EncodingSchema2 = schemas_exports10.object({
1470072
1470127
  // ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/index.js
1470073
1470128
  var environments_exports5 = {};
1470074
1470129
  __export(environments_exports5, {
1470075
- EnvironmentSchema: () => EnvironmentSchema2,
1470076
- MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema2,
1470077
- SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema2,
1470130
+ EnvironmentSchema: () => EnvironmentSchema3,
1470131
+ MultipleBaseUrlsEnvironmentSchema: () => MultipleBaseUrlsEnvironmentSchema3,
1470132
+ SingleBaseUrlEnvironmentSchema: () => SingleBaseUrlEnvironmentSchema3,
1470078
1470133
  WithEnvironmentsSchema: () => WithEnvironmentsSchema2
1470079
1470134
  });
1470080
1470135
 
1470081
1470136
  // ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/MultipleBaseUrlsEnvironmentSchema.js
1470082
- var MultipleBaseUrlsEnvironmentSchema2 = schemas_exports10.object({
1470137
+ var MultipleBaseUrlsEnvironmentSchema3 = schemas_exports10.object({
1470083
1470138
  urls: schemas_exports10.record(schemas_exports10.string(), schemas_exports10.string())
1470084
1470139
  }).extend(WithAudiences2).extend(WithDocsSchema2);
1470085
1470140
 
1470086
1470141
  // ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/SingleBaseUrlEnvironmentSchema.js
1470087
- var SingleBaseUrlEnvironmentSchema2 = schemas_exports10.object({
1470142
+ var SingleBaseUrlEnvironmentSchema3 = schemas_exports10.object({
1470088
1470143
  url: schemas_exports10.string()
1470089
1470144
  }).extend(WithAudiences2).extend(WithDocsSchema2);
1470090
1470145
 
1470091
1470146
  // ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/EnvironmentSchema.js
1470092
- var EnvironmentSchema2 = schemas_exports10.undiscriminatedUnion([
1470147
+ var EnvironmentSchema3 = schemas_exports10.undiscriminatedUnion([
1470093
1470148
  schemas_exports10.string(),
1470094
- SingleBaseUrlEnvironmentSchema2,
1470095
- MultipleBaseUrlsEnvironmentSchema2
1470149
+ SingleBaseUrlEnvironmentSchema3,
1470150
+ MultipleBaseUrlsEnvironmentSchema3
1470096
1470151
  ]);
1470097
1470152
 
1470098
1470153
  // ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/WithEnvironmentsSchema.js
1470099
1470154
  var WithEnvironmentsSchema2 = schemas_exports10.object({
1470100
1470155
  "default-url": schemas_exports10.string().optional(),
1470101
1470156
  "default-environment": schemas_exports10.string().optional(),
1470102
- environments: schemas_exports10.record(schemas_exports10.string(), EnvironmentSchema2).optional()
1470157
+ environments: schemas_exports10.record(schemas_exports10.string(), EnvironmentSchema3).optional()
1470103
1470158
  });
1470104
1470159
 
1470105
1470160
  // ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/file/index.js
@@ -1671629,7 +1671684,7 @@ var LegacyFernWorkspaceAdapter = class {
1671629
1671684
  * Supports three mutually exclusive modes:
1671630
1671685
  * - Fern definition: Uses LazyFernWorkspace
1671631
1671686
  * - Conjure definition: Uses ConjureWorkspace
1671632
- * - OpenAPI/AsyncAPI/Protobuf: Uses OSSWorkspace (can be mixed together)
1671687
+ * - OpenAPI/AsyncAPI/Protobuf/OpenRPC: Uses OSSWorkspace (can be mixed together)
1671633
1671688
  *
1671634
1671689
  * Note: Spec combination validation is performed earlier in ApiDefinitionConverter.
1671635
1671690
  */
@@ -1671642,7 +1671697,7 @@ var LegacyFernWorkspaceAdapter = class {
1671642
1671697
  if (conjureSpec != null) {
1671643
1671698
  return this.adaptConjureSpec(conjureSpec);
1671644
1671699
  }
1671645
- return this.adaptOssSpecs(definition3.specs);
1671700
+ return this.adaptOssSpecs(definition3);
1671646
1671701
  }
1671647
1671702
  async adaptFernSpec(spec) {
1671648
1671703
  const workspaceRoot = dirname4(spec.fern);
@@ -1671668,8 +1671723,8 @@ var LegacyFernWorkspaceAdapter = class {
1671668
1671723
  });
1671669
1671724
  return conjureWorkspace.toFernWorkspace({ context: this.taskContext });
1671670
1671725
  }
1671671
- async adaptOssSpecs(specs) {
1671672
- const ossSpecs = specs.filter((spec) => !isFernSpec(spec) && !isConjureSpec(spec));
1671726
+ async adaptOssSpecs(definition3) {
1671727
+ const ossSpecs = definition3.specs.filter((spec) => !isFernSpec(spec) && !isConjureSpec(spec));
1671673
1671728
  const specAdapter = new LegacyApiSpecAdapter({ context: this.context });
1671674
1671729
  const v1Specs = specAdapter.convertAll(ossSpecs);
1671675
1671730
  const filteredSpecs = v1Specs.filter((spec) => {
@@ -1671687,17 +1671742,46 @@ var LegacyFernWorkspaceAdapter = class {
1671687
1671742
  }
1671688
1671743
  return true;
1671689
1671744
  });
1671745
+ const apiConfig = this.buildApiConfiguration(definition3);
1671690
1671746
  const ossWorkspace = new OSSWorkspace({
1671691
1671747
  specs: filteredSpecs,
1671692
1671748
  allSpecs,
1671693
1671749
  absoluteFilePath: this.context.cwd,
1671694
1671750
  cliVersion: this.cliVersion,
1671751
+ generatorsConfiguration: apiConfig != null ? this.buildGeneratorsConfiguration(apiConfig) : void 0,
1671695
1671752
  workspaceName: void 0,
1671696
- generatorsConfiguration: void 0,
1671697
1671753
  changelog: void 0
1671698
1671754
  });
1671699
1671755
  return ossWorkspace.toFernWorkspace({ context: this.taskContext });
1671700
1671756
  }
1671757
+ buildApiConfiguration(definition3) {
1671758
+ if (definition3.auth == null && definition3.authSchemes == null && definition3.environments == null && definition3.headers == null && definition3.defaultUrl == null && definition3.defaultEnvironment == null) {
1671759
+ return void 0;
1671760
+ }
1671761
+ return {
1671762
+ type: "singleNamespace",
1671763
+ definitions: [],
1671764
+ auth: definition3.auth,
1671765
+ "auth-schemes": definition3.authSchemes,
1671766
+ "default-url": definition3.defaultUrl,
1671767
+ "default-environment": definition3.defaultEnvironment,
1671768
+ environments: definition3.environments,
1671769
+ headers: definition3.headers
1671770
+ };
1671771
+ }
1671772
+ buildGeneratorsConfiguration(apiConfig) {
1671773
+ return {
1671774
+ absolutePathToConfiguration: AbsoluteFilePath2.of(this.context.cwd),
1671775
+ api: apiConfig,
1671776
+ defaultGroup: void 0,
1671777
+ groupAliases: {},
1671778
+ reviewers: void 0,
1671779
+ groups: [],
1671780
+ whitelabel: void 0,
1671781
+ ai: void 0,
1671782
+ rawConfiguration: {}
1671783
+ };
1671784
+ }
1671701
1671785
  };
1671702
1671786
 
1671703
1671787
  // ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
@@ -1678768,7 +1678852,7 @@ var AccessTokenPosthogManager = class {
1678768
1678852
  properties: {
1678769
1678853
  ...event,
1678770
1678854
  ...event.properties,
1678771
- version: "3.58.0",
1678855
+ version: "3.59.0",
1678772
1678856
  usingAccessToken: true
1678773
1678857
  }
1678774
1678858
  });
@@ -1678818,7 +1678902,7 @@ var UserPosthogManager = class {
1678818
1678902
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1678819
1678903
  event: "CLI",
1678820
1678904
  properties: {
1678821
- version: "3.58.0",
1678905
+ version: "3.59.0",
1678822
1678906
  ...event,
1678823
1678907
  ...event.properties,
1678824
1678908
  usingAccessToken: false,
@@ -1710740,7 +1710824,7 @@ var CliContext = class {
1710740
1710824
  if (false) {
1710741
1710825
  this.logger.error("CLI_VERSION is not defined");
1710742
1710826
  }
1710743
- return "3.58.0";
1710827
+ return "3.59.0";
1710744
1710828
  }
1710745
1710829
  getCliName() {
1710746
1710830
  if (false) {
@@ -1713854,7 +1713938,7 @@ var import_path56 = __toESM(require("path"), 1);
1713854
1713938
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
1713855
1713939
  var LOGS_FOLDER_NAME = "logs";
1713856
1713940
  function getCliSource() {
1713857
- const version7 = "3.58.0";
1713941
+ const version7 = "3.59.0";
1713858
1713942
  return `cli@${version7}`;
1713859
1713943
  }
1713860
1713944
  var DebugLogger = class {
@@ -1741299,7 +1741383,7 @@ async function runCli() {
1741299
1741383
  await exit3();
1741300
1741384
  }
1741301
1741385
  async function tryRunCli(cliContext) {
1741302
- const cli = yargs_default2(hideBin(process.argv)).scriptName(cliContext.environment.cliName).version(false).fail((message, error49, argv) => {
1741386
+ const cli = yargs_default2(hideBin(process.argv)).scriptName(cliContext.environment.cliName).version(false).completion("completion", "Generate shell completion script").fail((message, error49, argv) => {
1741303
1741387
  if (error49 == null) {
1741304
1741388
  argv.showHelp();
1741305
1741389
  cliContext.logger.error(message);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.58.0",
2
+ "version": "3.59.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",