@fern-api/fern-api-dev 4.49.0-6-ge40fb1dc646 → 4.50.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 +101 -8
  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,
@@ -602182,7 +602275,7 @@ var AccessTokenPosthogManager = class {
602182
602275
  properties: {
602183
602276
  ...event,
602184
602277
  ...event.properties,
602185
- version: "4.49.0-6-ge40fb1dc646",
602278
+ version: "4.50.0",
602186
602279
  usingAccessToken: true
602187
602280
  }
602188
602281
  });
@@ -602233,7 +602326,7 @@ var UserPosthogManager = class {
602233
602326
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
602234
602327
  event: "CLI",
602235
602328
  properties: {
602236
- version: "4.49.0-6-ge40fb1dc646",
602329
+ version: "4.50.0",
602237
602330
  ...event,
602238
602331
  ...event.properties,
602239
602332
  usingAccessToken: false,
@@ -826088,7 +826181,7 @@ var import_path54 = __toESM(require("path"), 1);
826088
826181
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
826089
826182
  var LOGS_FOLDER_NAME = "logs";
826090
826183
  function getCliSource() {
826091
- const version7 = "4.49.0-6-ge40fb1dc646";
826184
+ const version7 = "4.50.0";
826092
826185
  return `cli@${version7}`;
826093
826186
  }
826094
826187
  var DebugLogger = class {
@@ -837090,7 +837183,7 @@ var LegacyDocsPublisher = class {
837090
837183
  previewId: void 0,
837091
837184
  disableTemplates: void 0,
837092
837185
  skipUpload,
837093
- cliVersion: "4.49.0-6-ge40fb1dc646"
837186
+ cliVersion: "4.50.0"
837094
837187
  });
837095
837188
  if (taskContext.getResult() === TaskResult.Failure) {
837096
837189
  return { success: false };
@@ -910205,7 +910298,7 @@ var CliContext = class {
910205
910298
  if (false) {
910206
910299
  this.logger.error("CLI_VERSION is not defined");
910207
910300
  }
910208
- return "4.49.0-6-ge40fb1dc646";
910301
+ return "4.50.0";
910209
910302
  }
910210
910303
  getCliName() {
910211
910304
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.49.0-6-ge40fb1dc646",
2
+ "version": "4.50.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",