@fern-api/fern-api-dev 4.107.0 → 4.107.2-1-g488c64ae1ff
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 +375 -111
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -340394,9 +340394,9 @@ var require_diff3 = __commonJS({
|
|
|
340394
340394
|
}
|
|
340395
340395
|
});
|
|
340396
340396
|
|
|
340397
|
-
// ../../../node_modules/.pnpm/@fern-api+replay@0.
|
|
340397
|
+
// ../../../node_modules/.pnpm/@fern-api+replay@0.13.0/node_modules/@fern-api/replay/dist/index.cjs
|
|
340398
340398
|
var require_dist14 = __commonJS({
|
|
340399
|
-
"../../../node_modules/.pnpm/@fern-api+replay@0.
|
|
340399
|
+
"../../../node_modules/.pnpm/@fern-api+replay@0.13.0/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
|
|
340400
340400
|
"use strict";
|
|
340401
340401
|
var __defProp4 = Object.defineProperty;
|
|
340402
340402
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -341136,17 +341136,57 @@ var require_dist14 = __commonJS({
|
|
|
341136
341136
|
}
|
|
341137
341137
|
const isAncestor = await this.git.isAncestor(lastGen.commit_sha, "HEAD");
|
|
341138
341138
|
if (!isAncestor) {
|
|
341139
|
+
return this.detectPatchesViaMergeBase(lastGen, lock);
|
|
341140
|
+
}
|
|
341141
|
+
return this.detectPatchesInRange(lastGen.commit_sha, lastGen, lock);
|
|
341142
|
+
}
|
|
341143
|
+
/**
|
|
341144
|
+
* FER-10201 — Non-linear-history detection via `merge-base(prevGen, HEAD)`.
|
|
341145
|
+
*
|
|
341146
|
+
* After a squash-merge of a Fern-bot PR, `lastGen.commit_sha` (the previous
|
|
341147
|
+
* `[fern-generated]`) is orphaned but still in git's object database. The
|
|
341148
|
+
* merge-base is the commit on main from which the bot's branch was created —
|
|
341149
|
+
* a reachable ancestor of HEAD. Walking that range and classifying each
|
|
341150
|
+
* commit via `isGenerationCommit` mirrors the linear path and eliminates
|
|
341151
|
+
* the bug class where pipeline-driven changes (autoversion, replay,
|
|
341152
|
+
* generation) get bundled as customer customizations.
|
|
341153
|
+
*
|
|
341154
|
+
* Falls through to the legacy composite path when no common ancestor exists
|
|
341155
|
+
* (truly disjoint history — orphan branches with no shared root).
|
|
341156
|
+
*/
|
|
341157
|
+
async detectPatchesViaMergeBase(lastGen, lock) {
|
|
341158
|
+
let mergeBase = "";
|
|
341159
|
+
try {
|
|
341160
|
+
mergeBase = (await this.git.exec(["merge-base", lastGen.commit_sha, "HEAD"])).trim();
|
|
341161
|
+
} catch {
|
|
341162
|
+
}
|
|
341163
|
+
if (!mergeBase) {
|
|
341164
|
+
this.warnings.push(
|
|
341165
|
+
`No common ancestor between previous generation ${lastGen.commit_sha.slice(0, 7)} and HEAD. Falling back to composite tree-diff detection.`
|
|
341166
|
+
);
|
|
341139
341167
|
return this.detectPatchesViaTreeDiff(
|
|
341140
341168
|
lastGen,
|
|
341141
341169
|
/* commitKnownMissing */
|
|
341142
341170
|
false
|
|
341143
341171
|
);
|
|
341144
341172
|
}
|
|
341173
|
+
return this.detectPatchesInRange(mergeBase, lastGen, lock);
|
|
341174
|
+
}
|
|
341175
|
+
/**
|
|
341176
|
+
* FER-10201 — Walk `${rangeStart}..HEAD`, classify each commit, emit one
|
|
341177
|
+
* `StoredPatch` per customer commit. Body shared by the linear path
|
|
341178
|
+
* (rangeStart = lastGen.commit_sha) and the merge-base path.
|
|
341179
|
+
*
|
|
341180
|
+
* Patch `base_generation` is always `lastGen.commit_sha` — the
|
|
341181
|
+
* lockfile-tracked reference the applicator uses to fetch base file
|
|
341182
|
+
* content, regardless of where the walk actually started.
|
|
341183
|
+
*/
|
|
341184
|
+
async detectPatchesInRange(rangeStart, lastGen, lock) {
|
|
341145
341185
|
const log4 = await this.git.exec([
|
|
341146
341186
|
"log",
|
|
341147
341187
|
"--first-parent",
|
|
341148
341188
|
"--format=%H%x00%an%x00%ae%x00%s",
|
|
341149
|
-
`${
|
|
341189
|
+
`${rangeStart}..HEAD`,
|
|
341150
341190
|
"--",
|
|
341151
341191
|
this.sdkOutputDir
|
|
341152
341192
|
]);
|
|
@@ -477410,7 +477450,8 @@ var USER_ENVIRONMENT_ERRNOS = /* @__PURE__ */ new Set([
|
|
|
477410
477450
|
"EROFS",
|
|
477411
477451
|
"EMFILE",
|
|
477412
477452
|
"ENFILE",
|
|
477413
|
-
"EBUSY"
|
|
477453
|
+
"EBUSY",
|
|
477454
|
+
"EADDRINUSE"
|
|
477414
477455
|
]);
|
|
477415
477456
|
var NETWORK_ERRNOS = /* @__PURE__ */ new Set([
|
|
477416
477457
|
"ENOTFOUND",
|
|
@@ -543570,6 +543611,7 @@ function parseVariantOverlays(variants) {
|
|
|
543570
543611
|
}
|
|
543571
543612
|
|
|
543572
543613
|
// ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
|
|
543614
|
+
init_lib4();
|
|
543573
543615
|
init_lib6();
|
|
543574
543616
|
var import_promises15 = require("fs/promises");
|
|
543575
543617
|
|
|
@@ -543584,7 +543626,15 @@ var ProjectConfigSchema = external_exports2.strictObject({
|
|
|
543584
543626
|
async function loadProjectConfig({ directory, context: context3 }) {
|
|
543585
543627
|
const pathToConfig = join8(directory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME));
|
|
543586
543628
|
const projectConfigStr = await (0, import_promises15.readFile)(pathToConfig);
|
|
543587
|
-
|
|
543629
|
+
let projectConfigParsed;
|
|
543630
|
+
try {
|
|
543631
|
+
projectConfigParsed = JSON.parse(projectConfigStr.toString());
|
|
543632
|
+
} catch (error50) {
|
|
543633
|
+
throw new CliError({
|
|
543634
|
+
message: `Failed to parse ${PROJECT_CONFIG_FILENAME}: ${extractErrorMessage(error50)}`,
|
|
543635
|
+
code: CliError.Code.ParseError
|
|
543636
|
+
});
|
|
543637
|
+
}
|
|
543588
543638
|
const rawProjectConfig = await validateSchema({
|
|
543589
543639
|
schema: ProjectConfigSchema,
|
|
543590
543640
|
value: projectConfigParsed,
|
|
@@ -599468,6 +599518,9 @@ async function parseOpenAPI({ absolutePathToOpenAPI, absolutePathToOpenAPIOverri
|
|
|
599468
599518
|
`Continuing without full reference resolution.`
|
|
599469
599519
|
].join("\n"));
|
|
599470
599520
|
}
|
|
599521
|
+
if (circularRefs.length > 0) {
|
|
599522
|
+
breakCircularRefCycles(document4, circularRefs);
|
|
599523
|
+
}
|
|
599471
599524
|
return document4;
|
|
599472
599525
|
}
|
|
599473
599526
|
throw error50;
|
|
@@ -599481,6 +599534,50 @@ async function readAndParseFile2(absoluteFilePath) {
|
|
|
599481
599534
|
}
|
|
599482
599535
|
return jsYaml.load(contents);
|
|
599483
599536
|
}
|
|
599537
|
+
function breakCircularRefCycles(document4, circularRefs) {
|
|
599538
|
+
if (typeof document4 !== "object" || document4 == null) {
|
|
599539
|
+
return;
|
|
599540
|
+
}
|
|
599541
|
+
const backEdgeRefs = /* @__PURE__ */ new Set();
|
|
599542
|
+
for (const info of circularRefs) {
|
|
599543
|
+
if (info.ref.startsWith("#/")) {
|
|
599544
|
+
backEdgeRefs.add(info.ref);
|
|
599545
|
+
}
|
|
599546
|
+
}
|
|
599547
|
+
replaceCircularRefs(document4, backEdgeRefs);
|
|
599548
|
+
}
|
|
599549
|
+
function replaceCircularRefs(obj, targets2) {
|
|
599550
|
+
if (typeof obj !== "object" || obj == null) {
|
|
599551
|
+
return;
|
|
599552
|
+
}
|
|
599553
|
+
if (Array.isArray(obj)) {
|
|
599554
|
+
for (let i9 = 0; i9 < obj.length; i9++) {
|
|
599555
|
+
const item = obj[i9];
|
|
599556
|
+
if (isCircularRefObject(item, targets2)) {
|
|
599557
|
+
obj[i9] = { type: "object", "x-fern-circular-ref": true };
|
|
599558
|
+
} else {
|
|
599559
|
+
replaceCircularRefs(item, targets2);
|
|
599560
|
+
}
|
|
599561
|
+
}
|
|
599562
|
+
return;
|
|
599563
|
+
}
|
|
599564
|
+
const record22 = obj;
|
|
599565
|
+
for (const key2 of Object.keys(record22)) {
|
|
599566
|
+
const value2 = record22[key2];
|
|
599567
|
+
if (isCircularRefObject(value2, targets2)) {
|
|
599568
|
+
record22[key2] = { type: "object", "x-fern-circular-ref": true };
|
|
599569
|
+
} else {
|
|
599570
|
+
replaceCircularRefs(value2, targets2);
|
|
599571
|
+
}
|
|
599572
|
+
}
|
|
599573
|
+
}
|
|
599574
|
+
function isCircularRefObject(value2, targets2) {
|
|
599575
|
+
if (typeof value2 !== "object" || value2 == null || Array.isArray(value2)) {
|
|
599576
|
+
return false;
|
|
599577
|
+
}
|
|
599578
|
+
const record22 = value2;
|
|
599579
|
+
return typeof record22.$ref === "string" && targets2.has(record22.$ref);
|
|
599580
|
+
}
|
|
599484
599581
|
|
|
599485
599582
|
// ../workspace/lazy-fern-workspace/lib/utils/resolveDescriptionMarkdownRefs.js
|
|
599486
599583
|
init_lib4();
|
|
@@ -612683,6 +612780,16 @@ function collapseSpecBooleanSetting(specs, getter) {
|
|
|
612683
612780
|
}
|
|
612684
612781
|
return values2.every((v9) => v9 == null || v9 === true);
|
|
612685
612782
|
}
|
|
612783
|
+
function toRelativePath(raw, field5) {
|
|
612784
|
+
try {
|
|
612785
|
+
return RelativeFilePath2.of(raw);
|
|
612786
|
+
} catch {
|
|
612787
|
+
throw new CliError({
|
|
612788
|
+
message: `"${field5}: ${raw}" must be a relative path, not an absolute one.`,
|
|
612789
|
+
code: CliError.Code.ConfigError
|
|
612790
|
+
});
|
|
612791
|
+
}
|
|
612792
|
+
}
|
|
612686
612793
|
function convertRemoveDiscriminantsFromSchemas(specs) {
|
|
612687
612794
|
if (specs.every((spec) => spec.settings?.removeDiscriminantsFromSchemas === generators_yml_exports.RemoveDiscriminantsFromSchemas.Never)) {
|
|
612688
612795
|
return generators_yml_exports.RemoveDiscriminantsFromSchemas.Never;
|
|
@@ -613078,20 +613185,20 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
613078
613185
|
const specs = [];
|
|
613079
613186
|
for (const spec of specsOverride) {
|
|
613080
613187
|
if (generators_yml_exports.isOpenApiSpecSchema(spec)) {
|
|
613081
|
-
const absoluteFilepath = join8(this.absoluteFilePath,
|
|
613188
|
+
const absoluteFilepath = join8(this.absoluteFilePath, toRelativePath(spec.openapi, "openapi"));
|
|
613082
613189
|
let absoluteFilepathToOverrides;
|
|
613083
613190
|
const specOverridePaths = [];
|
|
613084
613191
|
if (spec.overrides != null) {
|
|
613085
613192
|
if (Array.isArray(spec.overrides)) {
|
|
613086
|
-
specOverridePaths.push(...spec.overrides.map((override) => join8(this.absoluteFilePath,
|
|
613193
|
+
specOverridePaths.push(...spec.overrides.map((override) => join8(this.absoluteFilePath, toRelativePath(override, "overrides"))));
|
|
613087
613194
|
} else {
|
|
613088
|
-
specOverridePaths.push(join8(this.absoluteFilePath,
|
|
613195
|
+
specOverridePaths.push(join8(this.absoluteFilePath, toRelativePath(spec.overrides, "overrides")));
|
|
613089
613196
|
}
|
|
613090
613197
|
}
|
|
613091
613198
|
if (specOverridePaths.length > 0) {
|
|
613092
613199
|
absoluteFilepathToOverrides = specOverridePaths.length === 1 ? specOverridePaths[0] : specOverridePaths;
|
|
613093
613200
|
}
|
|
613094
|
-
const absoluteFilepathToOverlays = spec.overlays ? join8(this.absoluteFilePath,
|
|
613201
|
+
const absoluteFilepathToOverlays = spec.overlays ? join8(this.absoluteFilePath, toRelativePath(spec.overlays, "overlays")) : void 0;
|
|
613095
613202
|
const openApiSpec = {
|
|
613096
613203
|
type: "openapi",
|
|
613097
613204
|
absoluteFilepath,
|
|
@@ -621265,7 +621372,7 @@ var AccessTokenPosthogManager = class {
|
|
|
621265
621372
|
properties: {
|
|
621266
621373
|
...event,
|
|
621267
621374
|
...event.properties,
|
|
621268
|
-
version: "4.107.
|
|
621375
|
+
version: "4.107.2-1-g488c64ae1ff",
|
|
621269
621376
|
usingAccessToken: true
|
|
621270
621377
|
}
|
|
621271
621378
|
});
|
|
@@ -621319,7 +621426,7 @@ var UserPosthogManager = class {
|
|
|
621319
621426
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
621320
621427
|
event: "CLI",
|
|
621321
621428
|
properties: {
|
|
621322
|
-
version: "4.107.
|
|
621429
|
+
version: "4.107.2-1-g488c64ae1ff",
|
|
621323
621430
|
...event,
|
|
621324
621431
|
...event.properties,
|
|
621325
621432
|
usingAccessToken: false,
|
|
@@ -799313,7 +799420,10 @@ var DocsDefinitionResolver = class {
|
|
|
799313
799420
|
}
|
|
799314
799421
|
} catch (error50) {
|
|
799315
799422
|
this.taskContext.logger.error(`Failed to parse ${relativePath}: ${extractErrorMessage(error50)}`);
|
|
799316
|
-
throw
|
|
799423
|
+
throw new CliError({
|
|
799424
|
+
message: `Failed to parse markdown file ${relativePath}: ${extractErrorMessage(error50)}`,
|
|
799425
|
+
code: CliError.Code.ParseError
|
|
799426
|
+
});
|
|
799317
799427
|
}
|
|
799318
799428
|
}
|
|
799319
799429
|
const imageParseTime = performance.now() - imageParseStart;
|
|
@@ -832962,7 +833072,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
832962
833072
|
var LOGS_FOLDER_NAME = "logs";
|
|
832963
833073
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
832964
833074
|
function getCliSource() {
|
|
832965
|
-
const version7 = "4.107.
|
|
833075
|
+
const version7 = "4.107.2-1-g488c64ae1ff";
|
|
832966
833076
|
return `cli@${version7}`;
|
|
832967
833077
|
}
|
|
832968
833078
|
var DebugLogger = class {
|
|
@@ -833985,10 +834095,19 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
833985
834095
|
absolutePathToFernFolder: docsWorkspace.absoluteFilePath,
|
|
833986
834096
|
absolutePathToMarkdownFile: absoluteFilePath
|
|
833987
834097
|
});
|
|
833988
|
-
|
|
833989
|
-
|
|
833990
|
-
|
|
833991
|
-
|
|
834098
|
+
let markdownWithAbsPaths;
|
|
834099
|
+
let filepaths;
|
|
834100
|
+
try {
|
|
834101
|
+
({ markdown: markdownWithAbsPaths, filepaths } = parseImagePaths(markdownReplacedMdAndCode, {
|
|
834102
|
+
absolutePathToFernFolder: docsWorkspace.absoluteFilePath,
|
|
834103
|
+
absolutePathToMarkdownFile: absoluteFilePath
|
|
834104
|
+
}));
|
|
834105
|
+
} catch (error50) {
|
|
834106
|
+
throw new CliError({
|
|
834107
|
+
message: `Failed to parse markdown in ${absoluteFilePath}: ${extractErrorMessage(error50)}`,
|
|
834108
|
+
code: CliError.Code.ParseError
|
|
834109
|
+
});
|
|
834110
|
+
}
|
|
833992
834111
|
if (previousDocsDefinition.filesV2 == null) {
|
|
833993
834112
|
previousDocsDefinition.filesV2 = {};
|
|
833994
834113
|
}
|
|
@@ -845371,7 +845490,7 @@ var LegacyDocsPublisher = class {
|
|
|
845371
845490
|
previewId,
|
|
845372
845491
|
disableTemplates: void 0,
|
|
845373
845492
|
skipUpload,
|
|
845374
|
-
cliVersion: "4.107.
|
|
845493
|
+
cliVersion: "4.107.2-1-g488c64ae1ff",
|
|
845375
845494
|
loginCommand: "fern auth login"
|
|
845376
845495
|
});
|
|
845377
845496
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -873709,28 +873828,28 @@ var STRING_TYPE_REFERENCE = {
|
|
|
873709
873828
|
type: "primitive",
|
|
873710
873829
|
value: "STRING"
|
|
873711
873830
|
};
|
|
873712
|
-
function
|
|
873831
|
+
function stripOptionalAndNullable(item) {
|
|
873832
|
+
let current3 = item;
|
|
873833
|
+
while (current3.type === "optional" || current3.type === "nullable") {
|
|
873834
|
+
current3 = current3.value;
|
|
873835
|
+
}
|
|
873836
|
+
return current3;
|
|
873837
|
+
}
|
|
873838
|
+
function stripListItemWrappers(typeReference2) {
|
|
873713
873839
|
if (typeReference2.type === "optional" && typeReference2.value.type === "list") {
|
|
873714
|
-
const
|
|
873715
|
-
const
|
|
873716
|
-
if (
|
|
873717
|
-
return
|
|
873718
|
-
type: "optional",
|
|
873719
|
-
value: {
|
|
873720
|
-
type: "list",
|
|
873721
|
-
value: itemType.value
|
|
873722
|
-
}
|
|
873723
|
-
};
|
|
873840
|
+
const itemType = typeReference2.value.value;
|
|
873841
|
+
const stripped = stripOptionalAndNullable(itemType);
|
|
873842
|
+
if (stripped === itemType) {
|
|
873843
|
+
return typeReference2;
|
|
873724
873844
|
}
|
|
873845
|
+
return { type: "optional", value: { type: "list", value: stripped } };
|
|
873725
873846
|
}
|
|
873726
873847
|
if (typeReference2.type === "list") {
|
|
873727
|
-
const
|
|
873728
|
-
if (
|
|
873729
|
-
return
|
|
873730
|
-
type: "list",
|
|
873731
|
-
value: itemType.value
|
|
873732
|
-
};
|
|
873848
|
+
const stripped = stripOptionalAndNullable(typeReference2.value);
|
|
873849
|
+
if (stripped === typeReference2.value) {
|
|
873850
|
+
return typeReference2;
|
|
873733
873851
|
}
|
|
873852
|
+
return { type: "list", value: stripped };
|
|
873734
873853
|
}
|
|
873735
873854
|
return typeReference2;
|
|
873736
873855
|
}
|
|
@@ -874246,9 +874365,7 @@ var EndpointSnippetGenerator4 = class {
|
|
|
874246
874365
|
const queryParameterFields = sortedQueryParameters.map((queryParameter) => ({
|
|
874247
874366
|
name: this.context.getMethodName(queryParameter.name.name),
|
|
874248
874367
|
value: this.context.dynamicTypeLiteralMapper.convert({
|
|
874249
|
-
|
|
874250
|
-
// Java SDK builders have convenience overloads that accept List<T>.
|
|
874251
|
-
typeReference: unwrapOptionalFromListItems(queryParameter.typeReference),
|
|
874368
|
+
typeReference: stripListItemWrappers(queryParameter.typeReference),
|
|
874252
874369
|
value: queryParameter.value,
|
|
874253
874370
|
as: "request"
|
|
874254
874371
|
})
|
|
@@ -881444,52 +881561,6 @@ var Begin = class extends AstNode6 {
|
|
|
881444
881561
|
}
|
|
881445
881562
|
};
|
|
881446
881563
|
|
|
881447
|
-
// ../../../generators/ruby-v2/ast/lib/ast/IfElse.js
|
|
881448
|
-
var IfElse = class extends AstNode6 {
|
|
881449
|
-
ifBranch;
|
|
881450
|
-
elseIfs;
|
|
881451
|
-
elseBody;
|
|
881452
|
-
constructor({ if: ifBranch, elseIf, elseBody }) {
|
|
881453
|
-
super();
|
|
881454
|
-
this.ifBranch = ifBranch;
|
|
881455
|
-
this.elseIfs = elseIf ?? [];
|
|
881456
|
-
this.elseBody = elseBody ? Array.isArray(elseBody) ? elseBody : [elseBody] : void 0;
|
|
881457
|
-
}
|
|
881458
|
-
write(writer2) {
|
|
881459
|
-
writer2.write("if ");
|
|
881460
|
-
this.ifBranch.condition.write(writer2);
|
|
881461
|
-
writer2.writeLine();
|
|
881462
|
-
writer2.indent();
|
|
881463
|
-
for (const stmt of this.ifBranch.thenBody) {
|
|
881464
|
-
stmt.write(writer2);
|
|
881465
|
-
writer2.writeNewLineIfLastLineNot();
|
|
881466
|
-
}
|
|
881467
|
-
writer2.dedent();
|
|
881468
|
-
for (const elseIf of this.elseIfs) {
|
|
881469
|
-
writer2.write("elsif ");
|
|
881470
|
-
elseIf.condition.write(writer2);
|
|
881471
|
-
writer2.writeLine();
|
|
881472
|
-
writer2.indent();
|
|
881473
|
-
for (const stmt of elseIf.thenBody) {
|
|
881474
|
-
stmt.write(writer2);
|
|
881475
|
-
writer2.writeNewLineIfLastLineNot();
|
|
881476
|
-
}
|
|
881477
|
-
writer2.dedent();
|
|
881478
|
-
}
|
|
881479
|
-
if (this.elseBody && this.elseBody.length > 0) {
|
|
881480
|
-
writer2.writeLine("else");
|
|
881481
|
-
writer2.indent();
|
|
881482
|
-
for (const stmt of this.elseBody) {
|
|
881483
|
-
stmt.write(writer2);
|
|
881484
|
-
writer2.writeNewLineIfLastLineNot();
|
|
881485
|
-
}
|
|
881486
|
-
writer2.dedent();
|
|
881487
|
-
}
|
|
881488
|
-
writer2.write("end");
|
|
881489
|
-
writer2.writeNewLineIfLastLineNot();
|
|
881490
|
-
}
|
|
881491
|
-
};
|
|
881492
|
-
|
|
881493
881564
|
// ../../../generators/ruby-v2/ast/lib/ast/Comment.js
|
|
881494
881565
|
var MAX_LINE_LENGTH2 = 120;
|
|
881495
881566
|
var COMMENT_PREFIX_LENGTH = 2;
|
|
@@ -881504,7 +881575,8 @@ var Comment6 = class extends AstNode6 {
|
|
|
881504
881575
|
this.docs.split("\n").forEach((line) => {
|
|
881505
881576
|
const wrappedLines = this.wrapLine(line, writer2);
|
|
881506
881577
|
wrappedLines.forEach((wrappedLine) => {
|
|
881507
|
-
|
|
881578
|
+
const trimmed2 = wrappedLine.trimEnd();
|
|
881579
|
+
writer2.writeLine(trimmed2 === "" ? "#" : `# ${trimmed2}`);
|
|
881508
881580
|
});
|
|
881509
881581
|
});
|
|
881510
881582
|
}
|
|
@@ -882136,19 +882208,20 @@ var Class_ = class extends Module_ {
|
|
|
882136
882208
|
writer2.writeLine("; end");
|
|
882137
882209
|
return;
|
|
882138
882210
|
}
|
|
882139
|
-
if (this.statements.length) {
|
|
882211
|
+
if (this.statements.length || this.methods.length) {
|
|
882140
882212
|
writer2.newLine();
|
|
882141
882213
|
writer2.indent();
|
|
882142
882214
|
this.statements.forEach((statement, index3) => {
|
|
882143
882215
|
statement.write(writer2);
|
|
882144
|
-
writer2.
|
|
882216
|
+
writer2.writeNewLineIfLastLineNot();
|
|
882217
|
+
if (index3 < this.statements.length - 1) {
|
|
882218
|
+
writer2.newLine();
|
|
882219
|
+
}
|
|
882145
882220
|
});
|
|
882146
|
-
|
|
882147
|
-
|
|
882148
|
-
|
|
882149
|
-
|
|
882150
|
-
writer2.indent();
|
|
882151
|
-
this.methods.forEach((method8) => {
|
|
882221
|
+
this.methods.forEach((method8, index3) => {
|
|
882222
|
+
if (index3 > 0 || this.statements.length > 0) {
|
|
882223
|
+
writer2.newLine();
|
|
882224
|
+
}
|
|
882152
882225
|
method8.write(writer2);
|
|
882153
882226
|
});
|
|
882154
882227
|
writer2.dedent();
|
|
@@ -882186,6 +882259,112 @@ var Class_ = class extends Module_ {
|
|
|
882186
882259
|
}
|
|
882187
882260
|
};
|
|
882188
882261
|
|
|
882262
|
+
// ../../../generators/ruby-v2/ast/lib/ast/IfElse.js
|
|
882263
|
+
var IfElse = class extends AstNode6 {
|
|
882264
|
+
ifBranch;
|
|
882265
|
+
elseIfs;
|
|
882266
|
+
elseBody;
|
|
882267
|
+
constructor({ if: ifBranch, elseIf, elseBody }) {
|
|
882268
|
+
super();
|
|
882269
|
+
this.ifBranch = ifBranch;
|
|
882270
|
+
this.elseIfs = elseIf ?? [];
|
|
882271
|
+
this.elseBody = elseBody ? Array.isArray(elseBody) ? elseBody : [elseBody] : void 0;
|
|
882272
|
+
}
|
|
882273
|
+
write(writer2) {
|
|
882274
|
+
const modifier = this.renderAsModifier(writer2);
|
|
882275
|
+
if (modifier != null) {
|
|
882276
|
+
writer2.write(modifier);
|
|
882277
|
+
writer2.writeNewLineIfLastLineNot();
|
|
882278
|
+
return;
|
|
882279
|
+
}
|
|
882280
|
+
writer2.write("if ");
|
|
882281
|
+
this.ifBranch.condition.write(writer2);
|
|
882282
|
+
writer2.writeLine();
|
|
882283
|
+
writer2.indent();
|
|
882284
|
+
for (const stmt of this.ifBranch.thenBody) {
|
|
882285
|
+
stmt.write(writer2);
|
|
882286
|
+
writer2.writeNewLineIfLastLineNot();
|
|
882287
|
+
}
|
|
882288
|
+
writer2.dedent();
|
|
882289
|
+
for (const elseIf of this.elseIfs) {
|
|
882290
|
+
writer2.write("elsif ");
|
|
882291
|
+
elseIf.condition.write(writer2);
|
|
882292
|
+
writer2.writeLine();
|
|
882293
|
+
writer2.indent();
|
|
882294
|
+
for (const stmt of elseIf.thenBody) {
|
|
882295
|
+
stmt.write(writer2);
|
|
882296
|
+
writer2.writeNewLineIfLastLineNot();
|
|
882297
|
+
}
|
|
882298
|
+
writer2.dedent();
|
|
882299
|
+
}
|
|
882300
|
+
if (this.elseBody && this.elseBody.length > 0) {
|
|
882301
|
+
writer2.writeLine("else");
|
|
882302
|
+
writer2.indent();
|
|
882303
|
+
for (const stmt of this.elseBody) {
|
|
882304
|
+
stmt.write(writer2);
|
|
882305
|
+
writer2.writeNewLineIfLastLineNot();
|
|
882306
|
+
}
|
|
882307
|
+
writer2.dedent();
|
|
882308
|
+
}
|
|
882309
|
+
writer2.write("end");
|
|
882310
|
+
writer2.writeNewLineIfLastLineNot();
|
|
882311
|
+
}
|
|
882312
|
+
/**
|
|
882313
|
+
* Returns the modifier-form rendering (`stmt if cond`) when this if is
|
|
882314
|
+
* eligible:
|
|
882315
|
+
* - exactly one statement in the then-body
|
|
882316
|
+
* - no elsif and no else
|
|
882317
|
+
* - the single statement is not an intrinsically multi-line AST node
|
|
882318
|
+
* (Class, Module, Method, Begin, IfElse)
|
|
882319
|
+
* - the rendered statement and condition each fit on a single line
|
|
882320
|
+
*
|
|
882321
|
+
* Returns undefined when the shape isn't eligible, in which case the caller
|
|
882322
|
+
* falls back to explicit if/end form.
|
|
882323
|
+
*
|
|
882324
|
+
* The generator's .rubocop.yml disables Layout/LineLength, so rubocop's
|
|
882325
|
+
* Style/IfUnlessModifier accepts modifier form at any line length. Shape
|
|
882326
|
+
* eligibility is therefore sufficient; we don't gate on a max-line-length
|
|
882327
|
+
* budget here.
|
|
882328
|
+
*/
|
|
882329
|
+
renderAsModifier(writer2) {
|
|
882330
|
+
if (this.ifBranch.thenBody.length !== 1) {
|
|
882331
|
+
return void 0;
|
|
882332
|
+
}
|
|
882333
|
+
if (this.elseIfs.length > 0) {
|
|
882334
|
+
return void 0;
|
|
882335
|
+
}
|
|
882336
|
+
if (this.elseBody != null && this.elseBody.length > 0) {
|
|
882337
|
+
return void 0;
|
|
882338
|
+
}
|
|
882339
|
+
const stmt = this.ifBranch.thenBody[0];
|
|
882340
|
+
if (stmt == null) {
|
|
882341
|
+
return void 0;
|
|
882342
|
+
}
|
|
882343
|
+
if (isKnownMultiLineNode(stmt) || isKnownMultiLineNode(this.ifBranch.condition)) {
|
|
882344
|
+
return void 0;
|
|
882345
|
+
}
|
|
882346
|
+
const stmtRendered = renderNode(stmt, writer2);
|
|
882347
|
+
const conditionRendered = renderNode(this.ifBranch.condition, writer2);
|
|
882348
|
+
if (stmtRendered.length === 0 || conditionRendered.length === 0) {
|
|
882349
|
+
return void 0;
|
|
882350
|
+
}
|
|
882351
|
+
if (stmtRendered.includes("\n") || conditionRendered.includes("\n")) {
|
|
882352
|
+
return void 0;
|
|
882353
|
+
}
|
|
882354
|
+
return `${stmtRendered} if ${conditionRendered}`;
|
|
882355
|
+
}
|
|
882356
|
+
};
|
|
882357
|
+
function isKnownMultiLineNode(node4) {
|
|
882358
|
+
return node4 instanceof Class_ || node4 instanceof Module_ || node4 instanceof Method6 || node4 instanceof Begin || node4 instanceof IfElse;
|
|
882359
|
+
}
|
|
882360
|
+
function renderNode(node4, parentWriter) {
|
|
882361
|
+
const rendered = node4.toString({
|
|
882362
|
+
customConfig: parentWriter.customConfig,
|
|
882363
|
+
formatter: parentWriter.formatter
|
|
882364
|
+
});
|
|
882365
|
+
return rendered.replace(/\n+$/, "");
|
|
882366
|
+
}
|
|
882367
|
+
|
|
882189
882368
|
// ../../../generators/ruby-v2/ast/lib/ast/ClassInstantiation.js
|
|
882190
882369
|
var ClassInstantiation5 = class extends AstNode6 {
|
|
882191
882370
|
classReference;
|
|
@@ -882446,9 +882625,36 @@ var TypeLiteral3 = class _TypeLiteral extends AstNode6 {
|
|
|
882446
882625
|
super();
|
|
882447
882626
|
this.internalType = internalType;
|
|
882448
882627
|
}
|
|
882628
|
+
/**
|
|
882629
|
+
* Returns a stable string representation of this literal suitable for
|
|
882630
|
+
* deduplicating hash keys (see Lint/DuplicateHashKey). Returns undefined
|
|
882631
|
+
* for compound/dynamic shapes where value equality isn't decidable at
|
|
882632
|
+
* emit time.
|
|
882633
|
+
*/
|
|
882634
|
+
getDedupKey() {
|
|
882635
|
+
switch (this.internalType.type) {
|
|
882636
|
+
case "str":
|
|
882637
|
+
return `str:${this.internalType.value}`;
|
|
882638
|
+
case "interpolatedStr":
|
|
882639
|
+
return `istr:${this.internalType.value}`;
|
|
882640
|
+
case "int":
|
|
882641
|
+
return `int:${this.internalType.value}`;
|
|
882642
|
+
case "float":
|
|
882643
|
+
return `float:${this.internalType.value}`;
|
|
882644
|
+
case "bool":
|
|
882645
|
+
return `bool:${this.internalType.value}`;
|
|
882646
|
+
case "nil":
|
|
882647
|
+
return "nil";
|
|
882648
|
+
default:
|
|
882649
|
+
return void 0;
|
|
882650
|
+
}
|
|
882651
|
+
}
|
|
882449
882652
|
static string(value2) {
|
|
882450
882653
|
return new this({ type: "str", value: value2 });
|
|
882451
882654
|
}
|
|
882655
|
+
static interpolatedString(value2) {
|
|
882656
|
+
return new this({ type: "interpolatedStr", value: value2 });
|
|
882657
|
+
}
|
|
882452
882658
|
static integer(value2) {
|
|
882453
882659
|
return new this({ type: "int", value: value2 });
|
|
882454
882660
|
}
|
|
@@ -882485,6 +882691,11 @@ var TypeLiteral3 = class _TypeLiteral extends AstNode6 {
|
|
|
882485
882691
|
write(writer2) {
|
|
882486
882692
|
switch (this.internalType.type) {
|
|
882487
882693
|
case "str": {
|
|
882694
|
+
const value2 = this.internalType.value.replaceAll("\r\n", "\n");
|
|
882695
|
+
writer2.write(`"${value2.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replace(/#(?=[{$@])/g, "\\#")}"`);
|
|
882696
|
+
break;
|
|
882697
|
+
}
|
|
882698
|
+
case "interpolatedStr": {
|
|
882488
882699
|
const value2 = this.internalType.value.replaceAll("\r\n", "\n");
|
|
882489
882700
|
writer2.write(`"${value2.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`);
|
|
882490
882701
|
break;
|
|
@@ -882502,7 +882713,21 @@ var TypeLiteral3 = class _TypeLiteral extends AstNode6 {
|
|
|
882502
882713
|
break;
|
|
882503
882714
|
}
|
|
882504
882715
|
case "hash": {
|
|
882505
|
-
const
|
|
882716
|
+
const filteredEntries = this.internalType.entries.filter((entry) => !_TypeLiteral.isNop(entry.key) && !_TypeLiteral.isNop(entry.value));
|
|
882717
|
+
const seenKeys = /* @__PURE__ */ new Map();
|
|
882718
|
+
filteredEntries.forEach((entry, index3) => {
|
|
882719
|
+
const rendered = renderKeyForDedup(entry.key);
|
|
882720
|
+
if (rendered != null) {
|
|
882721
|
+
seenKeys.set(rendered, index3);
|
|
882722
|
+
}
|
|
882723
|
+
});
|
|
882724
|
+
const entries23 = filteredEntries.filter((entry, index3) => {
|
|
882725
|
+
const rendered = renderKeyForDedup(entry.key);
|
|
882726
|
+
if (rendered == null) {
|
|
882727
|
+
return true;
|
|
882728
|
+
}
|
|
882729
|
+
return seenKeys.get(rendered) === index3;
|
|
882730
|
+
});
|
|
882506
882731
|
if (entries23.length === 0) {
|
|
882507
882732
|
writer2.write("{}");
|
|
882508
882733
|
break;
|
|
@@ -882582,6 +882807,12 @@ var TypeLiteral3 = class _TypeLiteral extends AstNode6 {
|
|
|
882582
882807
|
}
|
|
882583
882808
|
}
|
|
882584
882809
|
};
|
|
882810
|
+
function renderKeyForDedup(key2) {
|
|
882811
|
+
if (!(key2 instanceof TypeLiteral3)) {
|
|
882812
|
+
return void 0;
|
|
882813
|
+
}
|
|
882814
|
+
return key2.getDedupKey();
|
|
882815
|
+
}
|
|
882585
882816
|
|
|
882586
882817
|
// ../../../generators/ruby-v2/ast/lib/ast/TypeParameter.js
|
|
882587
882818
|
var Variance;
|
|
@@ -883544,6 +883775,7 @@ var EndpointSnippetGenerator7 = class {
|
|
|
883544
883775
|
invokeMethodArgs.keywordArguments = invokeMethodArgs.keywordArguments ?? [];
|
|
883545
883776
|
invokeMethodArgs.keywordArguments.push(requestOptions);
|
|
883546
883777
|
}
|
|
883778
|
+
invokeMethodArgs.keywordArguments = dedupeKeywordArguments(invokeMethodArgs.keywordArguments);
|
|
883547
883779
|
return ruby_exports.invokeMethod(invokeMethodArgs);
|
|
883548
883780
|
}
|
|
883549
883781
|
/**
|
|
@@ -883577,6 +883809,7 @@ var EndpointSnippetGenerator7 = class {
|
|
|
883577
883809
|
invokeMethodArgs.keywordArguments = invokeMethodArgs.keywordArguments ?? [];
|
|
883578
883810
|
invokeMethodArgs.keywordArguments.push(requestOptions);
|
|
883579
883811
|
}
|
|
883812
|
+
invokeMethodArgs.keywordArguments = dedupeKeywordArguments(invokeMethodArgs.keywordArguments);
|
|
883580
883813
|
return ruby_exports.invokeMethod(invokeMethodArgs);
|
|
883581
883814
|
}
|
|
883582
883815
|
/**
|
|
@@ -883913,6 +884146,21 @@ var EndpointSnippetGenerator7 = class {
|
|
|
883913
884146
|
return this.context.getMethodName(endpoint3.declaration.name);
|
|
883914
884147
|
}
|
|
883915
884148
|
};
|
|
884149
|
+
function dedupeKeywordArguments(kwargs) {
|
|
884150
|
+
if (kwargs == null || kwargs.length <= 1) {
|
|
884151
|
+
return kwargs;
|
|
884152
|
+
}
|
|
884153
|
+
const lastIndexByName = /* @__PURE__ */ new Map();
|
|
884154
|
+
kwargs.forEach((arg, index3) => {
|
|
884155
|
+
lastIndexByName.set(arg.name, index3);
|
|
884156
|
+
});
|
|
884157
|
+
const deduped = kwargs.filter((arg, index3) => lastIndexByName.get(arg.name) === index3);
|
|
884158
|
+
if (deduped.length !== kwargs.length) {
|
|
884159
|
+
const droppedNames = Array.from(new Set(kwargs.map((arg) => arg.name).filter((name2, index3) => lastIndexByName.get(name2) !== index3)));
|
|
884160
|
+
console.warn(`[ruby-v2 dynamic-snippets] duplicate keyword argument name(s) [${droppedNames.join(", ")}] in a generated snippet; keeping last occurrence to match **params runtime behavior. This indicates a latent name collision in the Ruby SDK method signature that should be disambiguated at the generator level.`);
|
|
884161
|
+
}
|
|
884162
|
+
return deduped;
|
|
884163
|
+
}
|
|
883916
884164
|
|
|
883917
884165
|
// ../../../generators/ruby-v2/dynamic-snippets/lib/DynamicSnippetsGenerator.js
|
|
883918
884166
|
var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
@@ -919360,10 +919608,15 @@ function processGeneratorGroups(groups2, maybeApiName, logger4) {
|
|
|
919360
919608
|
for (const [groupName, group] of Object.entries(groups2)) {
|
|
919361
919609
|
for (const [generatorName, generatorVersions] of Object.entries(group)) {
|
|
919362
919610
|
logger4.debug(`Checking if ${generatorName} in group ${groupName} has an upgrade available...`);
|
|
919363
|
-
|
|
919364
|
-
|
|
919365
|
-
generatorVersions.previousVersion
|
|
919366
|
-
|
|
919611
|
+
let isUpgradeAvailable;
|
|
919612
|
+
try {
|
|
919613
|
+
isUpgradeAvailable = isVersionAhead(generatorVersions.latestVersion, generatorVersions.previousVersion);
|
|
919614
|
+
} catch {
|
|
919615
|
+
throw new CliError({
|
|
919616
|
+
message: `Generator "${generatorName}" has an invalid version "${generatorVersions.previousVersion}" in generators.yml. Use an exact version like 1.2.3.`,
|
|
919617
|
+
code: CliError.Code.ConfigError
|
|
919618
|
+
});
|
|
919619
|
+
}
|
|
919367
919620
|
logger4.debug(
|
|
919368
919621
|
`Latest version: ${generatorVersions.latestVersion}. ` + (isUpgradeAvailable ? "Upgrade available." : "No upgrade available.")
|
|
919369
919622
|
);
|
|
@@ -919472,7 +919725,7 @@ var CliContext = class _CliContext {
|
|
|
919472
919725
|
if (false) {
|
|
919473
919726
|
this.logger.error("CLI_VERSION is not defined");
|
|
919474
919727
|
}
|
|
919475
|
-
return "4.107.
|
|
919728
|
+
return "4.107.2-1-g488c64ae1ff";
|
|
919476
919729
|
}
|
|
919477
919730
|
getCliName() {
|
|
919478
919731
|
if (false) {
|
|
@@ -928005,7 +928258,9 @@ async function resolvePreviewUrlFromId({
|
|
|
928005
928258
|
const fernDirectory = await getFernDirectory();
|
|
928006
928259
|
if (fernDirectory == null) {
|
|
928007
928260
|
return cliContext.failAndThrow(
|
|
928008
|
-
"No fern directory found. The --id flag requires a Fern project to resolve the organization.\nRun this command from within a Fern project directory, or use the URL argument instead."
|
|
928261
|
+
"No fern directory found. The --id flag requires a Fern project to resolve the organization.\nRun this command from within a Fern project directory, or use the URL argument instead.",
|
|
928262
|
+
void 0,
|
|
928263
|
+
{ code: CliError.Code.ValidationError }
|
|
928009
928264
|
);
|
|
928010
928265
|
}
|
|
928011
928266
|
const projectConfig = await cliContext.runTask(
|
|
@@ -930898,6 +931153,7 @@ async function formatWorkspaces({
|
|
|
930898
931153
|
}
|
|
930899
931154
|
|
|
930900
931155
|
// src/commands/generate/generateDocsWorkspace.ts
|
|
931156
|
+
init_lib4();
|
|
930901
931157
|
init_js();
|
|
930902
931158
|
|
|
930903
931159
|
// src/utils/environment.ts
|
|
@@ -931099,27 +931355,35 @@ ${source_default.yellow("?")} Are you sure you want to continue?`,
|
|
|
931099
931355
|
errorOnBrokenLinks: strictBrokenLinks,
|
|
931100
931356
|
excludeRules: getExcludeRules(brokenLinks, strictBrokenLinks)
|
|
931101
931357
|
});
|
|
931358
|
+
const skippedWorkspacePaths = /* @__PURE__ */ new Set();
|
|
931102
931359
|
const ossWorkspacesForValidation = await filterOssWorkspaces(project);
|
|
931103
931360
|
for (const ossWorkspace of ossWorkspacesForValidation) {
|
|
931104
|
-
|
|
931105
|
-
|
|
931106
|
-
|
|
931107
|
-
|
|
931108
|
-
|
|
931361
|
+
try {
|
|
931362
|
+
const violations = await validateOSSWorkspace(ossWorkspace, context3);
|
|
931363
|
+
const errors4 = violations.filter((v9) => v9.severity === "fatal" || v9.severity === "error");
|
|
931364
|
+
if (errors4.length > 0) {
|
|
931365
|
+
for (const error50 of errors4) {
|
|
931366
|
+
context3.logger.warn(`${error50.relativeFilepath}: ${error50.message}`);
|
|
931367
|
+
}
|
|
931368
|
+
context3.logger.warn(
|
|
931369
|
+
`Skipping API workspace at ${ossWorkspace.absoluteFilePath} due to ${errors4.length} validation error${errors4.length !== 1 ? "s" : ""}. Run fern check for details.`
|
|
931370
|
+
);
|
|
931371
|
+
skippedWorkspacePaths.add(ossWorkspace.absoluteFilePath);
|
|
931109
931372
|
}
|
|
931110
|
-
|
|
931111
|
-
|
|
931112
|
-
|
|
931113
|
-
{ code: CliError.Code.ValidationError }
|
|
931373
|
+
} catch (error50) {
|
|
931374
|
+
context3.logger.warn(
|
|
931375
|
+
`Skipping API workspace at ${ossWorkspace.absoluteFilePath}: ${extractErrorMessage(error50)}`
|
|
931114
931376
|
);
|
|
931377
|
+
skippedWorkspacePaths.add(ossWorkspace.absoluteFilePath);
|
|
931115
931378
|
}
|
|
931116
931379
|
}
|
|
931117
931380
|
context3.logger.info("Validation complete, starting remote docs generation...");
|
|
931118
931381
|
const filterStart = performance.now();
|
|
931119
|
-
const
|
|
931382
|
+
const allOssWorkspaces = await filterOssWorkspaces(project);
|
|
931383
|
+
const ossWorkspaces = allOssWorkspaces.filter((ws5) => !skippedWorkspacePaths.has(ws5.absoluteFilePath));
|
|
931120
931384
|
const filterTime = performance.now() - filterStart;
|
|
931121
931385
|
context3.logger.debug(
|
|
931122
|
-
`Filtered OSS workspaces (${ossWorkspaces.length} workspaces) in ${filterTime.toFixed(0)}ms`
|
|
931386
|
+
`Filtered OSS workspaces (${ossWorkspaces.length} workspaces, ${skippedWorkspacePaths.size} skipped) in ${filterTime.toFixed(0)}ms`
|
|
931123
931387
|
);
|
|
931124
931388
|
const generationStart = performance.now();
|
|
931125
931389
|
await runRemoteGenerationForDocsWorkspace({
|
package/package.json
CHANGED