@fern-api/fern-api-dev 5.113.2 → 5.114.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 +99 -37
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -131246,7 +131246,8 @@ var init_OpenApiSettingsSchema2 = __esm({
131246
131246
  "disambiguate-request-names": schemas_exports8.boolean().optional(),
131247
131247
  "ignore-tags": schemas_exports8.boolean().optional(),
131248
131248
  "respect-parameter-content": schemas_exports8.boolean().optional(),
131249
- "respect-per-spec-base-path": schemas_exports8.boolean().optional()
131249
+ "respect-per-spec-base-path": schemas_exports8.boolean().optional(),
131250
+ "namespaced-errors": schemas_exports8.boolean().optional()
131250
131251
  }).extend(BaseApiSettingsSchema);
131251
131252
  }
131252
131253
  });
@@ -132773,7 +132774,8 @@ var init_ConvertOpenAPIOptions = __esm({
132773
132774
  groupEnvironmentsByHost: false,
132774
132775
  multiServerStrategy: generators_yml_exports.MultiServerStrategy.EnvironmentPerServer,
132775
132776
  removeDiscriminantsFromSchemas: generators_yml_exports.RemoveDiscriminantsFromSchemas.Always,
132776
- inferDefaultEnvironment: true
132777
+ inferDefaultEnvironment: true,
132778
+ namespacedErrors: false
132777
132779
  };
132778
132780
  }
132779
132781
  });
@@ -139927,7 +139929,8 @@ var init_HttpError2 = __esm({
139927
139929
  init_ErrorExample2();
139928
139930
  HttpError = schemas_exports9.objectWithoutOptionalProperties({
139929
139931
  schema: schemas_exports9.lazy(() => Schema2).optional(),
139930
- examples: schemas_exports9.list(ErrorExample).optional()
139932
+ examples: schemas_exports9.list(ErrorExample).optional(),
139933
+ namespace: schemas_exports9.string().optional()
139931
139934
  }).extend(WithDescription).extend(WithName3).extend(WithSource);
139932
139935
  }
139933
139936
  });
@@ -141767,7 +141770,8 @@ var init_HttpErrorWithExample2 = __esm({
141767
141770
  HttpErrorWithExample = schemas_exports9.objectWithoutOptionalProperties({
141768
141771
  statusCode: StatusCode,
141769
141772
  schema: schemas_exports9.lazy(() => SchemaWithExample2),
141770
- fullExamples: schemas_exports9.list(NamedFullExample).optional()
141773
+ fullExamples: schemas_exports9.list(NamedFullExample).optional(),
141774
+ namespace: schemas_exports9.string().optional()
141771
141775
  }).extend(WithDescription).extend(WithName3).extend(WithSource);
141772
141776
  }
141773
141777
  });
@@ -143067,18 +143071,16 @@ function isOneOfEqual(a3, b5) {
143067
143071
  return false;
143068
143072
  }
