@fern-api/fern-api-dev 4.64.0-2-gadfe04172bc → 4.64.0-3-g255204751d3

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 +149 -15
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -603773,7 +603773,7 @@ var AccessTokenPosthogManager = class {
603773
603773
  properties: {
603774
603774
  ...event,
603775
603775
  ...event.properties,
603776
- version: "4.64.0-2-gadfe04172bc",
603776
+ version: "4.64.0-3-g255204751d3",
603777
603777
  usingAccessToken: true
603778
603778
  }
603779
603779
  });
@@ -603824,7 +603824,7 @@ var UserPosthogManager = class {
603824
603824
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
603825
603825
  event: "CLI",
603826
603826
  properties: {
603827
- version: "4.64.0-2-gadfe04172bc",
603827
+ version: "4.64.0-3-g255204751d3",
603828
603828
  ...event,
603829
603829
  ...event.properties,
603830
603830
  usingAccessToken: false,
@@ -840791,7 +840791,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
840791
840791
  var LOGS_FOLDER_NAME = "logs";
840792
840792
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
840793
840793
  function getCliSource() {
840794
- const version7 = "4.64.0-2-gadfe04172bc";
840794
+ const version7 = "4.64.0-3-g255204751d3";
840795
840795
  return `cli@${version7}`;
840796
840796
  }
840797
840797
  var DebugLogger = class {
@@ -851989,7 +851989,7 @@ var LegacyDocsPublisher = class {
851989
851989
  previewId,
851990
851990
  disableTemplates: void 0,
851991
851991
  skipUpload,
851992
- cliVersion: "4.64.0-2-gadfe04172bc"
851992
+ cliVersion: "4.64.0-3-g255204751d3"
851993
851993
  });
851994
851994
  if (taskContext.getResult() === TaskResult.Failure) {
851995
851995
  return { success: false };
@@ -872386,28 +872386,162 @@ var DynamicLiteralMapper = class extends WithGeneration {
872386
872386
  }));
872387
872387
  }
