@fern-api/fern-api-dev 5.75.2 → 5.75.3

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 -13
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -344223,13 +344223,28 @@ function getLiteralValueFromSchema(schema) {
344223
344223
  }
344224
344224
  return void 0;
344225
344225
  }
344226
- var LITERAL_REGEX, ExampleConverter;
344226
+ var LITERAL_REGEX, EXAMPLE_CONVERTER_SHARED_STATE, MERGE_ONLY_OBJECT_SCHEMA_FIELDS, ExampleConverter;
344227
344227
  var init_ExampleConverter = __esm({
344228
344228
  "../api-importers/v3-importer-commons/lib/converters/ExampleConverter.js"() {
344229
344229
  "use strict";
344230
344230
  init_lib4();
344231
344231
  init_lib29();
344232
344232
  LITERAL_REGEX = /^literal<\s*(?:"(.*)"|(true|false))\s*>$/;
344233
+ EXAMPLE_CONVERTER_SHARED_STATE = /* @__PURE__ */ new WeakMap();
344234
+ MERGE_ONLY_OBJECT_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
344235
+ "type",
344236
+ "properties",
344237
+ "required",
344238
+ "allOf",
344239
+ "description",
344240
+ "title",
344241
+ "deprecated",
344242
+ "readOnly",
344243
+ "writeOnly",
344244
+ "xml",
344245
+ "externalDocs",
344246
+ "discriminator"
344247
+ ]);
344233
344248
  ExampleConverter = class _ExampleConverter extends AbstractConverter {
344234
344249
  MAX_DEPTH = 12;
344235
344250
  EXAMPLE_STRING = examples_exports.STRING;
@@ -344244,6 +344259,7 @@ var init_ExampleConverter = __esm({
344244
344259
  exampleGenerationStrategy;
344245
344260
  generateOptionalProperties;
344246
344261
  seenRefs;
344262
+ sharedState;
344247
344263
  constructor({ breadcrumbs, context: context3, schema, example, depth = 0, exampleGenerationStrategy, generateOptionalProperties = false, seenRefs = /* @__PURE__ */ new Set() }) {
344248
344264
  super({ breadcrumbs, context: context3 });
344249
344265
  this.example = example;
@@ -344252,6 +344268,16 @@ var init_ExampleConverter = __esm({
344252
344268
  this.exampleGenerationStrategy = exampleGenerationStrategy;
344253
344269
  this.generateOptionalProperties = generateOptionalProperties;
344254
344270
  this.seenRefs = seenRefs;
344271
+ const existingSharedState = EXAMPLE_CONVERTER_SHARED_STATE.get(context3);
344272
+ if (existingSharedState != null) {
344273
+ this.sharedState = existingSharedState;
344274
+ } else {
344275
+ this.sharedState = {
344276
+ mergedAllOfProperties: /* @__PURE__ */ new WeakMap(),
344277
+ mergeOnlyAllOfSchemas: /* @__PURE__ */ new WeakMap()
344278
+ };
344279
+ EXAMPLE_CONVERTER_SHARED_STATE.set(context3, this.sharedState);
344280
+ }
344255
344281
  }
344256
344282
  convert() {
344257
344283
  if (this.depth > this.MAX_DEPTH) {
@@ -344720,7 +344746,8 @@ var init_ExampleConverter = __esm({
344720
344746
  };
344721
344747
  }
344722
344748
  const exampleObj = typeof this.example !== "object" || this.example == null ? {} : this.example;
344723
- const { mergedProperties, mergedRequired } = this.mergeAllOfProperties(resolvedSchema);
344749
+ const canGenerateFromMergedAllOf = this.example === void 0 && this.canGenerateFromMergedAllOf(resolvedSchema);
344750
+ const { mergedProperties, mergedRequired } = this.mergeAllOfProperties(resolvedSchema, /* @__PURE__ */ new Set(), 0, canGenerateFromMergedAllOf);
344724
344751
  const resultsByKey = Object.entries(mergedProperties).map(([key2, property24]) => {
344725
344752
  if (typeof property24 !== "object") {
344726
344753
  return {
@@ -344830,7 +344857,7 @@ var init_ExampleConverter = __esm({
344830
344857
  return { key: key2, result };
344831
344858
  }
344832
344859
  });
344833
- const allOfResults = (resolvedSchema.allOf ?? []).map((subSchema, index3) => {
344860
+ const allOfResults = canGenerateFromMergedAllOf ? [] : (resolvedSchema.allOf ?? []).map((subSchema, index3) => {
344834
344861
  const resolvedSubSchema = this.context.resolveMaybeReference({
344835
344862
  schemaOrReference: subSchema,
344836
344863
  breadcrumbs: [...this.breadcrumbs, `allOf[${index3}]`],
@@ -345212,11 +345239,21 @@ var init_ExampleConverter = __esm({
345212
345239
  *
345213
345240
  * Precedence: the override's fields win; the base's fields fill in anything missing.
345214
345241
  */
345215
- mergeAllOfProperties(resolvedSchema, visited = /* @__PURE__ */ new Set(), depth = 0) {
345242
+ mergeAllOfProperties(resolvedSchema, visited = /* @__PURE__ */ new Set(), depth = 0, useCache = false) {
345243
+ if (useCache) {
345244
+ const cached2 = this.sharedState.mergedAllOfProperties.get(resolvedSchema)?.get(depth);
345245
+ if (cached2 != null) {
345246
+ return cached2;
345247
+ }
345248
+ }
345216
345249
  const directProps = resolvedSchema.properties ?? {};
345217
345250
  const directRequired = resolvedSchema.required ?? [];
345218
345251
  if (depth > this.MAX_DEPTH || resolvedSchema.allOf == null || resolvedSchema.allOf.length === 0) {
345219
- return { mergedProperties: directProps, mergedRequired: directRequired };
345252
+ const result2 = { mergedProperties: directProps, mergedRequired: directRequired };
345253
+ if (useCache) {
345254
+ this.cacheMergedAllOfProperties(resolvedSchema, depth, result2);
345255
+ }
345256
+ return result2;
345220
345257
  }
345221
345258
  const baseProps = {};
345222
345259
  const baseRequired = new Set(directRequired);
@@ -345238,7 +345275,7 @@ var init_ExampleConverter = __esm({
345238
345275
  if (refKey != null) {
345239
345276
  childVisited.add(refKey);
345240
345277
  }
345241
- const nested = this.mergeAllOfProperties(resolved, childVisited, depth + 1);
345278
+ const nested = this.mergeAllOfProperties(resolved, childVisited, depth + 1, useCache);
345242
345279
  for (const req of nested.mergedRequired) {
345243
345280
  baseRequired.add(req);
345244
345281
  }
@@ -345292,7 +345329,58 @@ var init_ExampleConverter = __esm({
345292
345329
  merged[key2] = baseProp;
345293
345330
  }
345294
345331
  }
345295
- return { mergedProperties: merged, mergedRequired: [...baseRequired] };
345332
+ const result = { mergedProperties: merged, mergedRequired: [...baseRequired] };
345333
+ if (useCache) {
345334
+ this.cacheMergedAllOfProperties(resolvedSchema, depth, result);
345335
+ }
345336
+ return result;
345337
+ }
345338
+ cacheMergedAllOfProperties(schema, depth, mergedAllOfProperties) {
345339
+ const cachedByDepth = this.sharedState.mergedAllOfProperties.get(schema);
345340
+ if (cachedByDepth != null) {
345341
+ cachedByDepth.set(depth, mergedAllOfProperties);
345342
+ } else {
345343
+ this.sharedState.mergedAllOfProperties.set(schema, /* @__PURE__ */ new Map([[depth, mergedAllOfProperties]]));
345344
+ }
345345
+ }
345346
+ canGenerateFromMergedAllOf(resolvedSchema, visiting = /* @__PURE__ */ new WeakSet()) {
345347
+ if (resolvedSchema.allOf == null || resolvedSchema.allOf.length === 0) {
345348
+ return false;
345349
+ }
345350
+ if (!this.isMergeOnlyObjectSchema(resolvedSchema)) {
345351
+ return false;
345352
+ }
345353
+ const cached2 = this.sharedState.mergeOnlyAllOfSchemas.get(resolvedSchema);
345354
+ if (cached2 != null) {
345355
+ return cached2;
345356
+ }
345357
+ if (visiting.has(resolvedSchema)) {
345358
+ return false;
345359
+ }
345360
+ visiting.add(resolvedSchema);
345361
+ const canGenerateFromMergedAllOf = resolvedSchema.allOf.every((subSchema) => {
345362
+ const resolved = this.context.resolveMaybeReference({
345363
+ schemaOrReference: subSchema,
345364
+ breadcrumbs: this.breadcrumbs,
345365
+ skipErrorCollector: true
345366
+ });
345367
+ if (resolved == null || !this.isMergeOnlyObjectSchema(resolved)) {
345368
+ return false;
345369
+ }
345370
+ return resolved.allOf == null || resolved.allOf.length === 0 ? true : this.canGenerateFromMergedAllOf(resolved, visiting);
345371
+ });
345372
+ visiting.delete(resolvedSchema);
345373
+ this.sharedState.mergeOnlyAllOfSchemas.set(resolvedSchema, canGenerateFromMergedAllOf);
345374
+ return canGenerateFromMergedAllOf;
345375
+ }
345376
+ isMergeOnlyObjectSchema(schema) {
345377
+ if (schema.type != null && schema.type !== "object") {
345378
+ return false;
345379
+ }
345380
+ if (schema.type == null && schema.properties == null && schema.allOf == null) {
345381
+ return false;
345382
+ }
345383
+ return Object.keys(schema).every((key2) => MERGE_ONLY_OBJECT_SCHEMA_FIELDS.has(key2));
345296
345384
  }
345297
345385
  /**
345298
345386
  * Checks if a schema is a "constraint-only" schema that only has validation constraints
@@ -691061,7 +691149,7 @@ var AccessTokenPosthogManager = class {
691061
691149
  properties: {
691062
691150
  ...event,
691063
691151
  ...event.properties,
691064
- version: "5.75.2",
691152
+ version: "5.75.3",
691065
691153
  usingAccessToken: true,
691066
691154
  ...getRunIdProperties()
691067
691155
  }
@@ -691127,7 +691215,7 @@ var UserPosthogManager = class {
691127
691215
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
691128
691216
  event: "CLI",
691129
691217
  properties: {
691130
- version: "5.75.2",
691218
+ version: "5.75.3",
691131
691219
  ...event,
691132
691220
  ...event.properties,
691133
691221
  usingAccessToken: false,
@@ -872228,7 +872316,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
872228
872316
  var LOGS_FOLDER_NAME = "logs";
872229
872317
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
872230
872318
  function getCliSource() {
872231
- const version7 = "5.75.2";
872319
+ const version7 = "5.75.3";
872232
872320
  return `cli@${version7}`;
872233
872321
  }
872234
872322
  var DebugLogger = class {
@@ -904817,7 +904905,7 @@ var LegacyDocsPublisher = class {
904817
904905
  previewId,
904818
904906
  disableTemplates: void 0,
904819
904907
  skipUpload,
904820
- cliVersion: "5.75.2",
904908
+ cliVersion: "5.75.3",
904821
904909
  loginCommand: "fern auth login"
904822
904910
  });
904823
904911
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -971604,7 +971692,7 @@ function getAutomationContextFromEnv() {
971604
971692
  config_branch: process.env.FERN_CONFIG_BRANCH,
971605
971693
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
971606
971694
  trigger: process.env.GITHUB_EVENT_NAME,
971607
- cli_version: "5.75.2"
971695
+ cli_version: "5.75.3"
971608
971696
  };
971609
971697
  }
971610
971698
  function isAutomationMode() {
@@ -972436,7 +972524,7 @@ var CliContext = class _CliContext {
972436
972524
  if (false) {
972437
972525
  this.logger.error("CLI_VERSION is not defined");
972438
972526
  }
972439
- return "5.75.2";
972527
+ return "5.75.3";
972440
972528
  }
972441
972529
  getCliName() {
972442
972530
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.75.2",
2
+ "version": "5.75.3",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",