@fern-api/fern-api-dev 4.67.1-2-g977810b1542 → 4.67.1-5-g6f7f6d50210

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 +44 -36
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -627553,7 +627553,7 @@ var AccessTokenPosthogManager = class {
627553
627553
  properties: {
627554
627554
  ...event,
627555
627555
  ...event.properties,
627556
- version: "4.67.1-2-g977810b1542",
627556
+ version: "4.67.1-5-g6f7f6d50210",
627557
627557
  usingAccessToken: true
627558
627558
  }
627559
627559
  });
@@ -627604,7 +627604,7 @@ var UserPosthogManager = class {
627604
627604
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
627605
627605
  event: "CLI",
627606
627606
  properties: {
627607
- version: "4.67.1-2-g977810b1542",
627607
+ version: "4.67.1-5-g6f7f6d50210",
627608
627608
  ...event,
627609
627609
  ...event.properties,
627610
627610
  usingAccessToken: false,
@@ -631028,13 +631028,18 @@ var import_path46 = require("path");
631028
631028
  var Version2 = "*";
631029
631029
 
631030
631030
  // ../cli-v2/lib/telemetry/TelemetryClient.js
631031
- var TelemetryClient = class {
631031
+ var TelemetryClient = class _TelemetryClient {
631032
631032
  posthog;
631033
631033
  sentry;
631034
631034
  baseTags;
631035
631035
  accumulatedTags = {};
631036
- cachedDistinctId;
631037
- constructor({ isTTY }) {
631036
+ distinctId;
631037
+ static async create({ isTTY }) {
631038
+ const distinctId = await _TelemetryClient.getDistinctId();
631039
+ return new _TelemetryClient({ isTTY, distinctId });
631040
+ }
631041
+ constructor({ isTTY, distinctId }) {
631042
+ this.distinctId = distinctId;
631038
631043
  const isTelemetryEnabled = this.isTelemetryEnabled();
631039
631044
  const apiKey = null;
631040
631045
  this.baseTags = {
@@ -631064,13 +631069,13 @@ var TelemetryClient = class {
631064
631069
  }
631065
631070
  }
631066
631071
  /** Send a named event that inherits base + accumulated properties. */
631067
- async sendEvent(event, tags) {
631072
+ sendEvent(event, tags) {
631068
631073
  if (this.posthog == null) {
631069
631074
  return;
631070
631075
  }
631071
631076
  try {
631072
631077
  this.posthog.capture({
631073
- distinctId: await this.getDistinctId(),
631078
+ distinctId: this.distinctId,
631074
631079
  event,
631075
631080
  properties: { ...this.baseTags, ...this.accumulatedTags, ...tags }
631076
631081
  });
@@ -631081,13 +631086,13 @@ var TelemetryClient = class {
631081
631086
  *
631082
631087
  * This is not meant to be called directly by command handlers.
631083
631088
  */
631084
- async sendLifecycleEvent(event) {
631089
+ sendLifecycleEvent(event) {
631085
631090
  if (this.posthog == null) {
631086
631091
  return;
631087
631092
  }
631088
631093
  try {
631089
631094
  this.posthog.capture({
631090
- distinctId: await this.getDistinctId(),
631095
+ distinctId: this.distinctId,
631091
631096
  event: "cli",
631092
631097
  properties: {
631093
631098
  ...this.baseTags,
@@ -631108,14 +631113,14 @@ var TelemetryClient = class {
631108
631113
  * The caller is responsible for deciding which errors are worth reporting
631109
631114
  * (see `shouldReportToSentry` in withContext.ts).
631110
631115
  */
631111
- async captureException(error50) {
631116
+ captureException(error50) {
631112
631117
  if (this.sentry === void 0) {
631113
631118
  return;
631114
631119
  }
631115
631120
  try {
631116
631121
  this.sentry.captureException(error50, {
631117
631122
  captureContext: {
631118
- user: { id: await this.getDistinctId() },
631123
+ user: { id: this.distinctId },
631119
631124
  tags: { ...this.baseTags, ...this.accumulatedTags }
631120
631125
  }
631121
631126
  });
@@ -631132,30 +631137,28 @@ var TelemetryClient = class {
631132
631137
  }
631133
631138
  await Promise.all(promises);
631134
631139
  }
631135
- async getDistinctId() {
631136
- if (this.cachedDistinctId != null) {
631137
- return this.cachedDistinctId;
631138
- }
631139
- const distinctIdFilepath = this.getDistinctIdFilepath();
631140
+ static async getDistinctId() {
631141
+ const distinctIdFilepath = _TelemetryClient.getDistinctIdFilepath();
631142
+ let distinctId = null;
631140
631143
  try {
631141
631144
  if (!await doesPathExist(distinctIdFilepath)) {
631142
631145
  await (0, import_promises49.mkdir)((0, import_path46.dirname)(distinctIdFilepath), { recursive: true });
631143
631146
  await (0, import_promises49.writeFile)(distinctIdFilepath, v4_default(), { flag: "wx" });
631144
631147
  }
631145
631148
  const content5 = (await (0, import_promises49.readFile)(distinctIdFilepath)).toString().trim();
631146
- this.cachedDistinctId = content5;
631149
+ distinctId = content5;
631147
631150
  if (!validate_default(content5)) {
631148
631151
  const newId = v4_default();
631149
631152
  await (0, import_promises49.writeFile)(distinctIdFilepath, newId);
631150
- this.cachedDistinctId = newId;
631153
+ distinctId = newId;
631151
631154
  }
631152
631155
  } catch {
631153
- this.cachedDistinctId = v4_default();
631156
+ distinctId = v4_default();
631154
631157
  }
631155
- if (this.cachedDistinctId == null || this.cachedDistinctId.length === 0) {
631156
- this.cachedDistinctId = v4_default();
631158
+ if (distinctId == null || distinctId.length === 0) {
631159
+ distinctId = v4_default();
631157
631160
  }
631158
- return this.cachedDistinctId;
631161
+ return distinctId;
631159
631162
  }
631160
631163
  /**
631161
631164
  * The file that stores the distinct ID for the user (stored in ~/.fern/id).
@@ -631163,7 +631166,7 @@ var TelemetryClient = class {
631163
631166
  * Note that all telemetry is anonymous, but we still use a shared distinct ID
631164
631167
  * to correlate metrics from the same user/machine across multiple CLI invocations.
631165
631168
  */
631166
- getDistinctIdFilepath() {
631169
+ static getDistinctIdFilepath() {
631167
631170
  return join8(AbsoluteFilePath2.of((0, import_os8.homedir)()), RelativeFilePath2.of(".fern"), RelativeFilePath2.of("id"));
631168
631171
  }
631169
631172
  /**
@@ -632011,7 +632014,7 @@ ${"=".repeat(60)}
632011
632014
  };
632012
632015
 
632013
632016
  // ../cli-v2/lib/context/Context.js
632014
- var Context = class {
632017
+ var Context = class _Context {
632015
632018
  shutdownCallbacks = [];
632016
632019
  isShuttingDown = false;
632017
632020
  logFilePathPrinted = false;
@@ -632025,7 +632028,12 @@ var Context = class {
632025
632028
  telemetry;
632026
632029
  tokenService;
632027
632030
  ttyAwareLogger;
632028
- constructor({ stdout, stderr, cwd: cwd2, logLevel }) {
632031
+ static async create({ stdout, stderr, cwd: cwd2, logLevel }) {
632032
+ const ttyAwareLogger = new TtyAwareLogger(stdout, stderr);
632033
+ const telemetry = await TelemetryClient.create({ isTTY: ttyAwareLogger.isTTY });
632034
+ return new _Context({ stdout, stderr, cwd: cwd2, logLevel, ttyAwareLogger, telemetry });
632035
+ }
632036
+ constructor({ cwd: cwd2, logLevel, ttyAwareLogger, telemetry }) {
632029
632037
  this.cwd = cwd2 ?? AbsoluteFilePath2.of(process.cwd());
632030
632038
  this.logLevel = logLevel ?? LogLevel2.Info;
632031
632039
  this.info = parseCommandInfo(process.argv);
@@ -632033,8 +632041,8 @@ var Context = class {
632033
632041
  this.stderr = createLogger4((level, ...args) => this.logStderr(level, ...args));
632034
632042
  this.cache = new Cache({ logger: this.stderr });
632035
632043
  this.logs = new LogFileWriter(this.cache.logs.absoluteFilePath);
632036
- this.ttyAwareLogger = new TtyAwareLogger(stdout, stderr);
632037
- this.telemetry = new TelemetryClient({ isTTY: this.isTTY });
632044
+ this.ttyAwareLogger = ttyAwareLogger;
632045
+ this.telemetry = telemetry;
632038
632046
  this.tokenService = new TokenService({ credential: new CredentialStore() });
632039
632047
  }
632040
632048
  /**
@@ -632274,12 +632282,12 @@ var SIGINT_EXIT_CODE = SIGNAL_EXIT_CODE_BASE + 2;
632274
632282
  var SIGTERM_EXIT_CODE = SIGNAL_EXIT_CODE_BASE + 15;
632275
632283
  function withContext(handler3) {
632276
632284
  return async (args) => {
632277
- const context3 = createContext(args);
632285
+ const context3 = await createContext(args);
632278
632286
  const startTime = Date.now();
632279
632287
  setupSignalHandler(context3);
632280
632288
  try {
632281
632289
  await handler3(context3, args);
632282
- await context3.telemetry.sendLifecycleEvent({
632290
+ context3.telemetry.sendLifecycleEvent({
632283
632291
  command: context3.info.command,
632284
632292
  status: "success",
632285
632293
  durationMs: Date.now() - startTime
@@ -632289,9 +632297,9 @@ function withContext(handler3) {
632289
632297
  await exitGracefully(0);
632290
632298
  } catch (error50) {
632291
632299
  if (shouldReportToSentry(error50)) {
632292
- await context3.telemetry.captureException(error50);
632300
+ context3.telemetry.captureException(error50);
632293
632301
  }
632294
- await context3.telemetry.sendLifecycleEvent({
632302
+ context3.telemetry.sendLifecycleEvent({
632295
632303
  command: context3.info.command,
632296
632304
  status: "error",
632297
632305
  durationMs: Date.now() - startTime,
@@ -632304,9 +632312,9 @@ function withContext(handler3) {
632304
632312
  }
632305
632313
  };
632306
632314
  }
632307
- function createContext(options2) {
632315
+ async function createContext(options2) {
632308
632316
  const logLevel = parseLogLevel(options2["log-level"] ?? "info");
632309
- return new Context({
632317
+ return Context.create({
632310
632318
  stdout: process.stdout,
632311
632319
  stderr: process.stderr,
632312
632320
  logLevel
@@ -843865,7 +843873,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
843865
843873
  var LOGS_FOLDER_NAME = "logs";
843866
843874
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
843867
843875
  function getCliSource() {
843868
- const version7 = "4.67.1-2-g977810b1542";
843876
+ const version7 = "4.67.1-5-g6f7f6d50210";
843869
843877
  return `cli@${version7}`;
843870
843878
  }
843871
843879
  var DebugLogger = class {
@@ -855113,7 +855121,7 @@ var LegacyDocsPublisher = class {
855113
855121
  previewId,
855114
855122
  disableTemplates: void 0,
855115
855123
  skipUpload,
855116
- cliVersion: "4.67.1-2-g977810b1542"
855124
+ cliVersion: "4.67.1-5-g6f7f6d50210"
855117
855125
  });
855118
855126
  if (taskContext.getResult() === TaskResult.Failure) {
855119
855127
  return { success: false };
@@ -928855,7 +928863,7 @@ var CliContext = class _CliContext {
928855
928863
  if (false) {
928856
928864
  this.logger.error("CLI_VERSION is not defined");
928857
928865
  }
928858
- return "4.67.1-2-g977810b1542";
928866
+ return "4.67.1-5-g6f7f6d50210";
928859
928867
  }
928860
928868
  getCliName() {
928861
928869
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.67.1-2-g977810b1542",
2
+ "version": "4.67.1-5-g6f7f6d50210",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",