143069
143073
  function isObjectEqual(a3, b5) {
143070
- if (Object.keys(a3.properties).length !== Object.keys(b5.properties).length) {
143074
+ if (a3.properties.length !== b5.properties.length) {
143071
143075
  return false;
143072
143076
  }
143073
- const aPropertyMap = Object.fromEntries(a3.properties.map((property24) => {
143074
- return [property24.key, property24.schema];
143075
- }));
143076
- return Object.entries(b5.properties).every(([bPropertyName, bPropertySchema]) => {
143077
- const aProperty = aPropertyMap[bPropertyName];
143078
- if (aProperty == null) {
143077
+ const aPropertyMap = new Map(a3.properties.map((property24) => [property24.key, property24.schema]));
143078
+ return b5.properties.every((bProperty) => {
143079
+ const aPropertySchema = aPropertyMap.get(bProperty.key);
143080
+ if (aPropertySchema == null) {
143079
143081
  return false;
143080
143082
  }
143081
- return isSchemaEqual(aProperty, bPropertySchema.schema);
143083
+ return isSchemaEqual(aPropertySchema, bProperty.schema);
143082
143084
  });
143083
143085
  }
143084
143086
  var init_isSchemaEqual = __esm({
@@ -145655,6 +145657,38 @@ function getNamespaceFromGroup(groupName) {
145655
145657
  function getEndpointNamespace(sdkName, namespaceOverride) {
145656
145658
  return namespaceOverride != null ? namespaceOverride : sdkName?.groupName != null ? getNamespaceFromGroup(sdkName.groupName) : void 0;
145657
145659
  }
145660
+ function getErrorNamespace({ endpointNamespace, error: error50, namespacedErrors }) {
145661
+ if (namespacedErrors) {
145662
+ if (error50.namespace != null) {
145663
+ return error50.namespace;
145664
+ }
145665
+ const referenced = unwrapReferencedSchema(error50.schema);
145666
+ if (referenced?.namespace != null) {
145667
+ return referenced.namespace;
145668
+ }
145669
+ }
145670
+ return endpointNamespace;
145671
+ }
145672
+ function getErrorConflictNamespace({ endpointNamespace, error: error50, namespacedErrors }) {
145673
+ if (!namespacedErrors) {
145674
+ return void 0;
145675
+ }
145676
+ return getErrorNamespace({ endpointNamespace, error: error50, namespacedErrors });
145677
+ }
145678
+ function unwrapReferencedSchema(schema) {
145679
+ if (schema == null) {
145680
+ return void 0;
145681
+ }
145682
+ switch (schema.type) {
145683
+ case "reference":
145684
+ return schema;
145685
+ case "nullable":
145686
+ case "optional":
145687
+ return unwrapReferencedSchema(schema.value);
145688
+ default:
145689
+ return void 0;
145690
+ }
145691
+ }
145658
145692
  var init_getNamespaceFromGroup = __esm({
145659
145693
  "../api-importers/openapi/openapi-ir-to-fern/lib/utils/getNamespaceFromGroup.js"() {
145660
145694
  "use strict";
@@ -147362,9 +147396,14 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
147362
147396
  const errorDeclaration = {
147363
147397
  "status-code": parseInt(statusCode)
147364
147398
  };
147399
+ const errorNamespace = getErrorNamespace({
147400
+ endpointNamespace: maybeEndpointNamespace,
147401
+ error: httpError,
147402
+ namespacedErrors: context3.options.namespacedErrors
147403
+ });
147365
147404
  const errorDeclarationFile = resolveLocationWithNamespace({
147366
147405
  location: ERROR_DECLARATIONS_FILENAME,
147367
- namespaceOverride: maybeEndpointNamespace
147406
+ namespaceOverride: errorNamespace
147368
147407
  });
147369
147408
  if (httpError.schema != null) {
147370
147409
  const typeReference2 = buildTypeReference({
@@ -147372,7 +147411,7 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
147372
147411
  context: context3,
147373
147412
  fileContainingReference: errorDeclarationFile,
147374
147413
  declarationFile: errorDeclarationFile,
147375
- namespace: maybeEndpointNamespace,
147414
+ namespace: errorNamespace,
147376
147415
  declarationDepth: 0
147377
147416
  });
147378
147417
  errorDeclaration.type = getTypeFromTypeReference(typeReference2);
@@ -147382,7 +147421,11 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
147382
147421
  name: errorName,
147383
147422
  schema: context3.isErrorUnknownSchema({
147384
147423
  statusCode: parseInt(statusCode),
147385
- namespace: maybeEndpointNamespace
147424
+ namespace: getErrorConflictNamespace({
147425
+ endpointNamespace: maybeEndpointNamespace,
147426
+ error: httpError,
147427
+ namespacedErrors: context3.options.namespacedErrors
147428
+ })
147386
147429
  }) ? { ...errorDeclaration, type: "unknown" } : errorDeclaration
147387
147430
  });
147388
147431
  if (convertedEndpoint.errors == null) {
@@ -147847,7 +147890,7 @@ function sanitizeEndpointId(operationId) {
147847
147890
  }
147848
147891
  function getUnresolvedEndpointLocation(endpoint3) {
147849
147892
  const namespace = endpoint3.namespace;
147850
- const tag2 = endpoint3.tags.filter((tag3) => !isNamespaceTag(tag3, namespace))[0];
147893
+ const tag2 = endpoint3.tags.filter((tag3) => tag3 !== namespace)[0];
147851
147894
  const operationId = endpoint3.operationId;
147852
147895
  if (operationId == null) {
147853
147896
  if (tag2 != null) {
@@ -147916,9 +147959,6 @@ function getUnresolvedEndpointLocation(endpoint3) {
147916
147959
  tag: tag2
147917
147960
  };
147918
147961
  }
147919
- function isNamespaceTag(tag2, namespace) {
147920
- return namespace != null && tag2.toLowerCase() === namespace.toLowerCase();
147921
- }
147922
147962
  function getEndpointLocation(endpoint3) {
147923
147963
  const tag2 = endpoint3.tags[0];
147924
147964
  if (endpoint3.sdkName != null) {
@@ -149392,9 +149432,15 @@ var init_OpenApiIrConverterContext = __esm({
149392
149432
  const schemaByErrorKey = {};
149393
149433
  if (!this.enableUniqueErrorsPerEndpoint) {
149394
149434
  for (const endpoint3 of ir3.endpoints) {
149395
- const namespace = getEndpointNamespace(endpoint3.sdkName, endpoint3.namespace);
149435
+ const endpointNamespace = getEndpointNamespace(endpoint3.sdkName, endpoint3.namespace);
149396
149436
  for (const [statusCodeString, error50] of Object.entries(endpoint3.errors)) {
149397
- const key2 = getErrorKey({ statusCode: parseInt(statusCodeString), namespace });
149437
+ const statusCode = parseInt(statusCodeString);
149438
+ const namespace = getErrorConflictNamespace({
149439
+ endpointNamespace,
149440
+ error: error50,
149441
+ namespacedErrors: this.options.namespacedErrors
149442
+ });
149443
+ const key2 = getErrorKey({ statusCode, namespace });
149398
149444
  const existingSchema = schemaByErrorKey[key2];
149399
149445
  if (existingSchema == null && error50.schema != null) {
149400
149446
  schemaByErrorKey[key2] = error50.schema;
@@ -149443,8 +149489,7 @@ var init_OpenApiIrConverterContext = __esm({
149443
149489
  return this.urlIdMap.get(serverUrl);
149444
149490
  }
149445
149491
  /**
149446
- * Is error an unknown schema. Errors are shared per status code within a namespace,
149447
- * so a schema mismatch in one namespace does not affect errors in another.
149492
+ * Is error an unknown schema
149448
149493
  */
149449
149494
  isErrorUnknownSchema({ statusCode, namespace }) {
149450
149495
  return this.unknownSchema.has(getErrorKey({ statusCode, namespace }));
@@ -152181,6 +152226,7 @@ var init_BaseOpenAPIWorkspace = __esm({
152181
152226
  defaultIntegerFormat;
152182
152227
  pathParameterOrder;
152183
152228
  coerceConstsTo;
152229
+ namespacedErrors;
152184
152230
  converter;
152185
152231
  constructor(args) {
152186
152232
  super(args);
@@ -152206,6 +152252,7 @@ var init_BaseOpenAPIWorkspace = __esm({
152206
152252
  this.defaultIntegerFormat = args.defaultIntegerFormat;
152207
152253
  this.pathParameterOrder = args.pathParameterOrder;
152208
152254
  this.coerceConstsTo = args.coerceConstsTo;
152255
+ this.namespacedErrors = args.namespacedErrors;
152209
152256
  this.converter = new FernDefinitionConverter(args);
152210
152257
  }
152211
152258
  async getDefinition({ context: context3, absoluteFilePath, relativePathToDependency }, settings) {
@@ -167072,13 +167119,15 @@ function markErrorSchemas({ responses, context: context3, source: source2, names
167072
167119
  context3.logger.warn(`No error name found for status code ${statusCode}`);
167073
167120
  continue;
167074
167121
  }
167122
+ const responseNamespace = getExtension(resolvedResponse, FernOpenAPIExtension.SDK_NAMESPACE);
167075
167123
  errors4[parsedStatusCode] = {
167076
167124
  statusCode: parsedStatusCode,
167077
167125
  nameOverride: void 0,
167078
167126
  generatedName: errorName,
167079
167127
  description: resolvedResponse.description,
167080
- schema: convertSchema2(mediaObject?.schema ?? {}, false, false, context3, [errorName, "Body"], source2, namespace),
167128
+ schema: convertSchema2(mediaObject?.schema ?? {}, false, false, context3, [errorName, "Body"], source2, responseNamespace ?? namespace),
167081
167129
  fullExamples: mediaObject?.examples,
167130
+ namespace: responseNamespace,
167082
167131
  source: source2
167083
167132
  };
167084
167133
  }
@@ -169160,7 +169209,8 @@ function generateIr({ openApi, taskContext, options: options2, source: source2,
169160
169209
  schema: convertSchemaWithExampleToSchema(error50.schema),
169161
169210
  description: error50.description,
169162
169211
  source: error50.source,
169163
- examples: examples2
169212
+ examples: examples2,
169213
+ namespace: error50.namespace
169164
169214
  };
169165
169215
  }),
169166
169216
  retries: endpointWithExample.retries,
@@ -200355,7 +200405,8 @@ var init_getAPIDefinitionSettings = __esm({
200355
200405
  disambiguateRequestNames: "disambiguateRequestNames",
200356
200406
  ignoreTags: "ignoreTags",
200357
200407
  respectParameterContent: "respectParameterContent",
200358
- respectPerSpecBasePath: "respectPerSpecBasePath"
200408
+ respectPerSpecBasePath: "respectPerSpecBasePath",
200409
+ namespacedErrors: "namespacedErrors"
200359
200410
  };
200360
200411
  }
200361
200412
  });
@@ -264978,7 +265029,8 @@ function parseOpenApiDefinitionSettingsSchema(settings) {
264978
265029
  disambiguateRequestNames: settings?.["disambiguate-request-names"],
264979
265030
  ignoreTags: settings?.["ignore-tags"],
264980
265031
  respectParameterContent: settings?.["respect-parameter-content"],
264981
- respectPerSpecBasePath: settings?.["respect-per-spec-base-path"]
265032
+ respectPerSpecBasePath: settings?.["respect-per-spec-base-path"],
265033
+ namespacedErrors: settings?.["namespaced-errors"]
264982
265034
  };
264983
265035
  }
264984
265036
  function parseAsyncApiDefinitionSettingsSchema(settings) {
@@ -265848,7 +265900,8 @@ var init_convertGeneratorsConfiguration = __esm({
265848
265900
  disambiguateRequestNames: void 0,
265849
265901
  ignoreTags: void 0,
265850
265902
  respectParameterContent: void 0,
265851
- respectPerSpecBasePath: void 0
265903
+ respectPerSpecBasePath: void 0,
265904
+ namespacedErrors: void 0
265852
265905
  };
265853
265906
  }
265854
265907
  });
@@ -374369,7 +374422,8 @@ var init_OSSWorkspace = __esm({
374369
374422
  inferDefaultEnvironment: collapseSpecBooleanSetting(specs, (s5) => s5?.inferDefaultEnvironment),
374370
374423
  defaultIntegerFormat: specs[0]?.settings?.defaultIntegerFormat,
374371
374424
  pathParameterOrder: specs[0]?.settings?.pathParameterOrder,
374372
- coerceConstsTo: specs[0]?.settings?.coerceConstsTo
374425
+ coerceConstsTo: specs[0]?.settings?.coerceConstsTo,
374426
+ namespacedErrors: specs.some((spec) => spec.settings?.namespacedErrors)
374373
374427
  });
374374
374428
  this.specs = specs;
374375
374429
  this.allSpecs = allSpecs;
@@ -696957,7 +697011,13 @@ var OpenApiSettingsSchema2 = BaseApiSettingsSchema2.extend({
696957
697011
  * If true, apply each OpenAPI document's plain `x-fern-base-path` to that document's endpoints.
696958
697012
  * Defaults to false.
696959
697013
  */
696960
- "respect-per-spec-base-path": external_exports.boolean().optional()
697014
+ "respect-per-spec-base-path": external_exports.boolean().optional(),
697015
+ /**
697016
+ * If true, an error whose body schema carries `x-fern-sdk-namespace` is declared in, and shared
697017
+ * within, that namespace instead of the endpoint's namespace.
697018
+ * Defaults to false.
697019
+ */
697020
+ "namespaced-errors": external_exports.boolean().optional()
696961
697021
  });
696962
697022
 
696963
697023
  // ../config/lib/schemas/specs/OpenApiSpecSchema.js
@@ -705548,7 +705608,7 @@ var AccessTokenPosthogManager = class {
705548
705608
  properties: {
705549
705609
  ...event,
705550
705610
  ...event.properties,
705551
- version: "5.113.2",
705611
+ version: "5.114.0",
705552
705612
  usingAccessToken: true,
705553
705613
  ...getRunIdProperties()
705554
705614
  }
@@ -705614,7 +705674,7 @@ var UserPosthogManager = class {
705614
705674
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
705615
705675
  event: "CLI",
705616
705676
  properties: {
705617
- version: "5.113.2",
705677
+ version: "5.114.0",
705618
705678
  ...event,
705619
705679
  ...event.properties,
705620
705680
  usingAccessToken: false,
@@ -712433,7 +712493,8 @@ var LegacyApiSpecAdapter = class {
712433
712493
  disambiguateRequestNames: settings["disambiguate-request-names"],
712434
712494
  ignoreTags: settings["ignore-tags"],
712435
712495
  respectParameterContent: settings["respect-parameter-content"],
712436
- respectPerSpecBasePath: settings["respect-per-spec-base-path"]
712496
+ respectPerSpecBasePath: settings["respect-per-spec-base-path"],
712497
+ namespacedErrors: settings["namespaced-errors"]
712437
712498
  };
712438
712499
  const hasSettings = Object.values(result).some((v3) => v3 != null);
712439
712500
  return hasSettings ? result : void 0;
@@ -885370,6 +885431,7 @@ var SETTINGS_KEY_MAP = {
885370
885431
  "prefer-undiscriminated-unions-with-literals": "preferUndiscriminatedUnionsWithLiterals",
885371
885432
  "object-query-parameters": "objectQueryParameters",
885372
885433
  "respect-readonly-schemas": "respectReadonlySchemas",
885434
+ "namespaced-errors": "namespacedErrors",
885373
885435
  "use-read-variant-for-responses": "useReadVariantForResponses",
885374
885436
  "respect-forward-compatible-enums": "respectForwardCompatibleEnums",
885375
885437
  "respect-optional-request-body": "respectOptionalRequestBody",
@@ -887290,7 +887352,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
887290
887352
  var LOGS_FOLDER_NAME = "logs";
887291
887353
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
887292
887354
  function getCliSource() {
887293
- const version7 = "5.113.2";
887355
+ const version7 = "5.114.0";
887294
887356
  return `cli@${version7}`;
887295
887357
  }
887296
887358
  var DebugLogger = class {
@@ -914603,7 +914665,7 @@ var LegacyDocsPublisher = class {
914603
914665
  previewId,
914604
914666
  disableTemplates: void 0,
914605
914667
  skipUpload,
914606
- cliVersion: "5.113.2",
914668
+ cliVersion: "5.114.0",
914607
914669
  loginCommand: "fern auth login"
914608
914670
  });
914609
914671
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -981859,7 +981921,7 @@ function getAutomationContextFromEnv() {
981859
981921
  config_branch: process.env.FERN_CONFIG_BRANCH,
981860
981922
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
981861
981923
  trigger: process.env.GITHUB_EVENT_NAME,
981862
- cli_version: "5.113.2"
981924
+ cli_version: "5.114.0"
981863
981925
  };
981864
981926
  }
981865
981927
  function isAutomationMode() {
@@ -982691,7 +982753,7 @@ var CliContext = class _CliContext {
982691
982753
  if (false) {
982692
982754
  this.logger.error("CLI_VERSION is not defined");
982693
982755
  }
982694
- return "5.113.2";
982756
+ return "5.114.0";
982695
982757
  }
982696
982758
  getCliName() {
982697
982759
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.113.2",
2
+ "version": "5.114.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",