@fern-api/fern-api-dev 4.87.0 → 4.88.0-2-gac5aef39d7f
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 +367 -168
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -58626,6 +58626,46 @@ var init_ClonedRepository = __esm({
|
|
|
58626
58626
|
const result = await this.git.raw(["rev-parse", "HEAD^{tree}"]);
|
|
58627
58627
|
return result.trim();
|
|
58628
58628
|
}
|
|
58629
|
+
async getHeadCommitMessage() {
|
|
58630
|
+
await this.git.cwd(this.clonePath);
|
|
58631
|
+
const result = await this.git.raw(["log", "-1", "--format=%B", "HEAD"]);
|
|
58632
|
+
return result.replace(/\n$/, "");
|
|
58633
|
+
}
|
|
58634
|
+
async getHeadParents() {
|
|
58635
|
+
await this.git.cwd(this.clonePath);
|
|
58636
|
+
const result = await this.git.raw(["rev-list", "--parents", "-n", "1", "HEAD"]);
|
|
58637
|
+
const parts = result.trim().split(/\s+/);
|
|
58638
|
+
return parts.slice(1);
|
|
58639
|
+
}
|
|
58640
|
+
/**
|
|
58641
|
+
* Pushes a specific object (commit SHA) to a remote ref.
|
|
58642
|
+
* Used to upload tree and blob objects to the remote without moving a branch.
|
|
58643
|
+
*
|
|
58644
|
+
* Pass `force: true` when overwriting a ref that may already point to an
|
|
58645
|
+
* unrelated commit (e.g. retrying a temp ref after a local rebase rewrites
|
|
58646
|
+
* history so the new SHA is not a descendant of the previous one).
|
|
58647
|
+
*/
|
|
58648
|
+
async pushObjectToRef(localSha, remoteRef, { force = false } = {}) {
|
|
58649
|
+
await this.git.cwd(this.clonePath);
|
|
58650
|
+
const spec = force ? `+${localSha}:${remoteRef}` : `${localSha}:${remoteRef}`;
|
|
58651
|
+
await this.git.raw(["push", "origin", spec]);
|
|
58652
|
+
}
|
|
58653
|
+
/**
|
|
58654
|
+
* Resets the current branch HEAD to the given SHA. After fetching a newly-created remote
|
|
58655
|
+
* signed commit, use this to align the local branch so subsequent operations (tag push,
|
|
58656
|
+
* getHeadSha(), etc.) see the signed SHA.
|
|
58657
|
+
*/
|
|
58658
|
+
async resetHardToSha(sha) {
|
|
58659
|
+
await this.git.cwd(this.clonePath);
|
|
58660
|
+
await this.git.raw(["reset", "--hard", sha]);
|
|
58661
|
+
}
|
|
58662
|
+
/**
|
|
58663
|
+
* Rebases the current branch onto the given remote branch (`git pull --rebase origin <branch>`).
|
|
58664
|
+
*/
|
|
58665
|
+
async pullWithRebase(branch) {
|
|
58666
|
+
await this.git.cwd(this.clonePath);
|
|
58667
|
+
await this.git.raw(["pull", "origin", branch, "--rebase"]);
|
|
58668
|
+
}
|
|
58629
58669
|
async getCommitTreeHash(commitSha) {
|
|
58630
58670
|
await this.git.cwd(this.clonePath);
|
|
58631
58671
|
const result = await this.git.raw(["rev-parse", `${commitSha}^{tree}`]);
|
|
@@ -330797,6 +330837,113 @@ ${prBody}`;
|
|
|
330797
330837
|
}
|
|
330798
330838
|
});
|
|
330799
330839
|
|
|
330840
|
+
// ../../generator-cli/lib/pipeline/github/pushSignedCommit.js
|
|
330841
|
+
var require_pushSignedCommit = __commonJS({
|
|
330842
|
+
"../../generator-cli/lib/pipeline/github/pushSignedCommit.js"(exports2) {
|
|
330843
|
+
"use strict";
|
|
330844
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
330845
|
+
exports2.pushSignedCommit = pushSignedCommit;
|
|
330846
|
+
exports2.isNonFastForwardError = isNonFastForwardError;
|
|
330847
|
+
var core_utils_1 = (init_lib4(), __toCommonJS(lib_exports));
|
|
330848
|
+
var MAX_CONCURRENT_PUSH_RETRIES = 3;
|
|
330849
|
+
async function pushSignedCommit({ repository, octokit, owner, repo, branch, force, rebaseOnConflict = false, logger: logger4 }) {
|
|
330850
|
+
const tempRef = `refs/temp/fern-${Date.now()}`;
|
|
330851
|
+
let tempRefPushed = false;
|
|
330852
|
+
try {
|
|
330853
|
+
let [localHeadSha, treeSha, message, parents] = await Promise.all([
|
|
330854
|
+
repository.getHeadSha(),
|
|
330855
|
+
repository.getHeadTreeHash(),
|
|
330856
|
+
repository.getHeadCommitMessage(),
|
|
330857
|
+
repository.getHeadParents()
|
|
330858
|
+
]);
|
|
330859
|
+
await repository.pushObjectToRef(localHeadSha, tempRef);
|
|
330860
|
+
tempRefPushed = true;
|
|
330861
|
+
for (let attempt = 0; attempt < MAX_CONCURRENT_PUSH_RETRIES; attempt++) {
|
|
330862
|
+
const { data: signedCommit } = await octokit.git.createCommit({
|
|
330863
|
+
owner,
|
|
330864
|
+
repo,
|
|
330865
|
+
message,
|
|
330866
|
+
tree: treeSha,
|
|
330867
|
+
parents
|
|
330868
|
+
});
|
|
330869
|
+
const signedSha = signedCommit.sha;
|
|
330870
|
+
try {
|
|
330871
|
+
await upsertBranchRef({ octokit, owner, repo, branch, sha: signedSha, force });
|
|
330872
|
+
logger4.debug(`Updated refs/heads/${branch} to signed commit ${signedSha}`);
|
|
330873
|
+
await syncLocalToSignedCommit({ repository, branch, signedSha });
|
|
330874
|
+
return signedSha;
|
|
330875
|
+
} catch (err) {
|
|
330876
|
+
if (!isNonFastForwardError(err) || force || attempt >= MAX_CONCURRENT_PUSH_RETRIES - 1) {
|
|
330877
|
+
throw err;
|
|
330878
|
+
}
|
|
330879
|
+
if (rebaseOnConflict) {
|
|
330880
|
+
logger4.warn(`Non-fast-forward on refs/heads/${branch} (attempt ${attempt + 1}/${MAX_CONCURRENT_PUSH_RETRIES}); rebasing locally and retrying.`);
|
|
330881
|
+
await repository.pullWithRebase(branch);
|
|
330882
|
+
[localHeadSha, treeSha, message, parents] = await Promise.all([
|
|
330883
|
+
repository.getHeadSha(),
|
|
330884
|
+
repository.getHeadTreeHash(),
|
|
330885
|
+
repository.getHeadCommitMessage(),
|
|
330886
|
+
repository.getHeadParents()
|
|
330887
|
+
]);
|
|
330888
|
+
await repository.pushObjectToRef(localHeadSha, tempRef, { force: true });
|
|
330889
|
+
} else {
|
|
330890
|
+
throw err;
|
|
330891
|
+
}
|
|
330892
|
+
}
|
|
330893
|
+
}
|
|
330894
|
+
throw new Error(`Failed to push signed commit to refs/heads/${branch} after ${MAX_CONCURRENT_PUSH_RETRIES} attempts`);
|
|
330895
|
+
} finally {
|
|
330896
|
+
if (tempRefPushed) {
|
|
330897
|
+
try {
|
|
330898
|
+
await octokit.git.deleteRef({ owner, repo, ref: tempRef.replace(/^refs\//, "") });
|
|
330899
|
+
} catch (err) {
|
|
330900
|
+
logger4.debug(`Failed to delete temp ref ${tempRef}: ${(0, core_utils_1.extractErrorMessage)(err)}`);
|
|
330901
|
+
}
|
|
330902
|
+
}
|
|
330903
|
+
}
|
|
330904
|
+
}
|
|
330905
|
+
async function upsertBranchRef({ octokit, owner, repo, branch, sha, force }) {
|
|
330906
|
+
try {
|
|
330907
|
+
await octokit.git.updateRef({
|
|
330908
|
+
owner,
|
|
330909
|
+
repo,
|
|
330910
|
+
ref: `heads/${branch}`,
|
|
330911
|
+
sha,
|
|
330912
|
+
force
|
|
330913
|
+
});
|
|
330914
|
+
} catch (err) {
|
|
330915
|
+
if (isNotFoundError(err)) {
|
|
330916
|
+
await octokit.git.createRef({
|
|
330917
|
+
owner,
|
|
330918
|
+
repo,
|
|
330919
|
+
ref: `refs/heads/${branch}`,
|
|
330920
|
+
sha
|
|
330921
|
+
});
|
|
330922
|
+
return;
|
|
330923
|
+
}
|
|
330924
|
+
throw err;
|
|
330925
|
+
}
|
|
330926
|
+
}
|
|
330927
|
+
async function syncLocalToSignedCommit({ repository, branch, signedSha }) {
|
|
330928
|
+
await repository.fetch(["origin", branch]);
|
|
330929
|
+
await repository.resetHardToSha(signedSha);
|
|
330930
|
+
}
|
|
330931
|
+
function hasNumericStatus(err) {
|
|
330932
|
+
return typeof err === "object" && err != null && "status" in err && typeof err.status === "number";
|
|
330933
|
+
}
|
|
330934
|
+
function isNotFoundError(err) {
|
|
330935
|
+
return hasNumericStatus(err) && err.status === 404;
|
|
330936
|
+
}
|
|
330937
|
+
function isNonFastForwardError(err) {
|
|
330938
|
+
if (!hasNumericStatus(err) || err.status !== 422) {
|
|
330939
|
+
return false;
|
|
330940
|
+
}
|
|
330941
|
+
const message = (0, core_utils_1.extractErrorMessage)(err).toLowerCase();
|
|
330942
|
+
return message.includes("not a fast forward") || message.includes("not a fast-forward") || message.includes("update is not a fast forward");
|
|
330943
|
+
}
|
|
330944
|
+
}
|
|
330945
|
+
});
|
|
330946
|
+
|
|
330800
330947
|
// ../../generator-cli/lib/pipeline/replay-summary.js
|
|
330801
330948
|
var require_replay_summary = __commonJS({
|
|
330802
330949
|
"../../generator-cli/lib/pipeline/replay-summary.js"(exports2) {
|
|
@@ -330942,6 +331089,7 @@ var require_GithubStep = __commonJS({
|
|
|
330942
331089
|
var createReplayBranch_1 = require_createReplayBranch();
|
|
330943
331090
|
var findExistingUpdatablePR_1 = require_findExistingUpdatablePR();
|
|
330944
331091
|
var parseCommitMessage_1 = require_parseCommitMessage();
|
|
331092
|
+
var pushSignedCommit_1 = require_pushSignedCommit();
|
|
330945
331093
|
var replay_summary_1 = require_replay_summary();
|
|
330946
331094
|
var BaseStep_1 = require_BaseStep();
|
|
330947
331095
|
var GithubStep = class extends BaseStep_1.BaseStep {
|
|
@@ -331049,11 +331197,15 @@ var require_GithubStep = __commonJS({
|
|
|
331049
331197
|
updatedExistingPr: isUpdatingExistingPR
|
|
331050
331198
|
};
|
|
331051
331199
|
if (!this.config.previewMode) {
|
|
331052
|
-
|
|
331053
|
-
|
|
331054
|
-
|
|
331055
|
-
|
|
331056
|
-
|
|
331200
|
+
await (0, pushSignedCommit_1.pushSignedCommit)({
|
|
331201
|
+
repository,
|
|
331202
|
+
octokit,
|
|
331203
|
+
owner,
|
|
331204
|
+
repo,
|
|
331205
|
+
branch: prBranch,
|
|
331206
|
+
force: isUpdatingExistingPR,
|
|
331207
|
+
logger: this.logger
|
|
331208
|
+
});
|
|
331057
331209
|
const pushedBranch = await repository.getCurrentBranch();
|
|
331058
331210
|
result.branchUrl = `https://github.com/${this.config.uri}/tree/${pushedBranch}`;
|
|
331059
331211
|
this.logger.info(`Pushed branch: ${result.branchUrl}`);
|
|
@@ -331154,7 +331306,18 @@ var require_GithubStep = __commonJS({
|
|
|
331154
331306
|
success: true
|
|
331155
331307
|
};
|
|
331156
331308
|
if (!this.config.previewMode) {
|
|
331157
|
-
|
|
331309
|
+
const octokit = new rest_1.Octokit({ auth: this.config.token });
|
|
331310
|
+
const { owner, repo } = (0, github_1.parseRepository)(this.config.uri);
|
|
331311
|
+
await (0, pushSignedCommit_1.pushSignedCommit)({
|
|
331312
|
+
repository,
|
|
331313
|
+
octokit,
|
|
331314
|
+
owner,
|
|
331315
|
+
repo,
|
|
331316
|
+
branch: baseBranch,
|
|
331317
|
+
force: false,
|
|
331318
|
+
rebaseOnConflict: true,
|
|
331319
|
+
logger: this.logger
|
|
331320
|
+
});
|
|
331158
331321
|
const pushedBranch = await repository.getCurrentBranch();
|
|
331159
331322
|
result.branchUrl = `https://github.com/${this.config.uri}/tree/${pushedBranch}`;
|
|
331160
331323
|
this.logger.info(`Pushed branch: ${result.branchUrl}`);
|
|
@@ -615048,7 +615211,7 @@ var AccessTokenPosthogManager = class {
|
|
|
615048
615211
|
properties: {
|
|
615049
615212
|
...event,
|
|
615050
615213
|
...event.properties,
|
|
615051
|
-
version: "4.
|
|
615214
|
+
version: "4.88.0-2-gac5aef39d7f",
|
|
615052
615215
|
usingAccessToken: true
|
|
615053
615216
|
}
|
|
615054
615217
|
});
|
|
@@ -615102,7 +615265,7 @@ var UserPosthogManager = class {
|
|
|
615102
615265
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
615103
615266
|
event: "CLI",
|
|
615104
615267
|
properties: {
|
|
615105
|
-
version: "4.
|
|
615268
|
+
version: "4.88.0-2-gac5aef39d7f",
|
|
615106
615269
|
...event,
|
|
615107
615270
|
...event.properties,
|
|
615108
615271
|
usingAccessToken: false,
|
|
@@ -832624,7 +832787,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
832624
832787
|
var LOGS_FOLDER_NAME = "logs";
|
|
832625
832788
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
832626
832789
|
function getCliSource() {
|
|
832627
|
-
const version7 = "4.
|
|
832790
|
+
const version7 = "4.88.0-2-gac5aef39d7f";
|
|
832628
832791
|
return `cli@${version7}`;
|
|
832629
832792
|
}
|
|
832630
832793
|
var DebugLogger = class {
|
|
@@ -844372,7 +844535,7 @@ var LegacyDocsPublisher = class {
|
|
|
844372
844535
|
previewId,
|
|
844373
844536
|
disableTemplates: void 0,
|
|
844374
844537
|
skipUpload,
|
|
844375
|
-
cliVersion: "4.
|
|
844538
|
+
cliVersion: "4.88.0-2-gac5aef39d7f"
|
|
844376
844539
|
});
|
|
844377
844540
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
844378
844541
|
return { success: false };
|
|
@@ -849036,6 +849199,80 @@ var NopFormatter = class extends AbstractFormatter {
|
|
|
849036
849199
|
}
|
|
849037
849200
|
};
|
|
849038
849201
|
|
|
849202
|
+
// ../../../generators/browser-compatible-base/lib/utils/NameHelpers.js
|
|
849203
|
+
function getWireValue2(input3) {
|
|
849204
|
+
if (typeof input3 === "string") {
|
|
849205
|
+
return input3;
|
|
849206
|
+
}
|
|
849207
|
+
return input3.wireValue;
|
|
849208
|
+
}
|
|
849209
|
+
|
|
849210
|
+
// ../../../generators/browser-compatible-base/lib/utils/CaseConverter.js
|
|
849211
|
+
var CaseConverter = class _CaseConverter {
|
|
849212
|
+
casingsGenerator;
|
|
849213
|
+
constructor(opts) {
|
|
849214
|
+
this.casingsGenerator = constructFullCasingsGenerator(opts);
|
|
849215
|
+
}
|
|
849216
|
+
/**
|
|
849217
|
+
* Creates a CaseConverter for a known generation language.
|
|
849218
|
+
* Keywords are derived automatically from the language's reserved word list.
|
|
849219
|
+
* Use `smartCasing: true` for initialisms (e.g. HTTP → HTTP), `false` for standard casing.
|
|
849220
|
+
*/
|
|
849221
|
+
static fromLanguage(language, smartCasing) {
|
|
849222
|
+
return new _CaseConverter({ generationLanguage: language, keywords: void 0, smartCasing });
|
|
849223
|
+
}
|
|
849224
|
+
// --- Name resolution ---
|
|
849225
|
+
resolve(input3) {
|
|
849226
|
+
return this.casingsGenerator.generateName(input3);
|
|
849227
|
+
}
|
|
849228
|
+
resolveNameOrString(nameOrString) {
|
|
849229
|
+
return this.casingsGenerator.generateName(nameOrString);
|
|
849230
|
+
}
|
|
849231
|
+
resolveNameAndWireValue(input3) {
|
|
849232
|
+
return this.casingsGenerator.generateNameAndWireValue(input3);
|
|
849233
|
+
}
|
|
849234
|
+
// --- camel ---
|
|
849235
|
+
camel(input3) {
|
|
849236
|
+
return this.resolve(input3).camelCase;
|
|
849237
|
+
}
|
|
849238
|
+
camelSafe(input3) {
|
|
849239
|
+
return this.camel(input3).safeName;
|
|
849240
|
+
}
|
|
849241
|
+
camelUnsafe(input3) {
|
|
849242
|
+
return this.camel(input3).unsafeName;
|
|
849243
|
+
}
|
|
849244
|
+
// --- pascal ---
|
|
849245
|
+
pascal(input3) {
|
|
849246
|
+
return this.resolve(input3).pascalCase;
|
|
849247
|
+
}
|
|
849248
|
+
pascalSafe(input3) {
|
|
849249
|
+
return this.pascal(input3).safeName;
|
|
849250
|
+
}
|
|
849251
|
+
pascalUnsafe(input3) {
|
|
849252
|
+
return this.pascal(input3).unsafeName;
|
|
849253
|
+
}
|
|
849254
|
+
// --- snake ---
|
|
849255
|
+
snake(input3) {
|
|
849256
|
+
return this.resolve(input3).snakeCase;
|
|
849257
|
+
}
|
|
849258
|
+
snakeSafe(input3) {
|
|
849259
|
+
return this.snake(input3).safeName;
|
|
849260
|
+
}
|
|
849261
|
+
snakeUnsafe(input3) {
|
|
849262
|
+
return this.snake(input3).unsafeName;
|
|
849263
|
+
}
|
|
849264
|
+
// --- screamingSnake ---
|
|
849265
|
+
screamingSnake(input3) {
|
|
849266
|
+
return this.resolve(input3).screamingSnakeCase;
|
|
849267
|
+
}
|
|
849268
|
+
screamingSnakeSafe(input3) {
|
|
849269
|
+
return this.screamingSnake(input3).safeName;
|
|
849270
|
+
}
|
|
849271
|
+
screamingSnakeUnsafe(input3) {
|
|
849272
|
+
return this.screamingSnake(input3).unsafeName;
|
|
849273
|
+
}
|
|
849274
|
+
};
|
|
849275
|
+
|
|
849039
849276
|
// ../../../generators/browser-compatible-base/lib/utils/getSdkVersion.js
|
|
849040
849277
|
function getSdkVersion(config5) {
|
|
849041
849278
|
return config5.output.mode._visit({
|
|
@@ -860899,80 +861136,6 @@ function sortMethodName(a4, b7) {
|
|
|
860899
861136
|
return 0;
|
|
860900
861137
|
}
|
|
860901
861138
|
|
|
860902
|
-
// ../../../generators/base/lib/utils/NameHelpers.js
|
|
860903
|
-
function getWireValue2(input3) {
|
|
860904
|
-
if (typeof input3 === "string") {
|
|
860905
|
-
return input3;
|
|
860906
|
-
}
|
|
860907
|
-
return input3.wireValue;
|
|
860908
|
-
}
|
|
860909
|
-
|
|
860910
|
-
// ../../../generators/base/lib/utils/CaseConverter.js
|
|
860911
|
-
var CaseConverter = class _CaseConverter {
|
|
860912
|
-
casingsGenerator;
|
|
860913
|
-
constructor(opts) {
|
|
860914
|
-
this.casingsGenerator = constructFullCasingsGenerator(opts);
|
|
860915
|
-
}
|
|
860916
|
-
/**
|
|
860917
|
-
* Creates a CaseConverter for a known generation language.
|
|
860918
|
-
* Keywords are derived automatically from the language's reserved word list.
|
|
860919
|
-
* Use `smartCasing: true` for initialisms (e.g. HTTP → HTTP), `false` for standard casing.
|
|
860920
|
-
*/
|
|
860921
|
-
static fromLanguage(language, smartCasing) {
|
|
860922
|
-
return new _CaseConverter({ generationLanguage: language, keywords: void 0, smartCasing });
|
|
860923
|
-
}
|
|
860924
|
-
// --- Name resolution ---
|
|
860925
|
-
resolve(input3) {
|
|
860926
|
-
return this.casingsGenerator.generateName(input3);
|
|
860927
|
-
}
|
|
860928
|
-
resolveNameOrString(nameOrString) {
|
|
860929
|
-
return this.casingsGenerator.generateName(nameOrString);
|
|
860930
|
-
}
|
|
860931
|
-
resolveNameAndWireValue(input3) {
|
|
860932
|
-
return this.casingsGenerator.generateNameAndWireValue(input3);
|
|
860933
|
-
}
|
|
860934
|
-
// --- camel ---
|
|
860935
|
-
camel(input3) {
|
|
860936
|
-
return this.resolve(input3).camelCase;
|
|
860937
|
-
}
|
|
860938
|
-
camelSafe(input3) {
|
|
860939
|
-
return this.camel(input3).safeName;
|
|
860940
|
-
}
|
|
860941
|
-
camelUnsafe(input3) {
|
|
860942
|
-
return this.camel(input3).unsafeName;
|
|
860943
|
-
}
|
|
860944
|
-
// --- pascal ---
|
|
860945
|
-
pascal(input3) {
|
|
860946
|
-
return this.resolve(input3).pascalCase;
|
|
860947
|
-
}
|
|
860948
|
-
pascalSafe(input3) {
|
|
860949
|
-
return this.pascal(input3).safeName;
|
|
860950
|
-
}
|
|
860951
|
-
pascalUnsafe(input3) {
|
|
860952
|
-
return this.pascal(input3).unsafeName;
|
|
860953
|
-
}
|
|
860954
|
-
// --- snake ---
|
|
860955
|
-
snake(input3) {
|
|
860956
|
-
return this.resolve(input3).snakeCase;
|
|
860957
|
-
}
|
|
860958
|
-
snakeSafe(input3) {
|
|
860959
|
-
return this.snake(input3).safeName;
|
|
860960
|
-
}
|
|
860961
|
-
snakeUnsafe(input3) {
|
|
860962
|
-
return this.snake(input3).unsafeName;
|
|
860963
|
-
}
|
|
860964
|
-
// --- screamingSnake ---
|
|
860965
|
-
screamingSnake(input3) {
|
|
860966
|
-
return this.resolve(input3).screamingSnakeCase;
|
|
860967
|
-
}
|
|
860968
|
-
screamingSnakeSafe(input3) {
|
|
860969
|
-
return this.screamingSnake(input3).safeName;
|
|
860970
|
-
}
|
|
860971
|
-
screamingSnakeUnsafe(input3) {
|
|
860972
|
-
return this.screamingSnake(input3).unsafeName;
|
|
860973
|
-
}
|
|
860974
|
-
};
|
|
860975
|
-
|
|
860976
861139
|
// ../../../generators/csharp/codegen/lib/ast/types/Enum.js
|
|
860977
861140
|
var Enum = class extends Node5 {
|
|
860978
861141
|
get name() {
|
|
@@ -919760,7 +919923,7 @@ var CliContext = class _CliContext {
|
|
|
919760
919923
|
if (false) {
|
|
919761
919924
|
this.logger.error("CLI_VERSION is not defined");
|
|
919762
919925
|
}
|
|
919763
|
-
return "4.
|
|
919926
|
+
return "4.88.0-2-gac5aef39d7f";
|
|
919764
919927
|
}
|
|
919765
919928
|
getCliName() {
|
|
919766
919929
|
if (false) {
|
|
@@ -921480,6 +921643,23 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
921480
921643
|
};
|
|
921481
921644
|
}
|
|
921482
921645
|
|
|
921646
|
+
// src/commands/generate/expandGroupFilter.ts
|
|
921647
|
+
function expandGroupFilter(groupNames, generatorsConfiguration) {
|
|
921648
|
+
if (groupNames == null || groupNames.length === 0) {
|
|
921649
|
+
return null;
|
|
921650
|
+
}
|
|
921651
|
+
const expanded = [];
|
|
921652
|
+
for (const name2 of groupNames) {
|
|
921653
|
+
const aliasGroups = generatorsConfiguration?.groupAliases[name2];
|
|
921654
|
+
for (const resolved of aliasGroups ?? [name2]) {
|
|
921655
|
+
if (!expanded.includes(resolved)) {
|
|
921656
|
+
expanded.push(resolved);
|
|
921657
|
+
}
|
|
921658
|
+
}
|
|
921659
|
+
}
|
|
921660
|
+
return expanded;
|
|
921661
|
+
}
|
|
921662
|
+
|
|
921483
921663
|
// src/commands/generate/generateAPIWorkspace.ts
|
|
921484
921664
|
init_lib6();
|
|
921485
921665
|
|
|
@@ -921540,6 +921720,91 @@ function resolveGroupNamesForGeneration({
|
|
|
921540
921720
|
};
|
|
921541
921721
|
}
|
|
921542
921722
|
|
|
921723
|
+
// src/commands/generate/resolveGroupsOrFail.ts
|
|
921724
|
+
function resolveGroupsOrFail({
|
|
921725
|
+
groupNames,
|
|
921726
|
+
generatorsConfiguration,
|
|
921727
|
+
isAutomation,
|
|
921728
|
+
context: context3
|
|
921729
|
+
}) {
|
|
921730
|
+
if (groupNames == null || groupNames.length === 0) {
|
|
921731
|
+
return resolveSingleGroupOrFail({
|
|
921732
|
+
groupName: void 0,
|
|
921733
|
+
generatorsConfiguration,
|
|
921734
|
+
isAutomation,
|
|
921735
|
+
context: context3
|
|
921736
|
+
});
|
|
921737
|
+
}
|
|
921738
|
+
const resolved = [];
|
|
921739
|
+
for (const groupName of groupNames) {
|
|
921740
|
+
for (const name2 of resolveSingleGroupOrFail({
|
|
921741
|
+
groupName,
|
|
921742
|
+
generatorsConfiguration,
|
|
921743
|
+
isAutomation,
|
|
921744
|
+
context: context3
|
|
921745
|
+
})) {
|
|
921746
|
+
if (!resolved.includes(name2)) {
|
|
921747
|
+
resolved.push(name2);
|
|
921748
|
+
}
|
|
921749
|
+
}
|
|
921750
|
+
}
|
|
921751
|
+
return resolved;
|
|
921752
|
+
}
|
|
921753
|
+
function resolveSingleGroupOrFail({
|
|
921754
|
+
groupName,
|
|
921755
|
+
generatorsConfiguration,
|
|
921756
|
+
isAutomation,
|
|
921757
|
+
context: context3
|
|
921758
|
+
}) {
|
|
921759
|
+
const resolution = resolveGroupNamesForGeneration({ groupName, generatorsConfiguration, isAutomation });
|
|
921760
|
+
if (resolution.type === "fan-out") {
|
|
921761
|
+
return resolution.groupNames;
|
|
921762
|
+
}
|
|
921763
|
+
if (resolution.type === "missing-group") {
|
|
921764
|
+
const longestGroupName = Math.max(...resolution.availableGroupNames.map((name2) => name2.length));
|
|
921765
|
+
const currentArgs = process.argv.slice(2).join(" ");
|
|
921766
|
+
const suggestions = resolution.availableGroupNames.map((name2) => {
|
|
921767
|
+
const suggestedCommand = `fern ${currentArgs} --${GROUP_CLI_OPTION} ${name2}`;
|
|
921768
|
+
return ` \u203A ${source_default.bold(name2.padEnd(longestGroupName))} ${source_default.dim(suggestedCommand)}`;
|
|
921769
|
+
}).join("\n");
|
|
921770
|
+
context3.failAndThrow(
|
|
921771
|
+
`No group specified. Use the --${GROUP_CLI_OPTION} option, or set "${DEFAULT_GROUP_GENERATORS_CONFIG_KEY}" in ${GENERATORS_CONFIGURATION_FILENAME}:
|
|
921772
|
+
${suggestions}`,
|
|
921773
|
+
void 0,
|
|
921774
|
+
{ code: CliError.Code.NetworkError }
|
|
921775
|
+
);
|
|
921776
|
+
return [];
|
|
921777
|
+
}
|
|
921778
|
+
if (resolution.fromDefaultGroup) {
|
|
921779
|
+
context3.logger.info(
|
|
921780
|
+
source_default.dim(`Using default group '${resolution.groupName}' from ${GENERATORS_CONFIGURATION_FILENAME}`)
|
|
921781
|
+
);
|
|
921782
|
+
}
|
|
921783
|
+
const aliasResult = resolveGroupAlias({
|
|
921784
|
+
name: resolution.groupName,
|
|
921785
|
+
groupAliases: generatorsConfiguration.groupAliases,
|
|
921786
|
+
availableGroupNames: generatorsConfiguration.groups.map((g8) => g8.groupName)
|
|
921787
|
+
});
|
|
921788
|
+
if (aliasResult.type === "alias-references-missing-group") {
|
|
921789
|
+
context3.failAndThrow(
|
|
921790
|
+
`Group alias '${aliasResult.alias}' references non-existent group '${aliasResult.missingGroupName}'. Available groups: ${aliasResult.availableGroupNames.join(", ")}`,
|
|
921791
|
+
void 0,
|
|
921792
|
+
{ code: CliError.Code.NetworkError }
|
|
921793
|
+
);
|
|
921794
|
+
return [];
|
|
921795
|
+
}
|
|
921796
|
+
if (aliasResult.type === "unknown") {
|
|
921797
|
+
const aliasesSuffix = aliasResult.availableAliasNames.length > 0 ? `. Available aliases: ${aliasResult.availableAliasNames.join(", ")}` : "";
|
|
921798
|
+
context3.failAndThrow(
|
|
921799
|
+
`'${aliasResult.name}' is not a valid group or alias. Available groups: ${aliasResult.availableGroupNames.join(", ")}${aliasesSuffix}`,
|
|
921800
|
+
void 0,
|
|
921801
|
+
{ code: CliError.Code.NetworkError }
|
|
921802
|
+
);
|
|
921803
|
+
return [];
|
|
921804
|
+
}
|
|
921805
|
+
return aliasResult.groupNames;
|
|
921806
|
+
}
|
|
921807
|
+
|
|
921543
921808
|
// src/commands/generate/describeSkipReason.ts
|
|
921544
921809
|
function describeSkipReason(generator, rootAutorelease) {
|
|
921545
921810
|
if (!generator.automation.generate) {
|
|
@@ -921614,7 +921879,7 @@ async function generateWorkspace({
|
|
|
921614
921879
|
workspace,
|
|
921615
921880
|
projectConfig,
|
|
921616
921881
|
context: context3,
|
|
921617
|
-
|
|
921882
|
+
groupNames,
|
|
921618
921883
|
generatorName,
|
|
921619
921884
|
generatorIndex,
|
|
921620
921885
|
version: version7,
|
|
@@ -921647,7 +921912,7 @@ async function generateWorkspace({
|
|
|
921647
921912
|
return;
|
|
921648
921913
|
}
|
|
921649
921914
|
const resolvedGroupNames = resolveGroupsOrFail({
|
|
921650
|
-
|
|
921915
|
+
groupNames,
|
|
921651
921916
|
generatorsConfiguration: workspace.generatorsConfiguration,
|
|
921652
921917
|
isAutomation: automation != null,
|
|
921653
921918
|
context: context3
|
|
@@ -921790,60 +922055,6 @@ function resolveRunnableGroup({
|
|
|
921790
922055
|
}
|
|
921791
922056
|
return group;
|
|
921792
922057
|
}
|
|
921793
|
-
function resolveGroupsOrFail({
|
|
921794
|
-
groupName,
|
|
921795
|
-
generatorsConfiguration,
|
|
921796
|
-
isAutomation,
|
|
921797
|
-
context: context3
|
|
921798
|
-
}) {
|
|
921799
|
-
const resolution = resolveGroupNamesForGeneration({ groupName, generatorsConfiguration, isAutomation });
|
|
921800
|
-
if (resolution.type === "fan-out") {
|
|
921801
|
-
return resolution.groupNames;
|
|
921802
|
-
}
|
|
921803
|
-
if (resolution.type === "missing-group") {
|
|
921804
|
-
const longestGroupName = Math.max(...resolution.availableGroupNames.map((name2) => name2.length));
|
|
921805
|
-
const currentArgs = process.argv.slice(2).join(" ");
|
|
921806
|
-
const suggestions = resolution.availableGroupNames.map((name2) => {
|
|
921807
|
-
const suggestedCommand = `fern ${currentArgs} --${GROUP_CLI_OPTION} ${name2}`;
|
|
921808
|
-
return ` \u203A ${source_default.bold(name2.padEnd(longestGroupName))} ${source_default.dim(suggestedCommand)}`;
|
|
921809
|
-
}).join("\n");
|
|
921810
|
-
context3.failAndThrow(
|
|
921811
|
-
`No group specified. Use the --${GROUP_CLI_OPTION} option, or set "${DEFAULT_GROUP_GENERATORS_CONFIG_KEY}" in ${GENERATORS_CONFIGURATION_FILENAME}:
|
|
921812
|
-
${suggestions}`,
|
|
921813
|
-
void 0,
|
|
921814
|
-
{ code: CliError.Code.NetworkError }
|
|
921815
|
-
);
|
|
921816
|
-
return [];
|
|
921817
|
-
}
|
|
921818
|
-
if (resolution.fromDefaultGroup) {
|
|
921819
|
-
context3.logger.info(
|
|
921820
|
-
source_default.dim(`Using default group '${resolution.groupName}' from ${GENERATORS_CONFIGURATION_FILENAME}`)
|
|
921821
|
-
);
|
|
921822
|
-
}
|
|
921823
|
-
const aliasResult = resolveGroupAlias({
|
|
921824
|
-
name: resolution.groupName,
|
|
921825
|
-
groupAliases: generatorsConfiguration.groupAliases,
|
|
921826
|
-
availableGroupNames: generatorsConfiguration.groups.map((g8) => g8.groupName)
|
|
921827
|
-
});
|
|
921828
|
-
if (aliasResult.type === "alias-references-missing-group") {
|
|
921829
|
-
context3.failAndThrow(
|
|
921830
|
-
`Group alias '${aliasResult.alias}' references non-existent group '${aliasResult.missingGroupName}'. Available groups: ${aliasResult.availableGroupNames.join(", ")}`,
|
|
921831
|
-
void 0,
|
|
921832
|
-
{ code: CliError.Code.NetworkError }
|
|
921833
|
-
);
|
|
921834
|
-
return [];
|
|
921835
|
-
}
|
|
921836
|
-
if (aliasResult.type === "unknown") {
|
|
921837
|
-
const aliasesSuffix = aliasResult.availableAliasNames.length > 0 ? `. Available aliases: ${aliasResult.availableAliasNames.join(", ")}` : "";
|
|
921838
|
-
context3.failAndThrow(
|
|
921839
|
-
`'${aliasResult.name}' is not a valid group or alias. Available groups: ${aliasResult.availableGroupNames.join(", ")}${aliasesSuffix}`,
|
|
921840
|
-
void 0,
|
|
921841
|
-
{ code: CliError.Code.NetworkError }
|
|
921842
|
-
);
|
|
921843
|
-
return [];
|
|
921844
|
-
}
|
|
921845
|
-
return aliasResult.groupNames;
|
|
921846
|
-
}
|
|
921847
922058
|
function applyLfsOverride(group, lfsOverridePath, context3) {
|
|
921848
922059
|
const baseAbsolutePath = AbsoluteFilePath2.of(resolve6(cwd(), lfsOverridePath));
|
|
921849
922060
|
const languageCount = {};
|
|
@@ -921933,7 +922144,7 @@ async function generateAPIWorkspaces({
|
|
|
921933
922144
|
project,
|
|
921934
922145
|
cliContext,
|
|
921935
922146
|
version: version7,
|
|
921936
|
-
|
|
922147
|
+
groupNames,
|
|
921937
922148
|
generatorName,
|
|
921938
922149
|
generatorIndex,
|
|
921939
922150
|
shouldLogS3Url,
|
|
@@ -921975,7 +922186,7 @@ async function generateAPIWorkspaces({
|
|
|
921975
922186
|
}
|
|
921976
922187
|
await confirmOutputDirectoriesForEligibleGenerators({
|
|
921977
922188
|
project,
|
|
921978
|
-
|
|
922189
|
+
groupNames,
|
|
921979
922190
|
generatorName,
|
|
921980
922191
|
generatorIndex,
|
|
921981
922192
|
automation,
|
|
@@ -921986,7 +922197,7 @@ async function generateAPIWorkspaces({
|
|
|
921986
922197
|
orgId: project.config.organization,
|
|
921987
922198
|
command: resolvePosthogCommandLabel(automation),
|
|
921988
922199
|
properties: {
|
|
921989
|
-
workspaces: buildPosthogWorkspaces({ project,
|
|
922200
|
+
workspaces: buildPosthogWorkspaces({ project, groupNames, generatorName })
|
|
921990
922201
|
}
|
|
921991
922202
|
});
|
|
921992
922203
|
await Promise.all(
|
|
@@ -922002,7 +922213,7 @@ async function generateAPIWorkspaces({
|
|
|
922002
922213
|
projectConfig: project.config,
|
|
922003
922214
|
context: context3,
|
|
922004
922215
|
version: version7,
|
|
922005
|
-
|
|
922216
|
+
groupNames,
|
|
922006
922217
|
generatorName,
|
|
922007
922218
|
generatorIndex,
|
|
922008
922219
|
shouldLogS3Url,
|
|
@@ -922031,7 +922242,7 @@ async function generateAPIWorkspaces({
|
|
|
922031
922242
|
}
|
|
922032
922243
|
async function confirmOutputDirectoriesForEligibleGenerators({
|
|
922033
922244
|
project,
|
|
922034
|
-
|
|
922245
|
+
groupNames,
|
|
922035
922246
|
generatorName,
|
|
922036
922247
|
generatorIndex,
|
|
922037
922248
|
automation,
|
|
@@ -922039,7 +922250,7 @@ async function confirmOutputDirectoriesForEligibleGenerators({
|
|
|
922039
922250
|
force
|
|
922040
922251
|
}) {
|
|
922041
922252
|
for (const workspace of project.apiWorkspaces) {
|
|
922042
|
-
const resolvedGroupNames = expandGroupFilter(
|
|
922253
|
+
const resolvedGroupNames = expandGroupFilter(groupNames, workspace.generatorsConfiguration);
|
|
922043
922254
|
const rootAutorelease = workspace.generatorsConfiguration?.rawConfiguration.autorelease;
|
|
922044
922255
|
const groupsInScope = workspace.generatorsConfiguration?.groups.filter(
|
|
922045
922256
|
(group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)
|
|
@@ -922072,14 +922283,14 @@ async function confirmOutputDirectoriesForEligibleGenerators({
|
|
|
922072
922283
|
}
|
|
922073
922284
|
function buildPosthogWorkspaces({
|
|
922074
922285
|
project,
|
|
922075
|
-
|
|
922286
|
+
groupNames,
|
|
922076
922287
|
generatorName
|
|
922077
922288
|
}) {
|
|
922078
922289
|
return project.apiWorkspaces.map((workspace) => {
|
|
922079
|
-
const resolvedGroupNames = expandGroupFilter(
|
|
922290
|
+
const resolvedGroupNames = expandGroupFilter(groupNames, workspace.generatorsConfiguration);
|
|
922080
922291
|
return {
|
|
922081
922292
|
name: workspace.workspaceName,
|
|
922082
|
-
group:
|
|
922293
|
+
group: groupNames != null && groupNames.length === 1 ? groupNames[0] : groupNames,
|
|
922083
922294
|
generators: workspace.generatorsConfiguration?.groups.filter((group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)).map(
|
|
922084
922295
|
(group) => group.generators.filter((generator) => generatorName == null || generator.name === generatorName).map((generator) => ({
|
|
922085
922296
|
name: generator.name,
|
|
@@ -922091,19 +922302,6 @@ function buildPosthogWorkspaces({
|
|
|
922091
922302
|
};
|
|
922092
922303
|
});
|
|
922093
922304
|
}
|
|
922094
|
-
function expandGroupFilter(groupName, generatorsConfiguration) {
|
|
922095
|
-
if (groupName == null) {
|
|
922096
|
-
return null;
|
|
922097
|
-
}
|
|
922098
|
-
if (generatorsConfiguration == null) {
|
|
922099
|
-
return [groupName];
|
|
922100
|
-
}
|
|
922101
|
-
const aliasGroups = generatorsConfiguration.groupAliases[groupName];
|
|
922102
|
-
if (aliasGroups != null) {
|
|
922103
|
-
return aliasGroups;
|
|
922104
|
-
}
|
|
922105
|
-
return [groupName];
|
|
922106
|
-
}
|
|
922107
922305
|
|
|
922108
922306
|
// src/commands/automations/generate/GeneratorRunResult.ts
|
|
922109
922307
|
function countResults(results) {
|
|
@@ -922296,7 +922494,7 @@ async function executeAutomationsGenerate({
|
|
|
922296
922494
|
}),
|
|
922297
922495
|
cliContext,
|
|
922298
922496
|
version: options2.version,
|
|
922299
|
-
|
|
922497
|
+
groupNames: options2.group != null ? [options2.group] : void 0,
|
|
922300
922498
|
generatorName,
|
|
922301
922499
|
generatorIndex,
|
|
922302
922500
|
shouldLogS3Url: false,
|
|
@@ -939371,7 +939569,8 @@ function addGenerateCommand2(cli, cliContext) {
|
|
|
939371
939569
|
description: "A stable identifier for the preview. Reusing the same ID overwrites the previous preview, keeping the URL stable."
|
|
939372
939570
|
}).option("group", {
|
|
939373
939571
|
type: "string",
|
|
939374
|
-
|
|
939572
|
+
array: true,
|
|
939573
|
+
description: "The group to generate. Pass --group multiple times to generate for several groups at once."
|
|
939375
939574
|
}).option("generator", {
|
|
939376
939575
|
type: "string",
|
|
939377
939576
|
description: "The name of a specific generator to run"
|
|
@@ -939552,7 +939751,7 @@ function addGenerateCommand2(cli, cliContext) {
|
|
|
939552
939751
|
}),
|
|
939553
939752
|
cliContext,
|
|
939554
939753
|
version: argv.version,
|
|
939555
|
-
|
|
939754
|
+
groupNames: argv.group,
|
|
939556
939755
|
generatorName,
|
|
939557
939756
|
generatorIndex,
|
|
939558
939757
|
shouldLogS3Url: argv.printZipUrl,
|
|
@@ -939575,7 +939774,7 @@ function addGenerateCommand2(cli, cliContext) {
|
|
|
939575
939774
|
});
|
|
939576
939775
|
}
|
|
939577
939776
|
if (argv.docs != null) {
|
|
939578
|
-
if (argv.group != null) {
|
|
939777
|
+
if (argv.group != null && argv.group.length > 0) {
|
|
939579
939778
|
cliContext.logger.warn("--group is ignored when generating docs");
|
|
939580
939779
|
}
|
|
939581
939780
|
if (argv.generator != null) {
|
|
@@ -939612,7 +939811,7 @@ function addGenerateCommand2(cli, cliContext) {
|
|
|
939612
939811
|
}),
|
|
939613
939812
|
cliContext,
|
|
939614
939813
|
version: argv.version,
|
|
939615
|
-
|
|
939814
|
+
groupNames: argv.group,
|
|
939616
939815
|
generatorName,
|
|
939617
939816
|
generatorIndex,
|
|
939618
939817
|
shouldLogS3Url: argv.printZipUrl,
|
package/package.json
CHANGED