872388
872388
  convertObject({ object_, value, fallbackToDefault }) {
872389
+ const record21 = this.context.getRecord(value) ?? {};
872389
872390
  const properties7 = this.context.associateByWireValue({
872390
872391
  parameters: object_.properties,
872391
- values: this.context.getRecord(value) ?? {}
872392
+ values: record21
872393
+ });
872394
+ const fields = properties7.map((property23) => {
872395
+ this.context.errors.scope(property23.name.wireValue);
872396
+ try {
872397
+ return {
872398
+ name: this.context.getClassName(property23.name.name),
872399
+ value: this.convert(property23)
872400
+ };
872401
+ } finally {
872402
+ this.context.errors.unscope();
872403
+ }
872392
872404
  });
872405
+ const providedWireValues = new Set(Object.keys(record21));
872406
+ for (const property23 of object_.properties) {
872407
+ const fieldName = this.context.getClassName(property23.name.name);
872408
+ if (providedWireValues.has(property23.name.wireValue)) {
872409
+ if (this.isRequiredProperty(property23.typeReference)) {
872410
+ const existing = fields.find((f10) => f10.name === fieldName);
872411
+ if (existing != null && is9.Literal.nop(existing.value)) {
872412
+ const defaultValue = this.getDefaultLiteralForType(property23.typeReference);
872413
+ if (defaultValue != null) {
872414
+ existing.value = defaultValue;
872415
+ }
872416
+ }
872417
+ }
872418
+ continue;
872419
+ }
872420
+ if (this.isRequiredProperty(property23.typeReference)) {
872421
+ const defaultValue = this.getDefaultLiteralForType(property23.typeReference);
872422
+ if (defaultValue != null) {
872423
+ fields.push({
872424
+ name: fieldName,
872425
+ value: defaultValue
872426
+ });
872427
+ }
872428
+ }
872429
+ }
872393
872430
  return this.csharp.Literal.class_({
872394
872431
  reference: this.csharp.classReference({
872395
872432
  origin: object_.declaration,
872396
872433
  namespace: this.context.getNamespace(object_.declaration.fernFilepath)
872397
872434
  }),
872398
- fields: properties7.map((property23) => {
872399
- this.context.errors.scope(property23.name.wireValue);
872400
- try {
872401
- return {
872435
+ fields
872436
+ });
872437
+ }
872438
+ isRequiredProperty(typeReference2) {
872439
+ if (this.context.isOptional(typeReference2) || this.context.isNullable(typeReference2)) {
872440
+ return false;
872441
+ }
872442
+ if (typeReference2.type === "list" || typeReference2.type === "set" || typeReference2.type === "map") {
872443
+ return false;
872444
+ }
872445
+ return true;
872446
+ }
872447
+ getDefaultLiteralForType(typeReference2, visitedTypeIds) {
872448
+ switch (typeReference2.type) {
872449
+ case "primitive":
872450
+ return this.getDefaultLiteralForPrimitive(typeReference2.value);
872451
+ case "literal":
872452
+ return this.convertLiteral({ literal: typeReference2.value, value: typeReference2.value.value });
872453
+ case "named": {
872454
+ const named = this.context.resolveNamedType({ typeId: typeReference2.value });
872455
+ if (named == null) {
872456
+ return void 0;
872457
+ }
872458
+ if (named.type === "alias") {
872459
+ return this.getDefaultLiteralForType(named.typeReference, visitedTypeIds);
872460
+ }
872461
+ if (named.type === "enum" && named.values.length > 0) {
872462
+ const firstEnumValue = named.values[0];
872463
+ if (firstEnumValue != null) {
872464
+ return this.getEnumValue(named, firstEnumValue.wireValue);
872465
+ }
872466
+ }
872467
+ if (named.type === "undiscriminatedUnion") {
872468
+ return this.getDefaultLiteralForUndiscriminatedUnion(named, visitedTypeIds);
872469
+ }
872470
+ if (named.type === "object") {
872471
+ return this.getDefaultLiteralForObject(named, typeReference2.value, visitedTypeIds);
872472
+ }
872473
+ return void 0;
872474
+ }
872475
+ default:
872476
+ return void 0;
872477
+ }
872478
+ }
872479
+ getDefaultLiteralForObject(object_, typeId, visitedTypeIds) {
872480
+ const visited = visitedTypeIds ?? /* @__PURE__ */ new Set();
872481
+ if (visited.has(typeId)) {
872482
+ return void 0;
872483
+ }
872484
+ visited.add(typeId);
872485
+ const fields = [];
872486
+ for (const property23 of object_.properties) {
872487
+ if (this.isRequiredProperty(property23.typeReference)) {
872488
+ const defaultValue = this.getDefaultLiteralForType(property23.typeReference, visited);
872489
+ if (defaultValue != null) {
872490
+ fields.push({
872402
872491
  name: this.context.getClassName(property23.name.name),
872403
- value: this.convert(property23)
872404
- };
872405
- } finally {
872406
- this.context.errors.unscope();
872492
+ value: defaultValue
872493
+ });
872407
872494
  }
872408
- })
872495
+ }
872496
+ }
872497
+ visited.delete(typeId);
872498
+ return this.csharp.Literal.class_({
872499
+ reference: this.csharp.classReference({
872500
+ origin: object_.declaration,
872501
+ namespace: this.context.getNamespace(object_.declaration.fernFilepath)
872502
+ }),
872503
+ fields
872409
872504
  });
872410
872505
  }
872506
+ getDefaultLiteralForUndiscriminatedUnion(union21, visitedTypeIds) {
872507
+ for (const typeReference2 of union21.types) {
872508
+ const defaultValue = this.getDefaultLiteralForType(typeReference2, visitedTypeIds);
872509
+ if (defaultValue != null) {
872510
+ return defaultValue;
872511
+ }
872512
+ }
872513
+ return void 0;
872514
+ }
872515
+ getDefaultLiteralForPrimitive(primitive) {
872516
+ switch (primitive) {
872517
+ case "INTEGER":
872518
+ return this.csharp.Literal.integer(0);
872519
+ case "LONG":
872520
+ return this.csharp.Literal.long(0);
872521
+ case "UINT":
872522
+ return this.csharp.Literal.uint(0);
872523
+ case "UINT_64":
872524
+ return this.csharp.Literal.ulong(0);
872525
+ case "FLOAT":
872526
+ return this.csharp.Literal.float(0);
872527
+ case "DOUBLE":
872528
+ return this.csharp.Literal.double(0);
872529
+ case "BOOLEAN":
872530
+ return this.csharp.Literal.boolean(false);
872531
+ case "STRING":
872532
+ case "UUID":
872533
+ case "BASE_64":
872534
+ case "BIG_INTEGER":
872535
+ return this.csharp.Literal.string("");
872536
+ case "DATE":
872537
+ return this.csharp.Literal.date("0001-01-01");
872538
+ case "DATE_TIME":
872539
+ case "DATE_TIME_RFC_2822":
872540
+ return this.csharp.Literal.datetime("0001-01-01T00:00:00.000Z");
872541
+ default:
872542
+ assertNever(primitive);
872543
+ }
872544
+ }
872411
872545
  convertUndiscriminatedUnion({ undiscriminatedUnion: undiscriminatedUnion20, value, fallbackToDefault }) {
872412
872546
  const result = this.findMatchingUndiscriminatedUnionType({
872413
872547
  undiscriminatedUnion: undiscriminatedUnion20,
@@ -925406,7 +925540,7 @@ var CliContext = class {
925406
925540
  if (false) {
925407
925541
  this.logger.error("CLI_VERSION is not defined");
925408
925542
  }
925409
- return "4.64.0-2-gadfe04172bc";
925543
+ return "4.64.0-3-g255204751d3";
925410
925544
  }
925411
925545
  getCliName() {
925412
925546
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.64.0-2-gadfe04172bc",
2
+ "version": "4.64.0-3-g255204751d3",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",