@fern-api/fern-api-dev 4.68.0 → 4.68.1-2-g6abc412986d

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 +59 -49
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -627624,14 +627624,17 @@ var AccessTokenPosthogManager = class {
627624
627624
  properties: {
627625
627625
  ...event,
627626
627626
  ...event.properties,
627627
- version: "4.68.0",
627627
+ version: "4.68.1-2-g6abc412986d",
627628
627628
  usingAccessToken: true
627629
627629
  }
627630
627630
  });
627631
627631
  }
627632
627632
  }
627633
627633
  async flush() {
627634
- await this.posthog.flush();
627634
+ try {
627635
+ await Promise.race([this.posthog.flush(), new Promise((resolve13) => setTimeout(resolve13, 3e3))]);
627636
+ } catch {
627637
+ }
627635
627638
  }
627636
627639
  };
627637
627640
 
@@ -627675,7 +627678,7 @@ var UserPosthogManager = class {
627675
627678
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
627676
627679
  event: "CLI",
627677
627680
  properties: {
627678
- version: "4.68.0",
627681
+ version: "4.68.1-2-g6abc412986d",
627679
627682
  ...event,
627680
627683
  ...event.properties,
627681
627684
  usingAccessToken: false,
@@ -627684,7 +627687,10 @@ var UserPosthogManager = class {
627684
627687
  });
627685
627688
  }
627686
627689
  async flush() {
627687
- await this.posthog.flush();
627690
+ try {
627691
+ await Promise.race([this.posthog.flush(), new Promise((resolve13) => setTimeout(resolve13, 3e3))]);
627692
+ } catch {
627693
+ }
627688
627694
  }
627689
627695
  userEmail;
