@fern-api/fern-api-dev 4.49.0 → 4.50.1

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 +141 -15
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -518167,11 +518167,105 @@ function convertAvailability2(propertySchema) {
518167
518167
  return void 0;
518168
518168
  }
518169
518169
 
518170
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/inferDiscriminatorContext.js
518171
+ var SSE_SPEC_FIELDS = /* @__PURE__ */ new Set(["event", "data", "id", "retry"]);
518172
+ function collectAllProperties(schema2, context3) {
518173
+ let allProperties = {
518174
+ ...schema2.properties ?? {}
518175
+ };
518176
+ for (const allOfElement of schema2.allOf ?? []) {
518177
+ if (isReferenceObject(allOfElement)) {
518178
+ const resolved = context3.resolveSchemaReference(allOfElement);
518179
+ const inheritedProperties = collectAllProperties(resolved, context3);
518180
+ allProperties = { ...inheritedProperties, ...allProperties };
518181
+ } else {
518182
+ const inheritedProperties = collectAllProperties(allOfElement, context3);
518183
+ allProperties = { ...inheritedProperties, ...allProperties };
518184
+ }
518185
+ }
518186
+ return allProperties;
518187
+ }
518188
+ function resolvePropertySchema(schema2, context3) {
518189
+ if (isReferenceObject(schema2)) {
518190
+ return context3.resolveSchemaReference(schema2);
518191
+ }
518192
+ return schema2;
518193
+ }
518194
+ function variantMatchesSseSpec(schema2, context3) {
518195
+ const allProperties = collectAllProperties(schema2, context3);
518196
+ const propertyEntries = Object.entries(allProperties);
518197
+ if (propertyEntries.length === 0) {
518198
+ return false;
518199
+ }
518200
+ let hasEvent = false;
518201
+ for (const [propName, propSchema] of propertyEntries) {
518202
+ if (!SSE_SPEC_FIELDS.has(propName)) {
518203
+ return false;
518204
+ }
518205
+ const resolved = resolvePropertySchema(propSchema, context3);
518206
+ switch (propName) {
518207
+ case "event":
518208
+ hasEvent = true;
518209
+ if (resolved.type !== "string") {
518210
+ return false;
518211
+ }
518212
+ break;
518213
+ case "id":
518214
+ if (resolved.type !== "string") {
518215
+ return false;
518216
+ }
518217
+ break;
518218
+ case "retry":
518219
+ if (resolved.type !== "integer") {
518220
+ return false;
518221
+ }
518222
+ break;
518223
+ case "data":
518224
+ break;
518225
+ }
518226
+ }
518227
+ return hasEvent;
518228
+ }
518229
+ function inferDiscriminatorContext({ discriminator, context: context3 }) {
518230
+ const mapping = discriminator.mapping;
518231
+ if (mapping == null || Object.keys(mapping).length === 0) {
518232
+ return "data";
518233
+ }
518234
+ for (const schema2 of Object.values(mapping)) {
518235
+ try {
518236
+ const resolved = context3.resolveSchemaReference({ $ref: schema2 });
518237
+ if (!variantMatchesSseSpec(resolved, context3)) {
518238
+ return "data";
518239
+ }
518240
+ } catch {
518241
+ return "data";
518242
+ }
518243
+ }
518244
+ return "protocol";
518245
+ }
518246
+ function inferDiscriminatorContextFromVariants({ variants, context: context3 }) {
518247
+ const variantEntries = Object.values(variants);
518248
+ if (variantEntries.length === 0) {
518249
+ return "data";
518250
+ }
518251
+ for (const variantSchema of variantEntries) {
518252
+ try {
518253
+ const resolved = isReferenceObject(variantSchema) ? context3.resolveSchemaReference(variantSchema) : variantSchema;
518254
+ if (!variantMatchesSseSpec(resolved, context3)) {
518255
+ return "data";
518256
+ }
518257
+ } catch {
518258
+ return "data";
518259
+ }
518260
+ }
518261
+ return "protocol";
518262
+ }
518263
+
518170
518264
  // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertDiscriminatedOneOf.js
