@fern-api/fern-api-dev 5.65.5 → 5.65.6
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 +84 -27
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -89377,6 +89377,26 @@ var init_ClonedRepository = __esm({
|
|
|
89377
89377
|
const result = await this.git.raw(["rev-parse", `${commitSha}^{tree}`]);
|
|
89378
89378
|
return result.trim();
|
|
89379
89379
|
}
|
|
89380
|
+
async getCommitMessage(commitSha) {
|
|
89381
|
+
await this.git.cwd(this.clonePath);
|
|
89382
|
+
const result = await this.git.raw(["log", "-1", "--format=%B", commitSha]);
|
|
89383
|
+
return result.replace(/\n$/, "");
|
|
89384
|
+
}
|
|
89385
|
+
async getCommitParents(commitSha) {
|
|
89386
|
+
await this.git.cwd(this.clonePath);
|
|
89387
|
+
const result = await this.git.raw(["rev-list", "--parents", "-n", "1", commitSha]);
|
|
89388
|
+
const parts = result.trim().split(/\s+/);
|
|
89389
|
+
return parts.slice(1);
|
|
89390
|
+
}
|
|
89391
|
+
/**
|
|
89392
|
+
* Returns the SHAs of commits reachable from HEAD but not from any remote-tracking ref,
|
|
89393
|
+
* ordered oldest-first. These are the commits created locally that have not been pushed.
|
|
89394
|
+
*/
|
|
89395
|
+
async getLocalOnlyCommits() {
|
|
89396
|
+
await this.git.cwd(this.clonePath);
|
|
89397
|
+
const result = await this.git.raw(["rev-list", "--reverse", "HEAD", "--not", "--remotes=origin"]);
|
|
89398
|
+
return result.trim().split("\n").filter((line) => line.length > 0);
|
|
89399
|
+
}
|
|
89380
89400
|
/**
|
|
89381
89401
|
* Returns true if the working tree has uncommitted changes (staged or unstaged).
|
|
89382
89402
|
*/
|
|
@@ -581439,29 +581459,24 @@ var require_pushSignedCommit = __commonJS({
|
|
|
581439
581459
|
exports2.isNonFastForwardError = isNonFastForwardError;
|
|
581440
581460
|
var core_utils_1 = (init_lib4(), __toCommonJS(lib_exports));
|
|
581441
581461
|
var MAX_CONCURRENT_PUSH_RETRIES = 3;
|
|
581462
|
+
var MAX_SIGNED_CHAIN_LENGTH = 20;
|
|
581442
581463
|
async function pushSignedCommit({ repository, octokit, owner, repo, branch, force, rebaseOnConflict = false, author, logger: logger4 }) {
|
|
581443
581464
|
const tempRef = `refs/temp/fern-${Date.now()}`;
|
|
581444
581465
|
let tempRefPushed = false;
|
|
581445
581466
|
try {
|
|
581446
|
-
let
|
|
581447
|
-
repository.getHeadSha(),
|
|
581448
|
-
repository.getHeadTreeHash(),
|
|
581449
|
-
repository.getHeadCommitMessage(),
|
|
581450
|
-
repository.getHeadParents()
|
|
581451
|
-
]);
|
|
581467
|
+
let localHeadSha = await repository.getHeadSha();
|
|
581452
581468
|
await repository.pushObjectToRef(localHeadSha, tempRef);
|
|
581453
581469
|
tempRefPushed = true;
|
|
581454
581470
|
for (let attempt = 0; attempt < MAX_CONCURRENT_PUSH_RETRIES; attempt++) {
|
|
581455
|
-
const
|
|
581456
|
-
|
|
581471
|
+
const signedSha = await signLocalCommitChain({
|
|
581472
|
+
repository,
|
|
581473
|
+
octokit,
|
|
581457
581474
|
owner,
|
|
581458
581475
|
repo,
|
|
581459
|
-
|
|
581460
|
-
|
|
581461
|
-
|
|
581462
|
-
...identityFields
|
|
581476
|
+
localHeadSha,
|
|
581477
|
+
author,
|
|
581478
|
+
logger: logger4
|
|
581463
581479
|
});
|
|
581464
|
-
const signedSha = signedCommit.sha;
|
|
581465
581480
|
try {
|
|
581466
581481
|
await upsertBranchRef({ octokit, owner, repo, branch, sha: signedSha, force });
|
|
581467
581482
|
logger4.debug(`Updated refs/heads/${branch} to signed commit ${signedSha}`);
|
|
@@ -581474,12 +581489,7 @@ var require_pushSignedCommit = __commonJS({
|
|
|
581474
581489
|
if (rebaseOnConflict) {
|
|
581475
581490
|
logger4.warn(`Non-fast-forward on refs/heads/${branch} (attempt ${attempt + 1}/${MAX_CONCURRENT_PUSH_RETRIES}); rebasing locally and retrying.`);
|
|
581476
581491
|
await repository.pullWithRebase(branch);
|
|
581477
|
-
|
|
581478
|
-
repository.getHeadSha(),
|
|
581479
|
-
repository.getHeadTreeHash(),
|
|
581480
|
-
repository.getHeadCommitMessage(),
|
|
581481
|
-
repository.getHeadParents()
|
|
581482
|
-
]);
|
|
581492
|
+
localHeadSha = await repository.getHeadSha();
|
|
581483
581493
|
await repository.pushObjectToRef(localHeadSha, tempRef, { force: true });
|
|
581484
581494
|
} else {
|
|
581485
581495
|
throw err;
|
|
@@ -581497,6 +581507,39 @@ var require_pushSignedCommit = __commonJS({
|
|
|
581497
581507
|
}
|
|
581498
581508
|
}
|
|
581499
581509
|
}
|
|
581510
|
+
async function signLocalCommitChain({ repository, octokit, owner, repo, localHeadSha, author, logger: logger4 }) {
|
|
581511
|
+
let chain = await repository.getLocalOnlyCommits();
|
|
581512
|
+
if (chain.length === 0 || chain[chain.length - 1] !== localHeadSha) {
|
|
581513
|
+
chain = [localHeadSha];
|
|
581514
|
+
} else if (chain.length > MAX_SIGNED_CHAIN_LENGTH) {
|
|
581515
|
+
logger4.warn(`Local commit chain has ${chain.length} commits (limit ${MAX_SIGNED_CHAIN_LENGTH}); signing HEAD only.`);
|
|
581516
|
+
chain = [localHeadSha];
|
|
581517
|
+
}
|
|
581518
|
+
const identityFields = author != null ? { author, committer: author } : {};
|
|
581519
|
+
const signedShaByLocalSha = /* @__PURE__ */ new Map();
|
|
581520
|
+
let signedSha = localHeadSha;
|
|
581521
|
+
for (const sha of chain) {
|
|
581522
|
+
const [treeSha, message, parents] = await Promise.all([
|
|
581523
|
+
repository.getCommitTreeHash(sha),
|
|
581524
|
+
repository.getCommitMessage(sha),
|
|
581525
|
+
repository.getCommitParents(sha)
|
|
581526
|
+
]);
|
|
581527
|
+
const { data: signedCommit } = await octokit.git.createCommit({
|
|
581528
|
+
owner,
|
|
581529
|
+
repo,
|
|
581530
|
+
message,
|
|
581531
|
+
tree: treeSha,
|
|
581532
|
+
parents: parents.map((parent) => signedShaByLocalSha.get(parent) ?? parent),
|
|
581533
|
+
...identityFields
|
|
581534
|
+
});
|
|
581535
|
+
signedShaByLocalSha.set(sha, signedCommit.sha);
|
|
581536
|
+
signedSha = signedCommit.sha;
|
|
581537
|
+
}
|
|
581538
|
+
if (chain.length > 1) {
|
|
581539
|
+
logger4.debug(`Signed ${chain.length} local commits via the GitHub API`);
|
|
581540
|
+
}
|
|
581541
|
+
return signedSha;
|
|
581542
|
+
}
|
|
581500
581543
|
async function upsertBranchRef({ octokit, owner, repo, branch, sha, force }) {
|
|
581501
581544
|
try {
|
|
581502
581545
|
await octokit.git.updateRef({
|
|
@@ -688596,7 +688639,7 @@ var AccessTokenPosthogManager = class {
|
|
|
688596
688639
|
properties: {
|
|
688597
688640
|
...event,
|
|
688598
688641
|
...event.properties,
|
|
688599
|
-
version: "5.65.
|
|
688642
|
+
version: "5.65.6",
|
|
688600
688643
|
usingAccessToken: true,
|
|
688601
688644
|
...getRunIdProperties()
|
|
688602
688645
|
}
|
|
@@ -688662,7 +688705,7 @@ var UserPosthogManager = class {
|
|
|
688662
688705
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
688663
688706
|
event: "CLI",
|
|
688664
688707
|
properties: {
|
|
688665
|
-
version: "5.65.
|
|
688708
|
+
version: "5.65.6",
|
|
688666
688709
|
...event,
|
|
688667
688710
|
...event.properties,
|
|
688668
688711
|
usingAccessToken: false,
|
|
@@ -869758,7 +869801,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
869758
869801
|
var LOGS_FOLDER_NAME = "logs";
|
|
869759
869802
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
869760
869803
|
function getCliSource() {
|
|
869761
|
-
const version7 = "5.65.
|
|
869804
|
+
const version7 = "5.65.6";
|
|
869762
869805
|
return `cli@${version7}`;
|
|
869763
869806
|
}
|
|
869764
869807
|
var DebugLogger = class {
|
|
@@ -902320,7 +902363,7 @@ var LegacyDocsPublisher = class {
|
|
|
902320
902363
|
previewId,
|
|
902321
902364
|
disableTemplates: void 0,
|
|
902322
902365
|
skipUpload,
|
|
902323
|
-
cliVersion: "5.65.
|
|
902366
|
+
cliVersion: "5.65.6",
|
|
902324
902367
|
loginCommand: "fern auth login"
|
|
902325
902368
|
});
|
|
902326
902369
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -921898,8 +921941,22 @@ var Generation = class {
|
|
|
921898
921941
|
maxRetries: () => this.customConfig.maxRetries,
|
|
921899
921942
|
/** Controls which HTTP status codes trigger automatic retries. Default: "legacy". */
|
|
921900
921943
|
retryStatusCodes: () => this.customConfig.retryStatusCodes ?? "legacy",
|
|
921901
|
-
/**
|
|
921902
|
-
|
|
921944
|
+
/**
|
|
921945
|
+
* Override the default request timeout (in milliseconds) for the generated SDK client. `"infinity"` disables
|
|
921946
|
+
* the default timeout. Resolves the new `default-timeout-in-milliseconds` key when set, otherwise falls back
|
|
921947
|
+
* to the deprecated `default-timeout-in-seconds` (converted to milliseconds). Default: 30000.
|
|
921948
|
+
*/
|
|
921949
|
+
defaultTimeoutInMilliseconds: () => {
|
|
921950
|
+
const milliseconds = this.customConfig["default-timeout-in-milliseconds"];
|
|
921951
|
+
if (milliseconds != null) {
|
|
921952
|
+
return milliseconds;
|
|
921953
|
+
}
|
|
921954
|
+
const seconds = this.customConfig["default-timeout-in-seconds"];
|
|
921955
|
+
if (seconds == null) {
|
|
921956
|
+
return void 0;
|
|
921957
|
+
}
|
|
921958
|
+
return seconds === "infinity" ? "infinity" : seconds * 1e3;
|
|
921959
|
+
},
|
|
921903
921960
|
/**
|
|
921904
921961
|
* Output path configuration for generated files.
|
|
921905
921962
|
* Returns normalized paths for library, test, solution, and other files.
|
|
@@ -968630,7 +968687,7 @@ function getAutomationContextFromEnv() {
|
|
|
968630
968687
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
968631
968688
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
968632
968689
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
968633
|
-
cli_version: "5.65.
|
|
968690
|
+
cli_version: "5.65.6"
|
|
968634
968691
|
};
|
|
968635
968692
|
}
|
|
968636
968693
|
function isAutomationMode() {
|
|
@@ -969462,7 +969519,7 @@ var CliContext = class _CliContext {
|
|
|
969462
969519
|
if (false) {
|
|
969463
969520
|
this.logger.error("CLI_VERSION is not defined");
|
|
969464
969521
|
}
|
|
969465
|
-
return "5.65.
|
|
969522
|
+
return "5.65.6";
|
|
969466
969523
|
}
|
|
969467
969524
|
getCliName() {
|
|
969468
969525
|
if (false) {
|
package/package.json
CHANGED