627690
627696
  async getUserEmail() {
@@ -631201,7 +631207,10 @@ var TelemetryClient = class _TelemetryClient {
631201
631207
  async flush() {
631202
631208
  const promises = [];
631203
631209
  if (this.posthog != null) {
631204
- promises.push(this.posthog.shutdown().catch(() => void 0));
631210
+ promises.push(Promise.race([
631211
+ this.posthog.shutdown().catch(() => void 0),
631212
+ new Promise((resolve13) => setTimeout(resolve13, 3e3))
631213
+ ]));
631205
631214
  }
631206
631215
  if (this.sentry !== void 0) {
631207
631216
  promises.push(Promise.resolve(this.sentry.flush(2e3)).catch(() => void 0));
@@ -843944,7 +843953,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
843944
843953
  var LOGS_FOLDER_NAME = "logs";
843945
843954
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
843946
843955
  function getCliSource() {
843947
- const version7 = "4.68.0";
843956
+ const version7 = "4.68.1-2-g6abc412986d";
843948
843957
  return `cli@${version7}`;
843949
843958
  }
843950
843959
  var DebugLogger = class {
@@ -855192,7 +855201,7 @@ var LegacyDocsPublisher = class {
855192
855201
  previewId,
855193
855202
  disableTemplates: void 0,
855194
855203
  skipUpload,
855195
- cliVersion: "4.68.0"
855204
+ cliVersion: "4.68.1-2-g6abc412986d"
855196
855205
  });
855197
855206
  if (taskContext.getResult() === TaskResult.Failure) {
855198
855207
  return { success: false };
@@ -870275,13 +870284,15 @@ var Class2 = class _Class extends DefinedType {
870275
870284
  annotations = [];
870276
870285
  primaryConstructor;
870277
870286
  namespaceReferences = [];
870287
+ skipNamespaceDeclaration;
870278
870288
  constructors = [];
870279
870289
  operators = [];
870280
870290
  nestedClasses = [];
870281
870291
  nestedInterfaces = [];
870282
870292
  rawBodyBlocks = [];
870283
- constructor({ name: name2, namespace, access: access6, static_, abstract_, sealed, partial: partial2, readonly: readonly2, parentClassReference, interfaceReferences, enclosingType, type: type8, summary, doc, annotations, primaryConstructor, origin: origin2 }, generation) {
870293
+ constructor({ name: name2, namespace, access: access6, static_, abstract_, sealed, partial: partial2, readonly: readonly2, parentClassReference, interfaceReferences, enclosingType, type: type8, summary, doc, annotations, primaryConstructor, skipNamespaceDeclaration, origin: origin2 }, generation) {
870284
870294
  super({ name: name2, namespace, access: access6, partial: partial2, interfaceReferences, enclosingType, origin: origin2 }, generation);
870295
+ this.skipNamespaceDeclaration = skipNamespaceDeclaration ?? false;
870285
870296
  this.static_ = static_ ?? false;
870286
870297
  this.abstract_ = abstract_ ?? false;
870287
870298
  this.sealed = sealed ?? false;
@@ -870343,7 +870354,7 @@ var Class2 = class _Class extends DefinedType {
870343
870354
  this.namespaceReferences.forEach((namespace) => {
870344
870355
  writer2.addNamespace(namespace);
870345
870356
  });
870346
- if (!this.isNested) {
870357
+ if (!this.isNested && !this.skipNamespaceDeclaration) {
870347
870358
  writer2.writeLine(`namespace ${this.namespace};`);
870348
870359
  writer2.newLine();
870349
870360
  }
@@ -870351,7 +870362,9 @@ var Class2 = class _Class extends DefinedType {
870351
870362
  this.annotations.forEach((annotation) => {
870352
870363
  annotation.write(writer2);
870353
870364
  });
870354
- writer2.writeNewLineIfLastLineNot();
870365
+ if (!this.skipNamespaceDeclaration) {
870366
+ writer2.writeNewLineIfLastLineNot();
870367
+ }
870355
870368
  writer2.write(`${this.access}`);
870356
870369
  if (this.static_) {
870357
870370
  writer2.write(" static");
@@ -872374,7 +872387,7 @@ var CSharp = class {
872374
872387
  args.name = this.model.getClassNameFor(args.origin);
872375
872388
  }
872376
872389
  if (args.enclosingType) {
872377
- if (args.namespace) {
872390
+ if (args.namespace && args.namespace !== args.enclosingType.namespace) {
872378
872391
  throw new Error(`ClassReference: Both enclosingType and namespace cannot be provided`);
872379
872392
  }
872380
872393
  args.namespace = args.enclosingType.namespace;
@@ -874320,6 +874333,8 @@ var Generation = class {
874320
874333
  useDefaultRequestParameterValues: () => this.customConfig["use-default-request-parameter-values"] ?? false,
874321
874334
  /** When true, redacts the response body in deserialization error exceptions and adds a custom ToString override to the base API exception. Default: false. */
874322
874335
  redactResponseBodyOnError: () => this.customConfig["redact-response-body-on-error"] ?? false,
874336
+ /** When true, generates inline types as nested classes inside a static Types class on the parent type, instead of as separate top-level files. Default: false. */
874337
+ enableInlineTypes: () => this.customConfig["enable-inline-types"] ?? false,
874323
874338
  /** Temporary mapping of websocket environment configurations. Default: {}. */
874324
874339
  temporaryWebsocketEnvironments: () => this.customConfig["temporary-websocket-environments"] ?? {},
874325
874340
  /** Custom name for the base API exception class. Default: "" (auto-generated). */
@@ -875975,7 +875990,7 @@ var DynamicTypeMapper = class extends WithGeneration {
875975
875990
  if (named == null) {
875976
875991
  return this.convertUnknown();
875977
875992
  }
875978
- return this.convertNamed({ named });
875993
+ return this.convertNamed({ named, typeId: args.typeReference.value });
875979
875994
  }
875980
875995
  case "optional":
875981
875996
  case "nullable": {
@@ -875992,13 +876007,13 @@ var DynamicTypeMapper = class extends WithGeneration {
875992
876007
  assertNever(args.typeReference);
875993
876008
  }
875994
876009
  }
875995
- convertToClassReference(named) {
876010
+ convertToClassReference(named, typeId) {
875996
876011
  return this.csharp.classReference({
875997
876012
  origin: named.declaration,
875998
876013
  namespace: this.context.getNamespace(named.declaration.fernFilepath)
875999
876014
  });
876000
876015
  }
876001
- convertNamed({ named }) {
876016
+ convertNamed({ named, typeId }) {
876002
876017
  switch (named.type) {
876003
876018
  case "alias":
876004
876019
  if (this.settings.generateLiterals && named.typeReference.type === "literal") {
@@ -876010,24 +876025,15 @@ var DynamicTypeMapper = class extends WithGeneration {
876010
876025
  return this.convert({ typeReference: named.typeReference });
876011
876026
  case "enum":
876012
876027
  case "object":
876013
- return this.csharp.classReference({
876014
- origin: named.declaration,
876015
- namespace: this.context.getNamespace(named.declaration.fernFilepath)
876016
- });
876028
+ return this.convertToClassReference(named, typeId);
876017
876029
  case "discriminatedUnion":
876018
876030
  if (!this.settings.shouldGeneratedDiscriminatedUnions) {
876019
876031
  return this.Primitive.object;
876020
876032
  }
876021
- return this.csharp.classReference({
876022
- origin: named.declaration,
876023
- namespace: this.context.getNamespace(named.declaration.fernFilepath)
876024
- });
876033
+ return this.convertToClassReference(named, typeId);
876025
876034
  case "undiscriminatedUnion":
876026
876035
  if (this.settings.shouldGenerateUndiscriminatedUnions) {
876027
- return this.csharp.classReference({
876028
- origin: named.declaration,
876029
- namespace: this.context.getNamespace(named.declaration.fernFilepath)
876030
- });
876036
+ return this.convertToClassReference(named, typeId);
876031
876037
  }
876032
876038
  return this.OneOf.OneOf(named.types.map((typeReference2) => {
876033
876039
  return this.convert({ typeReference: typeReference2 });
@@ -876368,7 +876374,7 @@ var DynamicSnippetsGeneratorContext = class _DynamicSnippetsGeneratorContext ext
876368
876374
  Object.entries(this.ir.types).sort((a10, b19) => {
876369
876375
  return a10[0].length - b19[0].length;
876370
876376
  }).forEach(([typeId, type8]) => {
876371
- this.dynamicTypeMapper.convertToClassReference(type8);
876377
+ this.dynamicTypeMapper.convertToClassReference(type8, typeId);
876372
876378
  });
876373
876379
  for (const [idx, request7] of requests3.entries()) {
876374
876380
  this.csharp.classReference({
@@ -876409,7 +876415,7 @@ var EndpointSnippetGenerator2 = class extends WithGeneration {
876409
876415
  async generateSnippet({ endpoint: endpoint3, request: request7, options: options2 }) {
876410
876416
  const code5 = this.buildCodeBlock({ endpoint: endpoint3, snippet: request7, options: options2 });
876411
876417
  return code5.toString({
876412
- namespace: "Usage",
876418
+ namespace: "Examples",
876413
876419
  generation: this.generation,
876414
876420
  allNamespaceSegments: /* @__PURE__ */ new Set(),
876415
876421
  allTypeClassReferences: /* @__PURE__ */ new Map(),
@@ -876423,7 +876429,7 @@ var EndpointSnippetGenerator2 = class extends WithGeneration {
876423
876429
  generateSnippetSync({ endpoint: endpoint3, request: request7, options: options2 }) {
876424
876430
  const code5 = this.buildCodeBlock({ endpoint: endpoint3, snippet: request7, options: options2 });
876425
876431
  return code5.toString({
876426
- namespace: "Usage",
876432
+ namespace: "Examples",
876427
876433
  generation: this.generation,
876428
876434
  allNamespaceSegments: /* @__PURE__ */ new Set(),
876429
876435
  allTypeClassReferences: /* @__PURE__ */ new Map(),
@@ -876455,14 +876461,17 @@ var EndpointSnippetGenerator2 = class extends WithGeneration {
876455
876461
  }
876456
876462
  buildFullCodeBlock({ body, options: options2 }) {
876457
876463
  const config5 = this.getConfig(options2);
876464
+ const methodName = config5.fullStyleMethodName ?? config5.fullStyleClassName ?? "Example";
876458
876465
  const class_6 = this.csharp.class_({
876459
- name: config5.fullStyleClassName ?? "Example",
876460
- namespace: "Usage",
876466
+ name: "Examples",
876467
+ namespace: "Examples",
876468
+ partial: true,
876469
+ skipNamespaceDeclaration: true,
876461
876470
  access: ast_exports.Access.Public
876462
876471
  });
876463
876472
  class_6.addNamespaceReference(this.Types.RootClientForSnippets.namespace);
876464
876473
  class_6.addMethod({
876465
- name: "Do",
876474
+ name: methodName,
876466
876475
  access: ast_exports.Access.Public,
876467
876476
  isAsync: true,
876468
876477
  parameters: [],
@@ -877105,18 +877114,16 @@ function convertIr(ir15) {
877105
877114
  }
877106
877115
 
877107
877116
  // ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
877108
- var PROJECT_FILE_CONTENT = `
877109
- <Project Sdk="Microsoft.NET.Sdk">
877110
- <PropertyGroup>
877111
- <TargetFramework>net8.0</TargetFramework>
877112
- <LangVersion>12</LangVersion>
877113
- <ImplicitUsings>enable</ImplicitUsings>
877114
- <Nullable>enable</Nullable>
877115
- </PropertyGroup>
877116
-
877117
- <ItemGroup>
877118
- <ProjectReference Include="..\\..\\**\\*.csproj" Exclude="..\\..\\**\\*.DynamicSnippets.csproj;..\\..\\**\\*.Test.csproj" />
877119
- </ItemGroup>
877117
+ var PROJECT_FILE_CONTENT = `<Project Sdk="Microsoft.NET.Sdk">
877118
+ <PropertyGroup>
877119
+ <TargetFramework>net10.0</TargetFramework>
877120
+ <RootNamespace>Snippets</RootNamespace>
877121
+ <ImplicitUsings>enable</ImplicitUsings>
877122
+ <Nullable>enable</Nullable>
877123
+ </PropertyGroup>
877124
+ <ItemGroup>
877125
+ <ProjectReference Include="..\\**\\*.csproj" Exclude="..\\**\\*.Test.csproj;..\\Snippets\\*.csproj" />
877126
+ </ItemGroup>
877120
877127
  </Project>`;
877121
877128
  var DynamicSnippetsCsharpTestGenerator = class {
877122
877129
  context;
@@ -877145,7 +877152,7 @@ var DynamicSnippetsCsharpTestGenerator = class {
877145
877152
  }
877146
877153
  const response = await this.dynamicSnippetsGenerator.generate(convertedRequest, {
877147
877154
  config: {
877148
- fullStyleClassName: `Example${idx}`
877155
+ fullStyleMethodName: `Example${idx}`
877149
877156
  },
877150
877157
  style: Style2.Full,
877151
877158
  endpointId
@@ -877160,9 +877167,9 @@ var DynamicSnippetsCsharpTestGenerator = class {
877160
877167
  this.context.logger.debug("Done generating dynamic snippet tests");
877161
877168
  }
877162
877169
  async initializeProject(outputDir) {
877163
- const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/SeedApi.DynamicSnippets"));
877170
+ const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
877164
877171
  await (0, import_promises93.mkdir)(absolutePathToOutputDir, { recursive: true });
877165
- await (0, import_promises93.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("SeedApi.DynamicSnippets.csproj")), PROJECT_FILE_CONTENT);
877172
+ await (0, import_promises93.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
877166
877173
  return absolutePathToOutputDir;
877167
877174
  }
877168
877175
  getTestFilePath({ absolutePathToOutputDir, idx }) {
@@ -928934,7 +928941,7 @@ var CliContext = class _CliContext {
928934
928941
  if (false) {
928935
928942
  this.logger.error("CLI_VERSION is not defined");
928936
928943
  }
928937
- return "4.68.0";
928944
+ return "4.68.1-2-g6abc412986d";
928938
928945
  }
928939
928946
  getCliName() {
928940
928947
  if (false) {
@@ -928990,7 +928997,10 @@ var CliContext = class _CliContext {
928990
928997
  await this.nudgeUpgradeIfAvailable();
928991
928998
  }
928992
928999
  this.ttyAwareLogger.finish();
928993
- await this.posthogManager.flush();
929000
+ try {
929001
+ await this.posthogManager.flush();
929002
+ } catch {
929003
+ }
928994
929004
  await this.sentryClient.flush();
928995
929005
  this.exitProgram({ code: code5 });
928996
929006
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.68.0",
2
+ "version": "4.68.1-2-g6abc412986d",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",