@fern-api/fern-api-dev 5.23.3 → 5.23.5

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 +143 -34
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -224990,9 +224990,9 @@ var require_path_key = __commonJS({
224990
224990
  }
224991
224991
  });
224992
224992
 
224993
- // ../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/util/resolveCommand.js
224993
+ // ../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
224994
224994
  var require_resolveCommand = __commonJS({
224995
- "../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module4) {
224995
+ "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module4) {
224996
224996
  "use strict";
224997
224997
  var path107 = require("path");
224998
224998
  var which = require_which();
@@ -225032,9 +225032,9 @@ var require_resolveCommand = __commonJS({
225032
225032
  }
225033
225033
  });
225034
225034
 
225035
- // ../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/util/escape.js
225035
+ // ../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
225036
225036
  var require_escape2 = __commonJS({
225037
- "../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/util/escape.js"(exports2, module4) {
225037
+ "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports2, module4) {
225038
225038
  "use strict";
225039
225039
  var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
225040
225040
  function escapeCommand(arg) {
@@ -225085,9 +225085,9 @@ var require_shebang_command = __commonJS({
225085
225085
  }
225086
225086
  });
225087
225087
 
225088
- // ../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/util/readShebang.js
225088
+ // ../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
225089
225089
  var require_readShebang = __commonJS({
225090
- "../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module4) {
225090
+ "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module4) {
225091
225091
  "use strict";
225092
225092
  var fs28 = require("fs");
225093
225093
  var shebangCommand = require_shebang_command();
@@ -225107,9 +225107,9 @@ var require_readShebang = __commonJS({
225107
225107
  }
225108
225108
  });
225109
225109
 
225110
- // ../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/parse.js
225110
+ // ../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
225111
225111
  var require_parse4 = __commonJS({
225112
- "../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/parse.js"(exports2, module4) {
225112
+ "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module4) {
225113
225113
  "use strict";
225114
225114
  var path107 = require("path");
225115
225115
  var resolveCommand = require_resolveCommand();
@@ -225169,9 +225169,9 @@ var require_parse4 = __commonJS({
225169
225169
  }
225170
225170
  });
225171
225171
 
225172
- // ../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/enoent.js
225172
+ // ../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
225173
225173
  var require_enoent = __commonJS({
225174
- "../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/lib/enoent.js"(exports2, module4) {
225174
+ "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports2, module4) {
225175
225175
  "use strict";
225176
225176
  var isWin = process.platform === "win32";
225177
225177
  function notFoundError(original, syscall) {
@@ -225219,9 +225219,9 @@ var require_enoent = __commonJS({
225219
225219
  }
225220
225220
  });
225221
225221
 
225222
- // ../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/index.js
225222
+ // ../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
225223
225223
  var require_cross_spawn = __commonJS({
225224
- "../../../node_modules/.pnpm/cross-spawn@7.0.5/node_modules/cross-spawn/index.js"(exports2, module4) {
225224
+ "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module4) {
225225
225225
  "use strict";
225226
225226
  var cp11 = require("child_process");
225227
225227
  var parse19 = require_parse4();
@@ -369328,9 +369328,14 @@ var require_createReplayBranch = __commonJS({
369328
369328
  }
369329
369329
  const parentSha = replayConflictInfo.previousGenerationSha;
369330
369330
  await repository.createBranchFromHead(branchName);
369331
- const genTreeHash = await repository.getCommitTreeHash(replayConflictInfo.currentGenerationSha);
369332
- const tagCommitSha = await repository.commitTree(genTreeHash, parentSha, `[fern-generated] ${commitMessage ?? "Update SDK"}`);
369333
- return tagCommitSha;
369331
+ try {
369332
+ const genTreeHash = await repository.getCommitTreeHash(replayConflictInfo.currentGenerationSha);
369333
+ const tagCommitSha = await repository.commitTree(genTreeHash, parentSha, `[fern-generated] ${commitMessage ?? "Update SDK"}`);
369334
+ return tagCommitSha;
369335
+ } catch (error50) {
369336
+ logger4.warn(`Could not create fern-generation-base tag commit: parent ${parentSha} is unreachable in this clone (likely on a squash-merged + deleted branch). Continuing without tag update. Underlying error: ${String(error50)}`);
369337
+ return void 0;
369338
+ }
369334
369339
  }
369335
369340
  }
369336
369341
  });
@@ -578139,15 +578144,28 @@ function convertSchemaObject(schema2, wrapAsOptional, wrapAsNullable, context3,
578139
578144
  const convertedSchema = convertSchema2(filteredAllOfs[0], wrapAsOptional, wrapAsNullable, context3, breadcrumbs, source2, namespace, referencedAsRequest);
578140
578145
  return maybeInjectDescriptionOrGroupName(convertedSchema, description, namespace, groupName);
578141
578146
  }
578142
- const filteredAllOfObjects = filteredAllOfs.filter((allOf) => {
578143
- const valid2 = isValidAllOfObject(allOf);
578144
- if (!valid2) {
578147
+ const filteredAllOfObjects = [];
578148
+ const filteredOutPrimitiveElements = [];
578149
+ for (const allOf of filteredAllOfs) {
578150
+ if (isValidAllOfObject(allOf)) {
578151
+ filteredAllOfObjects.push(allOf);
578152
+ } else {
578145
578153
  context3.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(allOf)}`);
578154
+ if (!isReferenceObject(allOf)) {
578155
+ filteredOutPrimitiveElements.push(allOf);
578156
+ }
578146
578157
  }
578147
- return valid2;
578148
- });
578158
+ }
578149
578159
  if ((schema2.properties == null || hasNoProperties(schema2)) && filteredAllOfObjects.length === 1 && filteredAllOfObjects[0] != null && (schema2.additionalProperties == null || schema2.additionalProperties === false)) {
578150
- const convertedSchema = convertSchema2(filteredAllOfObjects[0], wrapAsOptional, wrapAsNullable, context3, breadcrumbs, source2, namespace, referencedAsRequest);
578160
+ let elementToConvert = filteredAllOfObjects[0];
578161
+ if (filteredOutPrimitiveElements.length > 0) {
578162
+ const base4 = isReferenceObject(elementToConvert) ? { ...context3.resolveSchemaReference(elementToConvert) } : { ...elementToConvert };
578163
+ for (const primitiveElement of filteredOutPrimitiveElements) {
578164
+ Object.assign(base4, primitiveElement);
578165
+ }
578166
+ elementToConvert = base4;
578167
+ }
578168
+ const convertedSchema = convertSchema2(elementToConvert, wrapAsOptional, wrapAsNullable, context3, breadcrumbs, source2, namespace, referencedAsRequest);
578151
578169
  return maybeInjectDescriptionOrGroupName(convertedSchema, description, namespace, groupName);
578152
578170
  }
578153
578171
  return convertObject3({
@@ -647959,7 +647977,8 @@ var ExampleConverter = class _ExampleConverter extends AbstractConverter {
647959
647977
  };
647960
647978
  }
647961
647979
  const exampleObj = typeof this.example !== "object" || this.example == null ? {} : this.example;
647962
- const resultsByKey = Object.entries(resolvedSchema.properties ?? {}).map(([key2, property24]) => {
647980
+ const { mergedProperties, mergedRequired } = this.mergeAllOfProperties(resolvedSchema);
647981
+ const resultsByKey = Object.entries(mergedProperties).map(([key2, property24]) => {
647963
647982
  if (typeof property24 !== "object") {
647964
647983
  return {
647965
647984
  key: key2,
@@ -648025,7 +648044,7 @@ var ExampleConverter = class _ExampleConverter extends AbstractConverter {
648025
648044
  }
648026
648045
  const propertyAllowsNull = schemaAllowsNull(property24);
648027
648046
  const propertyIsOmittedFromExample = !(key2 in exampleObj) || !propertyAllowsNull && exampleObj[key2] == null || propertyAllowsNull && exampleObj[key2] === void 0;
648028
- const propertyIsOptional = !resolvedSchema.required?.includes(key2);
648047
+ const propertyIsOptional = !mergedRequired.includes(key2);
648029
648048
  if (propertyIsOmittedFromExample && propertyIsOptional) {
648030
648049
  if (this.example === void 0 && this.generateOptionalProperties) {
648031
648050
  const propertyExample = this.maybeResolveSchemaExample(property24);
@@ -648100,10 +648119,12 @@ var ExampleConverter = class _ExampleConverter extends AbstractConverter {
648100
648119
  for (const result of allOfResults) {
648101
648120
  if (typeof result.validExample === "object" && result.validExample !== null) {
648102
648121
  const validExampleObj = result.validExample;
648103
- example = {
648104
- ...example,
648105
- ...Object.fromEntries(Object.entries(validExampleObj).filter(([_7, value2]) => value2 !== void 0))
648106
- };
648122
+ const filteredAllOf = Object.fromEntries(Object.entries(validExampleObj).filter(([_7, value2]) => value2 !== void 0));
648123
+ for (const [key2, value2] of Object.entries(filteredAllOf)) {
648124
+ if (!(key2 in example) || example[key2] == null) {
648125
+ example[key2] = value2;
648126
+ }
648127
+ }
648107
648128
  }
648108
648129
  }
648109
648130
  const additionalPropertiesResults = [];
@@ -648415,6 +648436,81 @@ var ExampleConverter = class _ExampleConverter extends AbstractConverter {
648415
648436
  }
648416
648437
  return void 0;
648417
648438
  }
648439
+ /**
648440
+ * Handles allOf schemas where one element provides a base object and another
648441
+ * overrides specific properties. For example, given:
648442
+ *
648443
+ * allOf:
648444
+ * - $ref: GenericSearchResponse # base: { results: { type: array, items: {} } }
648445
+ * - properties: # override: just replaces items
648446
+ * results:
648447
+ * items:
648448
+ * $ref: SpecificModel
648449
+ *
648450
+ * The override's `results` only has `{ items: $ref }` — it's missing `type: array`
648451
+ * because the base already defined that. This function merges the two so the final
648452
+ * `results` property gets `{ type: array, items: $ref SpecificModel }`, letting the
648453
+ * example generator know it should produce an array, not a generic object.
648454
+ *
648455
+ * Precedence: the override's fields win; the base's fields fill in anything missing.
648456
+ */
648457
+ mergeAllOfProperties(resolvedSchema) {
648458
+ const directProps = resolvedSchema.properties ?? {};
648459
+ const directRequired = resolvedSchema.required ?? [];
648460
+ if (resolvedSchema.allOf == null || resolvedSchema.allOf.length === 0) {
648461
+ return { mergedProperties: directProps, mergedRequired: directRequired };
648462
+ }
648463
+ const baseProps = {};
648464
+ const baseRequired = new Set(directRequired);
648465
+ for (const subSchema of resolvedSchema.allOf) {
648466
+ const resolved = this.context.resolveMaybeReference({
648467
+ schemaOrReference: subSchema,
648468
+ breadcrumbs: this.breadcrumbs,
648469
+ skipErrorCollector: true
648470
+ });
648471
+ if (resolved == null) {
648472
+ continue;
648473
+ }
648474
+ if (resolved.required != null) {
648475
+ for (const req of resolved.required) {
648476
+ baseRequired.add(req);
648477
+ }
648478
+ }
648479
+ if (resolved.properties != null) {
648480
+ for (const [key2, value2] of Object.entries(resolved.properties)) {
648481
+ if (typeof value2 === "object" && value2 !== null) {
648482
+ const existing = baseProps[key2];
648483
+ if (existing != null && isInlineSchema(existing) && isInlineSchema(value2)) {
648484
+ baseProps[key2] = { ...existing, ...value2 };
648485
+ } else {
648486
+ baseProps[key2] = value2;
648487
+ }
648488
+ }
648489
+ }
648490
+ }
648491
+ }
648492
+ const merged = { ...directProps };
648493
+ for (const [key2, directProp] of Object.entries(merged)) {
648494
+ const baseProp = baseProps[key2];
648495
+ if (baseProp == null || !isInlineSchema(directProp)) {
648496
+ continue;
648497
+ }
648498
+ const resolvedBase = "$ref" in baseProp ? this.context.resolveMaybeReference({
648499
+ schemaOrReference: baseProp,
648500
+ breadcrumbs: this.breadcrumbs,
648501
+ skipErrorCollector: true
648502
+ }) : baseProp;
648503
+ if (resolvedBase != null) {
648504
+ merged[key2] = { ...resolvedBase, ...directProp };
648505
+ }
648506
+ }
648507
+ for (const [key2, baseProp] of Object.entries(baseProps)) {
648508
+ if (!(key2 in merged)) {
648509
+ merged[key2] = baseProp;
648510
+ }
648511
+ }
648512
+ return { mergedProperties: merged, mergedRequired: [...baseRequired] };
648513
+ }
648418
648514
  /**
648419
648515
  * Checks if a schema is a "constraint-only" schema that only has validation constraints
648420
648516
  * like 'required' but no actual structure (no type, properties, allOf, oneOf, anyOf, etc.).
@@ -650588,7 +650684,7 @@ var SchemaOrReferenceConverter = class extends AbstractConverter {
650588
650684
  const refElements = this.schemaOrReference.allOf.filter((s9) => this.context.isReferenceObject(s9));
650589
650685
  const inlineElements = this.schemaOrReference.allOf.filter((s9) => typeof s9 === "object" && s9 !== null && !this.context.isReferenceObject(s9));
650590
650686
  const singleRef = refElements.length === 1 ? refElements[0] : void 0;
650591
- if (singleRef != null && inlineElements.every((s9) => !s9.properties && !s9.enum && !s9.oneOf && !s9.anyOf && !s9.allOf && !s9.format && !("items" in s9)) && !inlineElements.some((s9) => s9.type === "null" || Array.isArray(s9.type) && s9.type.includes("null"))) {
650687
+ if (singleRef != null && inlineElements.every((s9) => isMetadataOnlySchema(s9))) {
650592
650688
  const resolved = this.context.resolveMaybeReference({
650593
650689
  schemaOrReference: singleRef,
650594
650690
  breadcrumbs: this.breadcrumbs
@@ -650663,6 +650759,19 @@ var SchemaOrReferenceConverter = class extends AbstractConverter {
650663
650759
  return TypeReference2.container(ContainerType.nullable(type8));
650664
650760
  }
650665
650761
  };
650762
+ var METADATA_ONLY_FIELDS = /* @__PURE__ */ new Set([
650763
+ "description",
650764
+ "title",
650765
+ "deprecated",
650766
+ "readOnly",
650767
+ "writeOnly",
650768
+ "xml",
650769
+ "externalDocs",
650770
+ "x-fern-type-name"
650771
+ ]);
650772
+ function isMetadataOnlySchema(schema2) {
650773
+ return Object.keys(schema2).every((key2) => METADATA_ONLY_FIELDS.has(key2));
650774
+ }
650666
650775
 
650667
650776
  // ../api-importers/v3-importer-commons/lib/converters/schema/ArraySchemaConverter.js
650668
650777
  var ArraySchemaConverter = class _ArraySchemaConverter extends AbstractConverter {
@@ -667458,7 +667567,7 @@ var AccessTokenPosthogManager = class {
667458
667567
  properties: {
667459
667568
  ...event,
667460
667569
  ...event.properties,
667461
- version: "5.23.3",
667570
+ version: "5.23.5",
667462
667571
  usingAccessToken: true,
667463
667572
  ...getRunIdProperties()
667464
667573
  }
@@ -667513,7 +667622,7 @@ var UserPosthogManager = class {
667513
667622
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
667514
667623
  event: "CLI",
667515
667624
  properties: {
667516
- version: "5.23.3",
667625
+ version: "5.23.5",
667517
667626
  ...event,
667518
667627
  ...event.properties,
667519
667628
  usingAccessToken: false,
@@ -858793,7 +858902,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
858793
858902
  var LOGS_FOLDER_NAME = "logs";
858794
858903
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
858795
858904
  function getCliSource() {
858796
- const version7 = "5.23.3";
858905
+ const version7 = "5.23.5";
858797
858906
  return `cli@${version7}`;
858798
858907
  }
858799
858908
  var DebugLogger = class {
@@ -871617,7 +871726,7 @@ var LegacyDocsPublisher = class {
871617
871726
  previewId,
871618
871727
  disableTemplates: void 0,
871619
871728
  skipUpload,
871620
- cliVersion: "5.23.3",
871729
+ cliVersion: "5.23.5",
871621
871730
  loginCommand: "fern auth login"
871622
871731
  });
871623
871732
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -907851,7 +907960,7 @@ var Comment6 = class extends AstNode6 {
907851
907960
  this.docs = docs2;
907852
907961
  }
907853
907962
  write(writer2) {
907854
- if (this.docs != null) {
907963
+ if (this.docs?.trim()) {
907855
907964
  this.docs.split("\n").forEach((line) => {
907856
907965
  const wrappedLines = this.wrapLine(line, writer2);
907857
907966
  wrappedLines.forEach((wrappedLine) => {
@@ -946362,7 +946471,7 @@ var CliContext = class _CliContext {
946362
946471
  if (false) {
946363
946472
  this.logger.error("CLI_VERSION is not defined");
946364
946473
  }
946365
- return "5.23.3";
946474
+ return "5.23.5";
946366
946475
  }
946367
946476
  getCliName() {
946368
946477
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.3",
2
+ "version": "5.23.5",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",