518171
518265
  function convertDiscriminatedOneOf({ nameOverride, generatedName, title: title3, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminator, context: context3, namespace, groupName, encoding, source: source2 }) {
518172
518266
  const discriminant19 = discriminator.propertyName;
518173
518267
  const discriminantNameOverride = getExtension(discriminator, FernOpenAPIExtension.FERN_PROPERTY_NAME);
518174
- const discriminatorContext = getExtension(discriminator, FernOpenAPIExtension.DISCRIMINATOR_CONTEXT) ?? "data";
518268
+ const discriminatorContext = getExtension(discriminator, FernOpenAPIExtension.DISCRIMINATOR_CONTEXT) ?? inferDiscriminatorContext({ discriminator, context: context3 });
518175
518269
  const unionSubTypes = Object.fromEntries(Object.entries(discriminator.mapping ?? {}).map(([discriminantValue, schema2]) => {
518176
518270
  const subtypeReference = convertReferenceObject({
518177
518271
  $ref: schema2
@@ -518243,8 +518337,7 @@ function convertDiscriminatedOneOfWithVariants({ nameOverride, generatedName, ti
518243
518337
  availability,
518244
518338
  discriminant: discriminant19,
518245
518339
  discriminantNameOverride: void 0,
518246
- discriminatorContext: "data",
518247
- // variants don't have discriminator object, default to data
518340
+ discriminatorContext: inferDiscriminatorContextFromVariants({ variants, context: context3 }),
518248
518341
  subtypes: unionSubTypes,
518249
518342
  namespace,
518250
518343
  groupName,
@@ -519187,13 +519280,7 @@ function convertObject3({ nameOverride, generatedName, title: title3, breadcrumb
519187
519280
  });
519188
519281
  }
519189
519282
  }
519190
- const filteredPropertiesToConvert = Object.fromEntries(Object.entries(propertiesToConvert).filter(([_16, propertySchema]) => {
519191
- if (!isReferenceObject(propertySchema) && propertySchema.type === "null") {
519192
- return false;
519193
- }
519194
- return true;
519195
- }));
519196
- const convertedProperties = Object.entries(filteredPropertiesToConvert).map(([propertyName, propertySchema]) => {
519283
+ const convertedProperties = Object.entries(propertiesToConvert).map(([propertyName, propertySchema]) => {
519197
519284
  const audiences = getExtension(propertySchema, FernOpenAPIExtension.AUDIENCES) ?? [];
519198
519285
  const availability2 = convertAvailability2(propertySchema);
519199
519286
  const resolvedPropertySchema = isReferenceObject(propertySchema) ? context3.resolveSchemaReference(propertySchema) : propertySchema;
@@ -519783,6 +519870,9 @@ function isInlinable(schema2, context3) {
519783
519870
  case void 0:
519784
519871
  return false;
519785
519872
  default:
519873
+ if (resolvedSchema.type === "null") {
519874
+ return true;
519875
+ }
519786
519876
  context3.logger.warn("Unhandled schema type. Will not inline this schema", JSON.stringify(resolvedSchema));
519787
519877
  return false;
519788
519878
  }
@@ -520687,6 +520777,42 @@ function convertSchemaObject(schema2, wrapAsOptional, wrapAsNullable, context3,
520687
520777
  maxProperties: schema2.maxProperties
520688
520778
  });
520689
520779
  }
520780
+ if (schema2.type === "null") {
520781
+ let result2 = SchemaWithExample.nullable({
520782
+ availability,
520783
+ namespace,
520784
+ groupName,
520785
+ description,
520786
+ generatedName,
520787
+ inline: void 0,
520788
+ nameOverride,
520789
+ title: title3,
520790
+ value: SchemaWithExample.unknown({
520791
+ nameOverride,
520792
+ generatedName,
520793
+ title: title3,
520794
+ description: void 0,
520795
+ availability: void 0,
520796
+ namespace,
520797
+ groupName,
520798
+ example: void 0
520799
+ })
520800
+ });
520801
+ if (wrapAsOptional) {
520802
+ result2 = SchemaWithExample.optional({
520803
+ availability,
520804
+ namespace,
520805
+ groupName,
520806
+ description,
520807
+ generatedName,
520808
+ inline: void 0,
520809
+ nameOverride,
520810
+ title: title3,
520811
+ value: result2
520812
+ });
520813
+ }
520814
+ return result2;
520815
+ }
520690
520816
  if (schema2.type === "object" && hasNoOneOf(schema2) && hasNoAllOf(schema2) && hasNoProperties(schema2)) {
520691
520817
  return wrapMap({
520692
520818
  nameOverride,
@@ -602182,7 +602308,7 @@ var AccessTokenPosthogManager = class {
602182
602308
  properties: {
602183
602309
  ...event,
602184
602310
  ...event.properties,
602185
- version: "4.49.0",
602311
+ version: "4.50.1",
602186
602312
  usingAccessToken: true
602187
602313
  }
602188
602314
  });
@@ -602233,7 +602359,7 @@ var UserPosthogManager = class {
602233
602359
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
602234
602360
  event: "CLI",
602235
602361
  properties: {
602236
- version: "4.49.0",
602362
+ version: "4.50.1",
602237
602363
  ...event,
602238
602364
  ...event.properties,
602239
602365
  usingAccessToken: false,
@@ -826088,7 +826214,7 @@ var import_path54 = __toESM(require("path"), 1);
826088
826214
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
826089
826215
  var LOGS_FOLDER_NAME = "logs";
826090
826216
  function getCliSource() {
826091
- const version7 = "4.49.0";
826217
+ const version7 = "4.50.1";
826092
826218
  return `cli@${version7}`;
826093
826219
  }
826094
826220
  var DebugLogger = class {
@@ -837090,7 +837216,7 @@ var LegacyDocsPublisher = class {
837090
837216
  previewId: void 0,
837091
837217
  disableTemplates: void 0,
837092
837218
  skipUpload,
837093
- cliVersion: "4.49.0"
837219
+ cliVersion: "4.50.1"
837094
837220
  });
837095
837221
  if (taskContext.getResult() === TaskResult.Failure) {
837096
837222
  return { success: false };
@@ -910205,7 +910331,7 @@ var CliContext = class {
910205
910331
  if (false) {
910206
910332
  this.logger.error("CLI_VERSION is not defined");
910207
910333
  }
910208
- return "4.49.0";
910334
+ return "4.50.1";
910209
910335
  }
910210
910336
  getCliName() {
910211
910337
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.49.0",
2
+ "version": "4.50.1",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",