@fern-api/fern-api-dev 4.68.0 → 4.68.1-10-g73c0bb83835

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 +82 -56
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -226337,9 +226337,9 @@ var require_bl = __commonJS({
226337
226337
  }
226338
226338
  });
226339
226339
 
226340
- // ../../../node_modules/.pnpm/follow-redirects@1.15.11/node_modules/follow-redirects/debug.js
226340
+ // ../../../node_modules/.pnpm/follow-redirects@1.16.0/node_modules/follow-redirects/debug.js
226341
226341
  var require_debug2 = __commonJS({
226342
- "../../../node_modules/.pnpm/follow-redirects@1.15.11/node_modules/follow-redirects/debug.js"(exports2, module4) {
226342
+ "../../../node_modules/.pnpm/follow-redirects@1.16.0/node_modules/follow-redirects/debug.js"(exports2, module4) {
226343
226343
  "use strict";
226344
226344
  var debug9;
226345
226345
  module4.exports = function() {
@@ -226358,9 +226358,9 @@ var require_debug2 = __commonJS({
226358
226358
  }
226359
226359
  });
226360
226360
 
226361
- // ../../../node_modules/.pnpm/follow-redirects@1.15.11/node_modules/follow-redirects/index.js
226361
+ // ../../../node_modules/.pnpm/follow-redirects@1.16.0/node_modules/follow-redirects/index.js
226362
226362
  var require_follow_redirects = __commonJS({
226363
- "../../../node_modules/.pnpm/follow-redirects@1.15.11/node_modules/follow-redirects/index.js"(exports2, module4) {
226363
+ "../../../node_modules/.pnpm/follow-redirects@1.16.0/node_modules/follow-redirects/index.js"(exports2, module4) {
226364
226364
  "use strict";
226365
226365
  var url3 = require("url");
226366
226366
  var URL4 = url3.URL;
@@ -226383,6 +226383,11 @@ var require_follow_redirects = __commonJS({
226383
226383
  } catch (error50) {
226384
226384
  useNativeURL = error50.code === "ERR_INVALID_URL";
226385
226385
  }
226386
+ var sensitiveHeaders = [
226387
+ "Authorization",
226388
+ "Proxy-Authorization",
226389
+ "Cookie"
226390
+ ];
226386
226391
  var preservedUrlFields = [
226387
226392
  "auth",
226388
226393
  "host",
@@ -226447,6 +226452,7 @@ var require_follow_redirects = __commonJS({
226447
226452
  self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
226448
226453
  }
226449
226454
  };
226455
+ this._headerFilter = new RegExp("^(?:" + sensitiveHeaders.concat(options2.sensitiveHeaders).map(escapeRegex2).join("|") + ")$", "i");
226450
226456
  this._performRequest();
226451
226457
  }
226452
226458
  RedirectableRequest.prototype = Object.create(Writable2.prototype);
@@ -226584,6 +226590,9 @@ var require_follow_redirects = __commonJS({
226584
226590
  if (!options2.headers) {
226585
226591
  options2.headers = {};
226586
226592
  }
226593
+ if (!isArray7(options2.sensitiveHeaders)) {
226594
+ options2.sensitiveHeaders = [];
226595
+ }
226587
226596
  if (options2.host) {
226588
226597
  if (!options2.hostname) {
226589
226598
  options2.hostname = options2.host;
@@ -226689,7 +226698,7 @@ var require_follow_redirects = __commonJS({
226689
226698
  this._isRedirect = true;
226690
226699
  spreadUrlObject(redirectUrl, this._options);
226691
226700
  if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
226692
- removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
226701
+ removeMatchingHeaders(this._headerFilter, this._options.headers);
226693
226702
  }
226694
226703
  if (isFunction10(beforeRedirect)) {
226695
226704
  var responseDetails = {
@@ -226838,6 +226847,9 @@ var require_follow_redirects = __commonJS({
226838
226847
  var dot = subdomain.length - domain3.length - 1;
226839
226848
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain3);
226840
226849
  }
226850
+ function isArray7(value) {
226851
+ return value instanceof Array;
226852
+ }
226841
226853
  function isString6(value) {
226842
226854
  return typeof value === "string" || value instanceof String;
226843
226855
  }
@@ -226850,6 +226862,9 @@ var require_follow_redirects = __commonJS({
226850
226862
  function isURL2(value) {
226851
226863
  return URL4 && value instanceof URL4;
226852
226864
  }
226865
+ function escapeRegex2(regex5) {
226866
+ return regex5.replace(/[\]\\/()*+?.$]/g, "\\$&");
226867
+ }
226853
226868
  module4.exports = wrap10({ http: http13, https: https5 });
226854
226869
  module4.exports.wrap = wrap10;
226855
226870
  }
@@ -627624,14 +627639,17 @@ var AccessTokenPosthogManager = class {
627624
627639
  properties: {
627625
627640
  ...event,
627626
627641
  ...event.properties,
627627
- version: "4.68.0",
627642
+ version: "4.68.1-10-g73c0bb83835",
627628
627643
  usingAccessToken: true
627629
627644
  }
627630
627645
  });
627631
627646
  }
627632
627647
  }
627633
627648
  async flush() {
627634
- await this.posthog.flush();
627649
+ try {
627650
+ await Promise.race([this.posthog.flush(), new Promise((resolve13) => setTimeout(resolve13, 3e3))]);
627651
+ } catch {
627652
+ }
627635
627653
  }
627636
627654
  };
627637
627655
 
@@ -627675,7 +627693,7 @@ var UserPosthogManager = class {
627675
627693
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
627676
627694
  event: "CLI",
627677
627695
  properties: {
627678
- version: "4.68.0",
627696
+ version: "4.68.1-10-g73c0bb83835",
627679
627697
  ...event,
627680
627698
  ...event.properties,
627681
627699
  usingAccessToken: false,
@@ -627684,7 +627702,10 @@ var UserPosthogManager = class {
627684
627702
  });
627685
627703
  }
627686
627704
  async flush() {
627687
- await this.posthog.flush();
627705
+ try {
627706
+ await Promise.race([this.posthog.flush(), new Promise((resolve13) => setTimeout(resolve13, 3e3))]);
627707
+ } catch {
627708
+ }
627688
627709
  }
627689
627710
  userEmail;
627690
627711
  async getUserEmail() {
@@ -631201,7 +631222,10 @@ var TelemetryClient = class _TelemetryClient {
631201
631222
  async flush() {
631202
631223
  const promises = [];
631203
631224
  if (this.posthog != null) {
631204
- promises.push(this.posthog.shutdown().catch(() => void 0));
631225
+ promises.push(Promise.race([
631226
+ this.posthog.shutdown().catch(() => void 0),
631227
+ new Promise((resolve13) => setTimeout(resolve13, 3e3))
631228
+ ]));
631205
631229
  }
631206
631230
  if (this.sentry !== void 0) {
631207
631231
  promises.push(Promise.resolve(this.sentry.flush(2e3)).catch(() => void 0));
@@ -843944,7 +843968,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
843944
843968
  var LOGS_FOLDER_NAME = "logs";
843945
843969
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
843946
843970
  function getCliSource() {
843947
- const version7 = "4.68.0";
843971
+ const version7 = "4.68.1-10-g73c0bb83835";
843948
843972
  return `cli@${version7}`;
843949
843973
  }
843950
843974
  var DebugLogger = class {
@@ -844825,7 +844849,7 @@ var ReferencedAPICollector = class {
844825
844849
  constructor(context3) {
844826
844850
  this.context = context3;
844827
844851
  }
844828
- addReferencedAPI({ ir: ir15, snippetsConfig, playgroundConfig, graphqlOperations = {}, graphqlTypes = {} }) {
844852
+ addReferencedAPI({ ir: ir15, snippetsConfig, playgroundConfig, apiName, graphqlOperations = {}, graphqlTypes = {} }) {
844829
844853
  try {
844830
844854
  const id2 = v4_default();
844831
844855
  const dbApiDefinition = convertAPIDefinitionToDb(convertIrToFdrApi({
@@ -844834,7 +844858,8 @@ var ReferencedAPICollector = class {
844834
844858
  playgroundConfig,
844835
844859
  graphqlOperations,
844836
844860
  graphqlTypes,
844837
- context: this.context
844861
+ context: this.context,
844862
+ apiNameOverride: apiName
844838
844863
  }), FdrAPI_exports.ApiDefinitionId(id2), new SDKSnippetHolder({
844839
844864
  snippetsConfigWithSdkId: {},
844840
844865
  snippetsBySdkId: {},
@@ -855192,7 +855217,7 @@ var LegacyDocsPublisher = class {
855192
855217
  previewId,
855193
855218
  disableTemplates: void 0,
855194
855219
  skipUpload,
855195
- cliVersion: "4.68.0"
855220
+ cliVersion: "4.68.1-10-g73c0bb83835"
855196
855221
  });
855197
855222
  if (taskContext.getResult() === TaskResult.Failure) {
855198
855223
  return { success: false };
@@ -870275,13 +870300,15 @@ var Class2 = class _Class extends DefinedType {
870275
870300
  annotations = [];
870276
870301
  primaryConstructor;
870277
870302
  namespaceReferences = [];
870303
+ skipNamespaceDeclaration;
870278
870304
  constructors = [];
870279
870305
  operators = [];
870280
870306
  nestedClasses = [];
870281
870307
  nestedInterfaces = [];
870282
870308
  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) {
870309
+ 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
870310
  super({ name: name2, namespace, access: access6, partial: partial2, interfaceReferences, enclosingType, origin: origin2 }, generation);
870311
+ this.skipNamespaceDeclaration = skipNamespaceDeclaration ?? false;
870285
870312
  this.static_ = static_ ?? false;
870286
870313
  this.abstract_ = abstract_ ?? false;
870287
870314
  this.sealed = sealed ?? false;
@@ -870343,7 +870370,7 @@ var Class2 = class _Class extends DefinedType {
870343
870370
  this.namespaceReferences.forEach((namespace) => {
870344
870371
  writer2.addNamespace(namespace);
870345
870372
  });
870346
- if (!this.isNested) {
870373
+ if (!this.isNested && !this.skipNamespaceDeclaration) {
870347
870374
  writer2.writeLine(`namespace ${this.namespace};`);
870348
870375
  writer2.newLine();
870349
870376
  }
@@ -870351,7 +870378,9 @@ var Class2 = class _Class extends DefinedType {
870351
870378
  this.annotations.forEach((annotation) => {
870352
870379
  annotation.write(writer2);
870353
870380
  });
870354
- writer2.writeNewLineIfLastLineNot();
870381
+ if (!this.skipNamespaceDeclaration) {
870382
+ writer2.writeNewLineIfLastLineNot();
870383
+ }
870355
870384
  writer2.write(`${this.access}`);
870356
870385
  if (this.static_) {
870357
870386
  writer2.write(" static");
@@ -872374,7 +872403,7 @@ var CSharp = class {
872374
872403
  args.name = this.model.getClassNameFor(args.origin);
872375
872404
  }
872376
872405
  if (args.enclosingType) {
872377
- if (args.namespace) {
872406
+ if (args.namespace && args.namespace !== args.enclosingType.namespace) {
872378
872407
  throw new Error(`ClassReference: Both enclosingType and namespace cannot be provided`);
872379
872408
  }
872380
872409
  args.namespace = args.enclosingType.namespace;
@@ -874320,6 +874349,8 @@ var Generation = class {
874320
874349
  useDefaultRequestParameterValues: () => this.customConfig["use-default-request-parameter-values"] ?? false,
874321
874350
  /** When true, redacts the response body in deserialization error exceptions and adds a custom ToString override to the base API exception. Default: false. */
874322
874351
  redactResponseBodyOnError: () => this.customConfig["redact-response-body-on-error"] ?? false,
874352
+ /** 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. */
874353
+ enableInlineTypes: () => this.customConfig["enable-inline-types"] ?? false,
874323
874354
  /** Temporary mapping of websocket environment configurations. Default: {}. */
874324
874355
  temporaryWebsocketEnvironments: () => this.customConfig["temporary-websocket-environments"] ?? {},
874325
874356
  /** Custom name for the base API exception class. Default: "" (auto-generated). */
@@ -875975,7 +876006,7 @@ var DynamicTypeMapper = class extends WithGeneration {
875975
876006
  if (named == null) {
875976
876007
  return this.convertUnknown();
875977
876008
  }
875978
- return this.convertNamed({ named });
876009
+ return this.convertNamed({ named, typeId: args.typeReference.value });
875979
876010
  }
875980
876011
  case "optional":
875981
876012
  case "nullable": {
@@ -875992,13 +876023,13 @@ var DynamicTypeMapper = class extends WithGeneration {
875992
876023
  assertNever(args.typeReference);
875993
876024
  }
875994
876025
  }
875995
- convertToClassReference(named) {
876026
+ convertToClassReference(named, typeId) {
875996
876027
  return this.csharp.classReference({
875997
876028
  origin: named.declaration,
875998
876029
  namespace: this.context.getNamespace(named.declaration.fernFilepath)
875999
876030
  });
876000
876031
  }
876001
- convertNamed({ named }) {
876032
+ convertNamed({ named, typeId }) {
876002
876033
  switch (named.type) {
876003
876034
  case "alias":
876004
876035
  if (this.settings.generateLiterals && named.typeReference.type === "literal") {
@@ -876010,24 +876041,15 @@ var DynamicTypeMapper = class extends WithGeneration {
876010
876041
  return this.convert({ typeReference: named.typeReference });
876011
876042
  case "enum":
876012
876043
  case "object":
876013
- return this.csharp.classReference({
876014
- origin: named.declaration,
876015
- namespace: this.context.getNamespace(named.declaration.fernFilepath)
876016
- });
876044
+ return this.convertToClassReference(named, typeId);
876017
876045
  case "discriminatedUnion":
876018
876046
  if (!this.settings.shouldGeneratedDiscriminatedUnions) {
876019
876047
  return this.Primitive.object;
876020
876048
  }
876021
- return this.csharp.classReference({
876022
- origin: named.declaration,
876023
- namespace: this.context.getNamespace(named.declaration.fernFilepath)
876024
- });
876049
+ return this.convertToClassReference(named, typeId);
876025
876050
  case "undiscriminatedUnion":
876026
876051
  if (this.settings.shouldGenerateUndiscriminatedUnions) {
876027
- return this.csharp.classReference({
876028
- origin: named.declaration,
876029
- namespace: this.context.getNamespace(named.declaration.fernFilepath)
876030
- });
876052
+ return this.convertToClassReference(named, typeId);
876031
876053
  }
876032
876054
  return this.OneOf.OneOf(named.types.map((typeReference2) => {
876033
876055
  return this.convert({ typeReference: typeReference2 });
@@ -876368,7 +876390,7 @@ var DynamicSnippetsGeneratorContext = class _DynamicSnippetsGeneratorContext ext
876368
876390
  Object.entries(this.ir.types).sort((a10, b19) => {
876369
876391
  return a10[0].length - b19[0].length;
876370
876392
  }).forEach(([typeId, type8]) => {
876371
- this.dynamicTypeMapper.convertToClassReference(type8);
876393
+ this.dynamicTypeMapper.convertToClassReference(type8, typeId);
876372
876394
  });
876373
876395
  for (const [idx, request7] of requests3.entries()) {
876374
876396
  this.csharp.classReference({
@@ -876409,7 +876431,7 @@ var EndpointSnippetGenerator2 = class extends WithGeneration {
876409
876431
  async generateSnippet({ endpoint: endpoint3, request: request7, options: options2 }) {
876410
876432
  const code5 = this.buildCodeBlock({ endpoint: endpoint3, snippet: request7, options: options2 });
876411
876433
  return code5.toString({
876412
- namespace: "Usage",
876434
+ namespace: "Examples",
876413
876435
  generation: this.generation,
876414
876436
  allNamespaceSegments: /* @__PURE__ */ new Set(),
876415
876437
  allTypeClassReferences: /* @__PURE__ */ new Map(),
@@ -876423,7 +876445,7 @@ var EndpointSnippetGenerator2 = class extends WithGeneration {
876423
876445
  generateSnippetSync({ endpoint: endpoint3, request: request7, options: options2 }) {
876424
876446
  const code5 = this.buildCodeBlock({ endpoint: endpoint3, snippet: request7, options: options2 });
876425
876447
  return code5.toString({
876426
- namespace: "Usage",
876448
+ namespace: "Examples",
876427
876449
  generation: this.generation,
876428
876450
  allNamespaceSegments: /* @__PURE__ */ new Set(),
876429
876451
  allTypeClassReferences: /* @__PURE__ */ new Map(),
@@ -876455,14 +876477,17 @@ var EndpointSnippetGenerator2 = class extends WithGeneration {
876455
876477
  }
876456
876478
  buildFullCodeBlock({ body, options: options2 }) {
876457
876479
  const config5 = this.getConfig(options2);
876480
+ const methodName = config5.fullStyleMethodName ?? config5.fullStyleClassName ?? "Example";
876458
876481
  const class_6 = this.csharp.class_({
876459
- name: config5.fullStyleClassName ?? "Example",
876460
- namespace: "Usage",
876482
+ name: "Examples",
876483
+ namespace: "Examples",
876484
+ partial: true,
876485
+ skipNamespaceDeclaration: true,
876461
876486
  access: ast_exports.Access.Public
876462
876487
  });
876463
876488
  class_6.addNamespaceReference(this.Types.RootClientForSnippets.namespace);
876464
876489
  class_6.addMethod({
876465
- name: "Do",
876490
+ name: methodName,
876466
876491
  access: ast_exports.Access.Public,
876467
876492
  isAsync: true,
876468
876493
  parameters: [],
@@ -877105,18 +877130,16 @@ function convertIr(ir15) {
877105
877130
  }
877106
877131
 
877107
877132
  // ../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>
877133
+ var PROJECT_FILE_CONTENT = `<Project Sdk="Microsoft.NET.Sdk">
877134
+ <PropertyGroup>
877135
+ <TargetFramework>net10.0</TargetFramework>
877136
+ <RootNamespace>Snippets</RootNamespace>
877137
+ <ImplicitUsings>enable</ImplicitUsings>
877138
+ <Nullable>enable</Nullable>
877139
+ </PropertyGroup>
877140
+ <ItemGroup>
877141
+ <ProjectReference Include="..\\**\\*.csproj" Exclude="..\\**\\*.Test.csproj;..\\Snippets\\*.csproj" />
877142
+ </ItemGroup>
877120
877143
  </Project>`;
877121
877144
  var DynamicSnippetsCsharpTestGenerator = class {
877122
877145
  context;
@@ -877145,7 +877168,7 @@ var DynamicSnippetsCsharpTestGenerator = class {
877145
877168
  }
877146
877169
  const response = await this.dynamicSnippetsGenerator.generate(convertedRequest, {
877147
877170
  config: {
877148
- fullStyleClassName: `Example${idx}`
877171
+ fullStyleMethodName: `Example${idx}`
877149
877172
  },
877150
877173
  style: Style2.Full,
877151
877174
  endpointId
@@ -877160,9 +877183,9 @@ var DynamicSnippetsCsharpTestGenerator = class {
877160
877183
  this.context.logger.debug("Done generating dynamic snippet tests");
877161
877184
  }
877162
877185
  async initializeProject(outputDir) {
877163
- const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/SeedApi.DynamicSnippets"));
877186
+ const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
877164
877187
  await (0, import_promises93.mkdir)(absolutePathToOutputDir, { recursive: true });
877165
- await (0, import_promises93.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("SeedApi.DynamicSnippets.csproj")), PROJECT_FILE_CONTENT);
877188
+ await (0, import_promises93.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
877166
877189
  return absolutePathToOutputDir;
877167
877190
  }
877168
877191
  getTestFilePath({ absolutePathToOutputDir, idx }) {
@@ -928934,7 +928957,7 @@ var CliContext = class _CliContext {
928934
928957
  if (false) {
928935
928958
  this.logger.error("CLI_VERSION is not defined");
928936
928959
  }
928937
- return "4.68.0";
928960
+ return "4.68.1-10-g73c0bb83835";
928938
928961
  }
928939
928962
  getCliName() {
928940
928963
  if (false) {
@@ -928990,7 +929013,10 @@ var CliContext = class _CliContext {
928990
929013
  await this.nudgeUpgradeIfAvailable();
928991
929014
  }
928992
929015
  this.ttyAwareLogger.finish();
928993
- await this.posthogManager.flush();
929016
+ try {
929017
+ await this.posthogManager.flush();
929018
+ } catch {
929019
+ }
928994
929020
  await this.sentryClient.flush();
928995
929021
  this.exitProgram({ code: code5 });
928996
929022
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.68.0",
2
+ "version": "4.68.1-10-g73c0bb83835",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",