@fern-api/fern-api-dev 5.27.0 → 5.27.2
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.
- package/cli.cjs +125 -40
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -25319,7 +25319,17 @@ function errnoCode(error50) {
|
|
|
25319
25319
|
return void 0;
|
|
25320
25320
|
}
|
|
25321
25321
|
const code5 = error50.code;
|
|
25322
|
-
|
|
25322
|
+
if (typeof code5 === "string") {
|
|
25323
|
+
return code5;
|
|
25324
|
+
}
|
|
25325
|
+
const cause = error50.cause;
|
|
25326
|
+
if (cause instanceof Error) {
|
|
25327
|
+
const causeCode = cause.code;
|
|
25328
|
+
if (typeof causeCode === "string") {
|
|
25329
|
+
return causeCode;
|
|
25330
|
+
}
|
|
25331
|
+
}
|
|
25332
|
+
return void 0;
|
|
25323
25333
|
}
|
|
25324
25334
|
function resolveErrorCode(error50, explicitCode) {
|
|
25325
25335
|
if (explicitCode != null) {
|
|
@@ -25433,7 +25443,9 @@ var init_CliError = __esm({
|
|
|
25433
25443
|
"EMFILE",
|
|
25434
25444
|
"ENFILE",
|
|
25435
25445
|
"EBUSY",
|
|
25436
|
-
"EADDRINUSE"
|
|
25446
|
+
"EADDRINUSE",
|
|
25447
|
+
"ENOTEMPTY",
|
|
25448
|
+
"ENOMEM"
|
|
25437
25449
|
]);
|
|
25438
25450
|
NETWORK_ERRNOS = /* @__PURE__ */ new Set([
|
|
25439
25451
|
"ENOTFOUND",
|
|
@@ -667931,7 +667943,7 @@ var AccessTokenPosthogManager = class {
|
|
|
667931
667943
|
properties: {
|
|
667932
667944
|
...event,
|
|
667933
667945
|
...event.properties,
|
|
667934
|
-
version: "5.27.
|
|
667946
|
+
version: "5.27.2",
|
|
667935
667947
|
usingAccessToken: true,
|
|
667936
667948
|
...getRunIdProperties()
|
|
667937
667949
|
}
|
|
@@ -667995,7 +668007,7 @@ var UserPosthogManager = class {
|
|
|
667995
668007
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
667996
668008
|
event: "CLI",
|
|
667997
668009
|
properties: {
|
|
667998
|
-
version: "5.27.
|
|
668010
|
+
version: "5.27.2",
|
|
667999
668011
|
...event,
|
|
668000
668012
|
...event.properties,
|
|
668001
668013
|
usingAccessToken: false,
|
|
@@ -859567,7 +859579,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
859567
859579
|
var LOGS_FOLDER_NAME = "logs";
|
|
859568
859580
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
859569
859581
|
function getCliSource() {
|
|
859570
|
-
const version7 = "5.27.
|
|
859582
|
+
const version7 = "5.27.2";
|
|
859571
859583
|
return `cli@${version7}`;
|
|
859572
859584
|
}
|
|
859573
859585
|
var DebugLogger = class {
|
|
@@ -871673,13 +871685,22 @@ var SourceUploader = class {
|
|
|
871673
871685
|
async uploadSource(source2, uploadURL) {
|
|
871674
871686
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
871675
871687
|
const fileData = await (0, import_promises100.readFile)(uploadCommand.absoluteFilePath);
|
|
871676
|
-
|
|
871677
|
-
|
|
871678
|
-
|
|
871679
|
-
|
|
871680
|
-
|
|
871681
|
-
|
|
871682
|
-
|
|
871688
|
+
let response;
|
|
871689
|
+
try {
|
|
871690
|
+
response = await fetch(uploadURL, {
|
|
871691
|
+
method: "PUT",
|
|
871692
|
+
body: fileData,
|
|
871693
|
+
headers: {
|
|
871694
|
+
"Content-Type": "application/octet-stream"
|
|
871695
|
+
}
|
|
871696
|
+
});
|
|
871697
|
+
} catch (error50) {
|
|
871698
|
+
await uploadCommand.cleanup();
|
|
871699
|
+
this.context.failAndThrow(`Network error uploading source file: ${source2.absoluteFilePath}`, error50, {
|
|
871700
|
+
code: CliError.Code.NetworkError
|
|
871701
|
+
});
|
|
871702
|
+
return;
|
|
871703
|
+
}
|
|
871683
871704
|
await uploadCommand.cleanup();
|
|
871684
871705
|
if (!response.ok) {
|
|
871685
871706
|
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}`, void 0, { code: CliError.Code.NetworkError });
|
|
@@ -872075,18 +872096,22 @@ async function uploadDynamicIRForSdkGeneration({ fdr, organization, version: ver
|
|
|
872075
872096
|
generatorConfig: dynamicGeneratorConfig
|
|
872076
872097
|
});
|
|
872077
872098
|
const dynamicIRJson = JSON.stringify(dynamicIR);
|
|
872078
|
-
|
|
872079
|
-
|
|
872080
|
-
|
|
872081
|
-
|
|
872082
|
-
|
|
872083
|
-
|
|
872099
|
+
try {
|
|
872100
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
872101
|
+
method: "PUT",
|
|
872102
|
+
body: dynamicIRJson,
|
|
872103
|
+
headers: {
|
|
872104
|
+
"Content-Type": "application/octet-stream",
|
|
872105
|
+
"Content-Length": dynamicIRJson.length.toString()
|
|
872106
|
+
}
|
|
872107
|
+
});
|
|
872108
|
+
if (uploadResponse.ok) {
|
|
872109
|
+
context3.logger.debug(`Uploaded dynamic IR for ${language}:${packageName} (${version7})`);
|
|
872110
|
+
} else {
|
|
872111
|
+
context3.logger.warn(`Failed to upload dynamic IR for ${language}: ${uploadResponse.status}`);
|
|
872084
872112
|
}
|
|
872085
|
-
})
|
|
872086
|
-
|
|
872087
|
-
context3.logger.debug(`Uploaded dynamic IR for ${language}:${packageName} (${version7})`);
|
|
872088
|
-
} else {
|
|
872089
|
-
context3.logger.warn(`Failed to upload dynamic IR for ${language}: ${uploadResponse.status}`);
|
|
872113
|
+
} catch (error50) {
|
|
872114
|
+
context3.logger.warn(`Network error uploading dynamic IR for ${language}: ${error50}`);
|
|
872090
872115
|
}
|
|
872091
872116
|
}
|
|
872092
872117
|
function resolveVersionFallback(resolvedVersion) {
|
|
@@ -873337,18 +873362,22 @@ async function uploadDynamicIRs({ dynamicIRs, dynamicIRUploadUrls, context: cont
|
|
|
873337
873362
|
const dynamicIR = dynamicIRs[language]?.dynamicIR;
|
|
873338
873363
|
if (dynamicIR) {
|
|
873339
873364
|
const jsonBody = JSON.stringify(dynamicIR);
|
|
873340
|
-
|
|
873341
|
-
|
|
873342
|
-
|
|
873343
|
-
|
|
873344
|
-
|
|
873345
|
-
|
|
873365
|
+
try {
|
|
873366
|
+
const response = await fetch(source2.uploadUrl, {
|
|
873367
|
+
method: "PUT",
|
|
873368
|
+
body: jsonBody,
|
|
873369
|
+
headers: {
|
|
873370
|
+
"Content-Type": "application/octet-stream",
|
|
873371
|
+
"Content-Length": Buffer.byteLength(jsonBody, "utf8").toString()
|
|
873372
|
+
}
|
|
873373
|
+
});
|
|
873374
|
+
if (response.ok) {
|
|
873375
|
+
context3.logger.debug(`Uploaded dynamic IR for ${apiId}:${language}`);
|
|
873376
|
+
} else {
|
|
873377
|
+
context3.logger.warn(`Failed to upload dynamic IR for ${apiId}:${language}`);
|
|
873346
873378
|
}
|
|
873347
|
-
})
|
|
873348
|
-
|
|
873349
|
-
context3.logger.debug(`Uploaded dynamic IR for ${apiId}:${language}`);
|
|
873350
|
-
} else {
|
|
873351
|
-
context3.logger.warn(`Failed to upload dynamic IR for ${apiId}:${language}`);
|
|
873379
|
+
} catch (error50) {
|
|
873380
|
+
context3.logger.warn(`Network error uploading dynamic IR for ${apiId}:${language}: ${error50}`);
|
|
873352
873381
|
}
|
|
873353
873382
|
} else {
|
|
873354
873383
|
context3.logger.warn(`Could not find matching dynamic IR to upload for ${apiId}:${language}`);
|
|
@@ -873540,7 +873569,7 @@ var LegacyDocsPublisher = class {
|
|
|
873540
873569
|
previewId,
|
|
873541
873570
|
disableTemplates: void 0,
|
|
873542
873571
|
skipUpload,
|
|
873543
|
-
cliVersion: "5.27.
|
|
873572
|
+
cliVersion: "5.27.2",
|
|
873544
873573
|
loginCommand: "fern auth login"
|
|
873545
873574
|
});
|
|
873546
873575
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -947945,7 +947974,7 @@ function getAutomationContextFromEnv() {
|
|
|
947945
947974
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
947946
947975
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
947947
947976
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
947948
|
-
cli_version: "5.27.
|
|
947977
|
+
cli_version: "5.27.2"
|
|
947949
947978
|
};
|
|
947950
947979
|
}
|
|
947951
947980
|
function isAutomationMode() {
|
|
@@ -948065,12 +948094,26 @@ function isTelemetryDisabled() {
|
|
|
948065
948094
|
return process.env.FERN_DISABLE_TELEMETRY === "true";
|
|
948066
948095
|
}
|
|
948067
948096
|
|
|
948097
|
+
// src/telemetry/shouldInitializeTelemetry.ts
|
|
948098
|
+
function shouldInitializeTelemetry({
|
|
948099
|
+
cliName,
|
|
948100
|
+
packageVersion: packageVersion3,
|
|
948101
|
+
isLocal
|
|
948102
|
+
}) {
|
|
948103
|
+
if (isTelemetryDisabled() || isLocal) {
|
|
948104
|
+
return false;
|
|
948105
|
+
}
|
|
948106
|
+
const isLocalDev = packageVersion3 === "0.0.0";
|
|
948107
|
+
const isProductionCli = cliName === "fern" && false;
|
|
948108
|
+
return !isLocalDev && isProductionCli;
|
|
948109
|
+
}
|
|
948110
|
+
|
|
948068
948111
|
// src/telemetry/SentryClient.ts
|
|
948069
948112
|
var SentryClient = class {
|
|
948070
948113
|
sentry;
|
|
948071
|
-
constructor({ release: release2 }) {
|
|
948114
|
+
constructor({ release: release2, telemetry }) {
|
|
948072
948115
|
const sentryDsn = "https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";
|
|
948073
|
-
if (
|
|
948116
|
+
if (shouldInitializeTelemetry(telemetry) && sentryDsn != null && sentryDsn.length > 0) {
|
|
948074
948117
|
const sentryEnvironment = "development";
|
|
948075
948118
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
948076
948119
|
throw new CliError({
|
|
@@ -948737,7 +948780,14 @@ var CliContext = class _CliContext {
|
|
|
948737
948780
|
packageVersion: packageVersion3,
|
|
948738
948781
|
cliName
|
|
948739
948782
|
};
|
|
948740
|
-
this.sentryClient = new SentryClient({
|
|
948783
|
+
this.sentryClient = new SentryClient({
|
|
948784
|
+
release: `cli@${this.environment.packageVersion}`,
|
|
948785
|
+
telemetry: {
|
|
948786
|
+
cliName: this.environment.cliName,
|
|
948787
|
+
packageVersion: this.environment.packageVersion,
|
|
948788
|
+
isLocal: this.isLocal
|
|
948789
|
+
}
|
|
948790
|
+
});
|
|
948741
948791
|
this.automationTelemetryManager = new AutomationTelemetryManager(this);
|
|
948742
948792
|
}
|
|
948743
948793
|
getPackageName() {
|
|
@@ -948750,7 +948800,7 @@ var CliContext = class _CliContext {
|
|
|
948750
948800
|
if (false) {
|
|
948751
948801
|
this.logger.error("CLI_VERSION is not defined");
|
|
948752
948802
|
}
|
|
948753
|
-
return "5.27.
|
|
948803
|
+
return "5.27.2";
|
|
948754
948804
|
}
|
|
948755
948805
|
getCliName() {
|
|
948756
948806
|
if (false) {
|
|
@@ -968129,6 +968179,40 @@ function evaluateRuntime4() {
|
|
|
968129
968179
|
};
|
|
968130
968180
|
}
|
|
968131
968181
|
|
|
968182
|
+
// src/telemetry/processHandlers.ts
|
|
968183
|
+
init_lib6();
|
|
968184
|
+
function installProcessHandlers(cliContext, { isLocal }) {
|
|
968185
|
+
if (!shouldInitializeTelemetry({
|
|
968186
|
+
cliName: cliContext.environment.cliName,
|
|
968187
|
+
packageVersion: cliContext.environment.packageVersion,
|
|
968188
|
+
isLocal
|
|
968189
|
+
})) {
|
|
968190
|
+
return;
|
|
968191
|
+
}
|
|
968192
|
+
let isHandlingFatal = false;
|
|
968193
|
+
const handleFatal = async (label, error50) => {
|
|
968194
|
+
if (isHandlingFatal) {
|
|
968195
|
+
process.exit(1);
|
|
968196
|
+
}
|
|
968197
|
+
isHandlingFatal = true;
|
|
968198
|
+
try {
|
|
968199
|
+
cliContext.failWithoutThrowing(label, error50, { code: CliError.Code.InternalError });
|
|
968200
|
+
} catch {
|
|
968201
|
+
}
|
|
968202
|
+
try {
|
|
968203
|
+
await cliContext.exit({ code: 1 });
|
|
968204
|
+
} catch {
|
|
968205
|
+
process.exit(1);
|
|
968206
|
+
}
|
|
968207
|
+
};
|
|
968208
|
+
process.on("uncaughtException", (error50) => {
|
|
968209
|
+
void handleFatal("uncaught exception", error50);
|
|
968210
|
+
});
|
|
968211
|
+
process.on("unhandledRejection", (reason) => {
|
|
968212
|
+
void handleFatal("unhandled promise rejection", reason);
|
|
968213
|
+
});
|
|
968214
|
+
}
|
|
968215
|
+
|
|
968132
968216
|
// src/cli.ts
|
|
968133
968217
|
if (process.platform === "linux" && parseInt(process.versions.node.split(".")[0] ?? "0", 10) >= 26 && process.env.UV_USE_IO_URING !== "0") {
|
|
968134
968218
|
const result = (0, import_node_child_process7.spawnSync)(process.execPath, process.argv.slice(1), {
|
|
@@ -968151,6 +968235,7 @@ async function runCli() {
|
|
|
968151
968235
|
if (isCompletion) {
|
|
968152
968236
|
cliContext.suppressUpgradeMessage();
|
|
968153
968237
|
}
|
|
968238
|
+
installProcessHandlers(cliContext, { isLocal });
|
|
968154
968239
|
const exit3 = async () => {
|
|
968155
968240
|
await cliContext.exit();
|
|
968156
968241
|
};
|
package/package.json
CHANGED