@fern-api/fern-api-dev 5.31.0 → 5.32.1
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 +472 -98
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -360347,9 +360347,9 @@ var require_diff3 = __commonJS({
|
|
|
360347
360347
|
}
|
|
360348
360348
|
});
|
|
360349
360349
|
|
|
360350
|
-
// ../../../node_modules/.pnpm/@fern-api+replay@0.16.
|
|
360350
|
+
// ../../../node_modules/.pnpm/@fern-api+replay@0.16.1/node_modules/@fern-api/replay/dist/index.cjs
|
|
360351
360351
|
var require_dist14 = __commonJS({
|
|
360352
|
-
"../../../node_modules/.pnpm/@fern-api+replay@0.16.
|
|
360352
|
+
"../../../node_modules/.pnpm/@fern-api+replay@0.16.1/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
|
|
360353
360353
|
"use strict";
|
|
360354
360354
|
var __defProp4 = Object.defineProperty;
|
|
360355
360355
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -360917,6 +360917,7 @@ var require_dist14 = __commonJS({
|
|
|
360917
360917
|
}
|
|
360918
360918
|
var import_node_fs32 = require("fs");
|
|
360919
360919
|
var import_node_path42 = require("path");
|
|
360920
|
+
var import_minimatch8 = require_commonjs3();
|
|
360920
360921
|
var import_yaml18 = require_dist11();
|
|
360921
360922
|
var LOCKFILE_HEADER = "# DO NOT EDIT MANUALLY - Managed by Fern Replay\n";
|
|
360922
360923
|
var LockfileNotFoundError = class extends Error {
|
|
@@ -360928,10 +360929,23 @@ var require_dist14 = __commonJS({
|
|
|
360928
360929
|
var LockfileManager = class {
|
|
360929
360930
|
outputDir;
|
|
360930
360931
|
lock = null;
|
|
360932
|
+
fernignorePatterns = [];
|
|
360931
360933
|
warnings = [];
|
|
360932
360934
|
constructor(outputDir) {
|
|
360933
360935
|
this.outputDir = outputDir;
|
|
360934
360936
|
}
|
|
360937
|
+
/**
|
|
360938
|
+
* Inform the lockfile of the customer's `.fernignore` patterns so that
|
|
360939
|
+
* `save()` can suppress its "Patch X removed from lockfile" warning when
|
|
360940
|
+
* every file in the stripped patch is already `.fernignore`-protected.
|
|
360941
|
+
* The strip itself still happens (credentials never persist); only the
|
|
360942
|
+
* customer-visible warning is suppressed in that case, because the
|
|
360943
|
+
* protected files survive the generator wipe regardless of whether the
|
|
360944
|
+
* lockfile tracks them, so there's nothing for the customer to action.
|
|
360945
|
+
*/
|
|
360946
|
+
setFernignorePatterns(patterns) {
|
|
360947
|
+
this.fernignorePatterns = patterns;
|
|
360948
|
+
}
|
|
360935
360949
|
get lockfilePath() {
|
|
360936
360950
|
return (0, import_node_path42.join)(this.outputDir, ".fern", "replay.lock");
|
|
360937
360951
|
}
|
|
@@ -361000,9 +361014,14 @@ var require_dist14 = __commonJS({
|
|
|
361000
361014
|
if (sensitiveFiles.length > 0) {
|
|
361001
361015
|
reasons.push(`sensitive files: ${sensitiveFiles.join(", ")}`);
|
|
361002
361016
|
}
|
|
361003
|
-
|
|
361004
|
-
|
|
361017
|
+
const allProtected = patch5.files.length > 0 && patch5.files.every(
|
|
361018
|
+
(f4) => this.fernignorePatterns.some((p14) => f4 === p14 || (0, import_minimatch8.minimatch)(f4, p14))
|
|
361005
361019
|
);
|
|
361020
|
+
if (!allProtected) {
|
|
361021
|
+
this.warnings.push(
|
|
361022
|
+
`Patch ${patch5.id} removed from lockfile: ${reasons.join("; ")}. This prevents credential exposure in committed lockfiles.`
|
|
361023
|
+
);
|
|
361024
|
+
}
|
|
361006
361025
|
} else {
|
|
361007
361026
|
cleanPatches.push(patch5);
|
|
361008
361027
|
}
|
|
@@ -361875,7 +361894,7 @@ var require_dist14 = __commonJS({
|
|
|
361875
361894
|
var import_promises310 = require("fs/promises");
|
|
361876
361895
|
var import_node_os15 = require("os");
|
|
361877
361896
|
var import_node_path52 = require("path");
|
|
361878
|
-
var
|
|
361897
|
+
var import_minimatch22 = require_commonjs3();
|
|
361879
361898
|
var MergeAccumulator = class {
|
|
361880
361899
|
constructor(mode, sharedFiles) {
|
|
361881
361900
|
this.mode = mode;
|
|
@@ -362579,13 +362598,13 @@ var require_dist14 = __commonJS({
|
|
|
362579
362598
|
isExcluded(patch5) {
|
|
362580
362599
|
const config5 = this.lockManager.getCustomizationsConfig();
|
|
362581
362600
|
if (!config5.exclude) return false;
|
|
362582
|
-
return patch5.files.some((file4) => config5.exclude.some((pattern) => (0,
|
|
362601
|
+
return patch5.files.some((file4) => config5.exclude.some((pattern) => (0, import_minimatch22.minimatch)(file4, pattern)));
|
|
362583
362602
|
}
|
|
362584
362603
|
async resolveFilePath(filePath, baseTreeHash, currentTreeHash) {
|
|
362585
362604
|
const config5 = this.lockManager.getCustomizationsConfig();
|
|
362586
362605
|
if (config5.moves) {
|
|
362587
362606
|
for (const move of config5.moves) {
|
|
362588
|
-
if ((0,
|
|
362607
|
+
if ((0, import_minimatch22.minimatch)(filePath, move.from) || filePath === move.from) {
|
|
362589
362608
|
if (filePath === move.from) {
|
|
362590
362609
|
return move.to;
|
|
362591
362610
|
}
|
|
@@ -362872,7 +362891,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
362872
362891
|
var import_node_fs210 = require("fs");
|
|
362873
362892
|
var import_promises610 = require("fs/promises");
|
|
362874
362893
|
var import_node_path82 = require("path");
|
|
362875
|
-
var
|
|
362894
|
+
var import_minimatch42 = require_commonjs3();
|
|
362876
362895
|
init_GitClient();
|
|
362877
362896
|
var import_promises410 = require("fs/promises");
|
|
362878
362897
|
var import_node_os22 = require("os");
|
|
@@ -362981,12 +363000,23 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
362981
363000
|
unlocatableFiles.push(file4);
|
|
362982
363001
|
continue;
|
|
362983
363002
|
}
|
|
362984
|
-
const locInCurrentGen =
|
|
362985
|
-
|
|
362986
|
-
|
|
362987
|
-
|
|
362988
|
-
|
|
362989
|
-
|
|
363003
|
+
const locInCurrentGen = [];
|
|
363004
|
+
const locInWorkingTree = [];
|
|
363005
|
+
let spanResolutionFailed = false;
|
|
363006
|
+
for (let i9 = 0; i9 < locInCurrentGenRaw.length; i9++) {
|
|
363007
|
+
const cg = resolveSpan(locInCurrentGenRaw[i9], currentGenLines, "old");
|
|
363008
|
+
const wt10 = resolveSpan(locInWorkingTreeRaw[i9], workingTreeLines, "new");
|
|
363009
|
+
if (cg === null || wt10 === null) {
|
|
363010
|
+
spanResolutionFailed = true;
|
|
363011
|
+
break;
|
|
363012
|
+
}
|
|
363013
|
+
locInCurrentGen.push(cg);
|
|
363014
|
+
locInWorkingTree.push(wt10);
|
|
363015
|
+
}
|
|
363016
|
+
if (spanResolutionFailed) {
|
|
363017
|
+
unlocatableFiles.push(file4);
|
|
363018
|
+
continue;
|
|
363019
|
+
}
|
|
362990
363020
|
const overlay = overlayRegions(
|
|
362991
363021
|
currentGenLines,
|
|
362992
363022
|
locInCurrentGen,
|
|
@@ -363048,11 +363078,11 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363048
363078
|
if (prefer === "old") {
|
|
363049
363079
|
if (oldFits) return { ...loc, oursSpan: hunk.oldCount };
|
|
363050
363080
|
if (newFits) return { ...loc, oursSpan: hunk.newCount };
|
|
363051
|
-
|
|
363052
|
-
if (newFits) return { ...loc, oursSpan: hunk.newCount };
|
|
363053
|
-
if (oldFits) return { ...loc, oursSpan: hunk.oldCount };
|
|
363081
|
+
return loc;
|
|
363054
363082
|
}
|
|
363055
|
-
return loc;
|
|
363083
|
+
if (newFits) return { ...loc, oursSpan: hunk.newCount };
|
|
363084
|
+
if (oldFits) return { ...loc, oursSpan: hunk.oldCount };
|
|
363085
|
+
return null;
|
|
363056
363086
|
}
|
|
363057
363087
|
function sequenceMatches(needle, haystack, offset2) {
|
|
363058
363088
|
if (offset2 + needle.length > haystack.length) return false;
|
|
@@ -363164,7 +363194,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363164
363194
|
const trailer = hasTrailingNewline ? "" : "\n\";
|
|
363165
363195
|
return header + "\n" + body + trailer + "\n";
|
|
363166
363196
|
}
|
|
363167
|
-
var
|
|
363197
|
+
var import_minimatch32 = require_commonjs3();
|
|
363168
363198
|
var FileOwnership = class {
|
|
363169
363199
|
constructor(git) {
|
|
363170
363200
|
this.git = git;
|
|
@@ -363188,7 +363218,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363188
363218
|
const { file: file4, originalFileName, patch: patch5, currentGenSha, fernignorePatterns, warnedGens, warnings } = ctx;
|
|
363189
363219
|
if (patch5.user_owned) return true;
|
|
363190
363220
|
if (file4 === ".fernignore") return true;
|
|
363191
|
-
if (fernignorePatterns.some((p14) => file4 === p14 || (0,
|
|
363221
|
+
if (fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch32.minimatch)(file4, p14))) return true;
|
|
363192
363222
|
if (fileIsCreationInPatchContent(patch5.patch_content, originalFileName ?? file4)) {
|
|
363193
363223
|
return true;
|
|
363194
363224
|
}
|
|
@@ -363265,6 +363295,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363265
363295
|
};
|
|
363266
363296
|
}
|
|
363267
363297
|
async apply(_prep) {
|
|
363298
|
+
this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
|
|
363268
363299
|
this.service.lockManager.save();
|
|
363269
363300
|
return firstGenerationReport();
|
|
363270
363301
|
}
|
|
@@ -363321,6 +363352,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363321
363352
|
};
|
|
363322
363353
|
}
|
|
363323
363354
|
async apply(_prep, options2) {
|
|
363355
|
+
this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
|
|
363324
363356
|
this.service.lockManager.save();
|
|
363325
363357
|
const credentialWarnings = [...this.service.lockManager.warnings];
|
|
363326
363358
|
if (!options2?.stageOnly) {
|
|
@@ -363442,6 +363474,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363442
363474
|
this.service.lockManager.addPatch(patch5);
|
|
363443
363475
|
}
|
|
363444
363476
|
}
|
|
363477
|
+
this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
|
|
363445
363478
|
this.service.lockManager.save();
|
|
363446
363479
|
this.service.warnings.push(...this.service.lockManager.warnings);
|
|
363447
363480
|
if (newPatches.length > 0) {
|
|
@@ -363602,6 +363635,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363602
363635
|
}
|
|
363603
363636
|
}
|
|
363604
363637
|
}
|
|
363638
|
+
this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
|
|
363605
363639
|
this.service.lockManager.save();
|
|
363606
363640
|
this.service.warnings.push(...this.service.lockManager.warnings);
|
|
363607
363641
|
if (options2?.stageOnly) {
|
|
@@ -363833,7 +363867,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
363833
363867
|
)
|
|
363834
363868
|
);
|
|
363835
363869
|
const hasProtectedFiles = patch5.files.some(
|
|
363836
|
-
(file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0,
|
|
363870
|
+
(file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
|
|
363837
363871
|
);
|
|
363838
363872
|
const allUserOwned = isUserOwnedPerFile.every(Boolean);
|
|
363839
363873
|
if (allUserOwned && patch5.files.length > 0) {
|
|
@@ -364273,7 +364307,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
364273
364307
|
);
|
|
364274
364308
|
if (snapHasStaleMarkers) continue;
|
|
364275
364309
|
const isProtectedSnap = patch5.files.some(
|
|
364276
|
-
(file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0,
|
|
364310
|
+
(file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
|
|
364277
364311
|
);
|
|
364278
364312
|
if (isProtectedSnap) continue;
|
|
364279
364313
|
const snapHash = this.detector.computeContentHash(snapshotDiff);
|
|
@@ -364293,6 +364327,11 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
364293
364327
|
(files) => this.git.exec(["diff", currentGen, "HEAD", "--", ...files]).catch(() => null)
|
|
364294
364328
|
);
|
|
364295
364329
|
if (ppResult === null) continue;
|
|
364330
|
+
if (ppResult.hadFallback) {
|
|
364331
|
+
this.warnings.push(
|
|
364332
|
+
`Patch ${patch5.id}: couldn't fully isolate ${ppResult.fallbackFiles.join(", ")} \u2014 customization preserved, attribution may have merged with another patch.`
|
|
364333
|
+
);
|
|
364334
|
+
}
|
|
364296
364335
|
const diff2 = ppResult.diff;
|
|
364297
364336
|
if (!diff2.trim()) {
|
|
364298
364337
|
if (await allPatchFilesUserOwned(patch5)) continue;
|
|
@@ -364308,7 +364347,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
364308
364347
|
continue;
|
|
364309
364348
|
}
|
|
364310
364349
|
const isProtected = patch5.files.some(
|
|
364311
|
-
(file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0,
|
|
364350
|
+
(file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
|
|
364312
364351
|
);
|
|
364313
364352
|
if (isProtected) {
|
|
364314
364353
|
continue;
|
|
@@ -364380,6 +364419,11 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
364380
364419
|
(files) => this.git.exec(["diff", currentGen, "HEAD", "--", ...files]).catch(() => null)
|
|
364381
364420
|
);
|
|
364382
364421
|
if (ppResult === null) continue;
|
|
364422
|
+
if (ppResult.hadFallback) {
|
|
364423
|
+
this.warnings.push(
|
|
364424
|
+
`Patch ${patch5.id}: couldn't fully isolate ${ppResult.fallbackFiles.join(", ")} \u2014 customization preserved, attribution may have merged with another patch.`
|
|
364425
|
+
);
|
|
364426
|
+
}
|
|
364383
364427
|
const diff2 = ppResult.diff;
|
|
364384
364428
|
if (!diff2.trim()) {
|
|
364385
364429
|
if (await allPatchFilesUserOwned(patch5)) {
|
|
@@ -364467,13 +364511,14 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
364467
364511
|
if (files.length === 0) return;
|
|
364468
364512
|
const fernignorePatterns = this.readFernignorePatterns();
|
|
364469
364513
|
for (const file4 of files) {
|
|
364470
|
-
if (fernignorePatterns.some((pattern) => (0,
|
|
364514
|
+
if (fernignorePatterns.some((pattern) => (0, import_minimatch42.minimatch)(file4, pattern))) continue;
|
|
364471
364515
|
try {
|
|
364472
364516
|
await this.git.exec(["checkout", "HEAD", "--", file4]);
|
|
364473
364517
|
} catch {
|
|
364474
364518
|
}
|
|
364475
364519
|
}
|
|
364476
364520
|
}
|
|
364521
|
+
/** @internal Used by Flow implementations in `src/flows/`. */
|
|
364477
364522
|
readFernignorePatterns() {
|
|
364478
364523
|
const fernignorePath = (0, import_node_path82.join)(this.outputDir, ".fernignore");
|
|
364479
364524
|
if (!(0, import_node_fs210.existsSync)(fernignorePath)) return [];
|
|
@@ -364554,7 +364599,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
364554
364599
|
var import_node_crypto22 = require("crypto");
|
|
364555
364600
|
var import_node_fs33 = require("fs");
|
|
364556
364601
|
var import_node_path92 = require("path");
|
|
364557
|
-
var
|
|
364602
|
+
var import_minimatch52 = require_commonjs3();
|
|
364558
364603
|
var import_yaml22 = require_dist11();
|
|
364559
364604
|
var FernignoreMigrator = class {
|
|
364560
364605
|
git;
|
|
@@ -364586,7 +364631,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
364586
364631
|
const commitsOnly = [];
|
|
364587
364632
|
const syntheticPatches = [];
|
|
364588
364633
|
for (const pattern of patterns) {
|
|
364589
|
-
const matchingPatch = patches.find((p14) => p14.files.some((f4) => (0,
|
|
364634
|
+
const matchingPatch = patches.find((p14) => p14.files.some((f4) => (0, import_minimatch52.minimatch)(f4, pattern) || f4 === pattern));
|
|
364590
364635
|
if (matchingPatch) {
|
|
364591
364636
|
trackedByBoth.push({
|
|
364592
364637
|
file: pattern,
|
|
@@ -364659,7 +364704,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
364659
364704
|
fernignoreOnly.push(...remainingFernignoreOnly);
|
|
364660
364705
|
}
|
|
364661
364706
|
for (const patch5 of patches) {
|
|
364662
|
-
const hasUnprotectedFiles = patch5.files.some((f4) => !patterns.some((p14) => (0,
|
|
364707
|
+
const hasUnprotectedFiles = patch5.files.some((f4) => !patterns.some((p14) => (0, import_minimatch52.minimatch)(f4, p14) || f4 === p14));
|
|
364663
364708
|
if (hasUnprotectedFiles) {
|
|
364664
364709
|
commitsOnly.push(patch5);
|
|
364665
364710
|
}
|
|
@@ -364671,7 +364716,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
364671
364716
|
const results = [];
|
|
364672
364717
|
for (const pattern of patterns) {
|
|
364673
364718
|
const matching = allFiles.filter(
|
|
364674
|
-
(f4) => (0,
|
|
364719
|
+
(f4) => (0, import_minimatch52.minimatch)(f4, pattern) || f4 === pattern || f4.startsWith(pattern + "/")
|
|
364675
364720
|
);
|
|
364676
364721
|
results.push({ pattern, files: matching.length > 0 ? matching : [pattern] });
|
|
364677
364722
|
}
|
|
@@ -364980,7 +365025,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
364980
365025
|
const normalized = relevantLines.filter((line) => !line.startsWith("index ")).join("\n").replace(/\n-- \n[\d]+\.[\d]+[^\n]*\s*$/, "");
|
|
364981
365026
|
return `sha256:${(0, import_node_crypto32.createHash)("sha256").update(normalized).digest("hex")}`;
|
|
364982
365027
|
}
|
|
364983
|
-
var
|
|
365028
|
+
var import_minimatch62 = require_commonjs3();
|
|
364984
365029
|
function parseDiffStat(patchContent) {
|
|
364985
365030
|
let additions = 0;
|
|
364986
365031
|
let deletions = 0;
|
|
@@ -365010,7 +365055,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
365010
365055
|
}
|
|
365011
365056
|
function matchesPatch(patch5, pattern) {
|
|
365012
365057
|
const fileMatch = patch5.files.some(
|
|
365013
|
-
(file4) => file4 === pattern || (0,
|
|
365058
|
+
(file4) => file4 === pattern || (0, import_minimatch62.minimatch)(file4, pattern)
|
|
365014
365059
|
);
|
|
365015
365060
|
if (fileMatch) return true;
|
|
365016
365061
|
return patch5.original_message.toLowerCase().includes(pattern.toLowerCase());
|
|
@@ -567335,6 +567380,7 @@ var OpenApiIntermediateRepresentation = schemas_exports9.objectWithoutOptionalPr
|
|
|
567335
567380
|
title: schemas_exports9.string().optional(),
|
|
567336
567381
|
description: schemas_exports9.string().optional(),
|
|
567337
567382
|
basePath: schemas_exports9.string().optional(),
|
|
567383
|
+
basePathParameters: schemas_exports9.list(PathParameter2).optional(),
|
|
567338
567384
|
servers: schemas_exports9.list(Server),
|
|
567339
567385
|
websocketServers: schemas_exports9.list(Server),
|
|
567340
567386
|
groups: schemas_exports9.record(schemas_exports9.string(), SdkGroupInfo),
|
|
@@ -571544,8 +571590,20 @@ function buildEndpointExample({ endpointExample, context: context3 }) {
|
|
|
571544
571590
|
if (endpointExample.description != null) {
|
|
571545
571591
|
example.docs = endpointExample.description;
|
|
571546
571592
|
}
|
|
571593
|
+
const pathParametersForExample = {};
|
|
571594
|
+
if (context3.ir.basePathParameters != null) {
|
|
571595
|
+
for (const param of context3.ir.basePathParameters) {
|
|
571596
|
+
const value2 = param.clientDefault ?? param.name;
|
|
571597
|
+
if (typeof value2 === "string" || typeof value2 === "number" || typeof value2 === "boolean") {
|
|
571598
|
+
pathParametersForExample[param.name] = value2;
|
|
571599
|
+
}
|
|
571600
|
+
}
|
|
571601
|
+
}
|
|
571547
571602
|
if (endpointExample.pathParameters != null && endpointExample.pathParameters.length > 0) {
|
|
571548
|
-
|
|
571603
|
+
Object.assign(pathParametersForExample, convertPathParameterExample(endpointExample.pathParameters));
|
|
571604
|
+
}
|
|
571605
|
+
if (Object.keys(pathParametersForExample).length > 0) {
|
|
571606
|
+
example["path-parameters"] = pathParametersForExample;
|
|
571549
571607
|
}
|
|
571550
571608
|
if (endpointExample.queryParameters != null && endpointExample.queryParameters.length > 0) {
|
|
571551
571609
|
example["query-parameters"] = convertQueryParameterExample2(endpointExample.queryParameters);
|
|
@@ -572136,34 +572194,35 @@ function getRequest({ endpoint: endpoint3, declarationFile, context: context3, r
|
|
|
572136
572194
|
declarationDepth: 0,
|
|
572137
572195
|
variant
|
|
572138
572196
|
});
|
|
572139
|
-
const
|
|
572140
|
-
|
|
572141
|
-
value: {
|
|
572142
|
-
body: requestTypeReference
|
|
572143
|
-
}
|
|
572197
|
+
const requestValue = {
|
|
572198
|
+
body: requestTypeReference
|
|
572144
572199
|
};
|
|
572145
572200
|
const hasPathParams = Object.keys(pathParameters ?? {}).length > 0;
|
|
572146
572201
|
const hasQueryParams = Object.keys(queryParameters ?? {}).length > 0;
|
|
572147
572202
|
const hasHeaders = Object.keys(headers2 ?? {}).length > 0;
|
|
572148
572203
|
if (hasPathParams) {
|
|
572149
|
-
|
|
572204
|
+
requestValue["path-parameters"] = pathParameters;
|
|
572150
572205
|
}
|
|
572151
572206
|
if (hasQueryParams) {
|
|
572152
|
-
|
|
572207
|
+
requestValue["query-parameters"] = queryParameters;
|
|
572153
572208
|
}
|
|
572154
572209
|
if (hasHeaders) {
|
|
572155
|
-
|
|
572210
|
+
requestValue.headers = headers2;
|
|
572156
572211
|
}
|
|
572157
572212
|
if (hasPathParams || hasQueryParams || hasHeaders) {
|
|
572158
|
-
|
|
572213
|
+
requestValue.name = requestNameOverride ?? generatedRequestName;
|
|
572159
572214
|
}
|
|
572160
572215
|
if (request7.contentType != null) {
|
|
572161
|
-
|
|
572216
|
+
requestValue["content-type"] = request7.contentType;
|
|
572162
572217
|
}
|
|
572163
572218
|
if (request7.description != null) {
|
|
572164
|
-
|
|
572219
|
+
requestValue.docs = request7.description;
|
|
572165
572220
|
}
|
|
572166
|
-
|
|
572221
|
+
const canCollapse = typeof requestValue.body === "string" && requestValue["path-parameters"] == null && requestValue["query-parameters"] == null && requestValue.headers == null && requestValue.name == null && requestValue.docs == null && (requestValue["content-type"] == null || requestValue["content-type"] === "application/json");
|
|
572222
|
+
return {
|
|
572223
|
+
schemaIdsToExclude: [],
|
|
572224
|
+
value: canCollapse ? requestValue.body : requestValue
|
|
572225
|
+
};
|
|
572167
572226
|
}
|
|
572168
572227
|
const propertyToDeclarationFile = /* @__PURE__ */ new Map();
|
|
572169
572228
|
for (const allOfRef of resolvedSchema.allOf) {
|
|
@@ -573243,6 +573302,22 @@ function buildFernDefinition(context3) {
|
|
|
573243
573302
|
if (context3.ir.basePath != null) {
|
|
573244
573303
|
context3.builder.setBasePath(context3.ir.basePath);
|
|
573245
573304
|
}
|
|
573305
|
+
if (context3.ir.basePathParameters != null && context3.ir.basePathParameters.length > 0) {
|
|
573306
|
+
const params2 = {};
|
|
573307
|
+
for (const p14 of context3.ir.basePathParameters) {
|
|
573308
|
+
const entry = {
|
|
573309
|
+
type: "string"
|
|
573310
|
+
};
|
|
573311
|
+
if (p14.description != null) {
|
|
573312
|
+
entry.docs = p14.description;
|
|
573313
|
+
}
|
|
573314
|
+
if (p14.clientDefault != null) {
|
|
573315
|
+
entry["client-default"] = p14.clientDefault;
|
|
573316
|
+
}
|
|
573317
|
+
params2[p14.name] = entry;
|
|
573318
|
+
}
|
|
573319
|
+
context3.builder.setRootPathParameters(params2);
|
|
573320
|
+
}
|
|
573246
573321
|
if (context3.ir.hasEndpointsMarkedInternal) {
|
|
573247
573322
|
context3.builder.addAudience(EXTERNAL_AUDIENCE);
|
|
573248
573323
|
}
|
|
@@ -573367,6 +573442,7 @@ var FernDefinitionBuilderImpl = class {
|
|
|
573367
573442
|
rootApiFile;
|
|
573368
573443
|
packageMarkerFile = {};
|
|
573369
573444
|
basePath = void 0;
|
|
573445
|
+
rootPathParameters = void 0;
|
|
573370
573446
|
constructor(enableUniqueErrorsPerEndpoint) {
|
|
573371
573447
|
this.enableUniqueErrorsPerEndpoint = enableUniqueErrorsPerEndpoint;
|
|
573372
573448
|
this.root = new FernDefinitionDirectory();
|
|
@@ -573431,6 +573507,12 @@ var FernDefinitionBuilderImpl = class {
|
|
|
573431
573507
|
setBasePath(basePath) {
|
|
573432
573508
|
this.basePath = basePath;
|
|
573433
573509
|
}
|
|
573510
|
+
setRootPathParameters(parameters2) {
|
|
573511
|
+
if (Object.keys(parameters2).length === 0) {
|
|
573512
|
+
return;
|
|
573513
|
+
}
|
|
573514
|
+
this.rootPathParameters = parameters2;
|
|
573515
|
+
}
|
|
573434
573516
|
setApiVersion(apiVersionScheme) {
|
|
573435
573517
|
this.rootApiFile.version = apiVersionScheme;
|
|
573436
573518
|
}
|
|
@@ -573663,7 +573745,9 @@ var FernDefinitionBuilderImpl = class {
|
|
|
573663
573745
|
build() {
|
|
573664
573746
|
const definitionFiles = this.root.getAllFiles();
|
|
573665
573747
|
const basePath = this.basePath;
|
|
573666
|
-
|
|
573748
|
+
const rootPathParameters = this.rootPathParameters;
|
|
573749
|
+
const shouldInline = basePath != null && rootPathParameters == null && !basePath.includes("{");
|
|
573750
|
+
if (basePath != null && shouldInline) {
|
|
573667
573751
|
if (this.packageMarkerFile.service != null) {
|
|
573668
573752
|
this.packageMarkerFile.service = {
|
|
573669
573753
|
...this.packageMarkerFile.service,
|
|
@@ -573694,6 +573778,11 @@ var FernDefinitionBuilderImpl = class {
|
|
|
573694
573778
|
};
|
|
573695
573779
|
}
|
|
573696
573780
|
}
|
|
573781
|
+
} else if (basePath != null) {
|
|
573782
|
+
this.rootApiFile["base-path"] = basePath;
|
|
573783
|
+
if (rootPathParameters != null) {
|
|
573784
|
+
this.rootApiFile["path-parameters"] = rootPathParameters;
|
|
573785
|
+
}
|
|
573697
573786
|
}
|
|
573698
573787
|
const definition3 = {
|
|
573699
573788
|
rootApiFile: this.rootApiFile,
|
|
@@ -574780,6 +574869,161 @@ var FernOpenAPIExtension = {
|
|
|
574780
574869
|
FERN_DEFAULT: "x-fern-default"
|
|
574781
574870
|
};
|
|
574782
574871
|
|
|
574872
|
+
// ../api-importers/openapi/openapi-ir-parser/lib/getExtension.js
|
|
574873
|
+
init_lodash();
|
|
574874
|
+
function getExtension(object23, extension4) {
|
|
574875
|
+
const extensions2 = Array.isArray(extension4) ? extension4 : [extension4];
|
|
574876
|
+
for (const extension5 of extensions2) {
|
|
574877
|
+
const extensionValue = object23[extension5];
|
|
574878
|
+
if (extensionValue != null) {
|
|
574879
|
+
return extensionValue;
|
|
574880
|
+
}
|
|
574881
|
+
}
|
|
574882
|
+
return void 0;
|
|
574883
|
+
}
|
|
574884
|
+
function getExtensionAndValidate(object23, extension4, schema2, logger4, breadcrumbs = []) {
|
|
574885
|
+
try {
|
|
574886
|
+
const extensionValue = getExtension(object23, extension4);
|
|
574887
|
+
if (extensionValue != null) {
|
|
574888
|
+
return schema2.parse(extensionValue);
|
|
574889
|
+
}
|
|
574890
|
+
} catch (e8) {
|
|
574891
|
+
const breadcrumb = compact_default(breadcrumbs).join(" -> ");
|
|
574892
|
+
logger4.error(`${breadcrumb.length > 0 ? `${breadcrumb}: ` : ""}Failed to parse ${extension4}`);
|
|
574893
|
+
}
|
|
574894
|
+
return void 0;
|
|
574895
|
+
}
|
|
574896
|
+
|
|
574897
|
+
// ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/extensions/getFernBasePath.js
|
|
574898
|
+
var PLACEHOLDER_REGEX = /\{([^}]+)\}/g;
|
|
574899
|
+
function getFernBasePath(document4) {
|
|
574900
|
+
const raw = getExtension(document4, FernOpenAPIExtension.BASE_PATH);
|
|
574901
|
+
if (raw == null) {
|
|
574902
|
+
return void 0;
|
|
574903
|
+
}
|
|
574904
|
+
if (typeof raw === "string") {
|
|
574905
|
+
if (!raw.startsWith("/")) {
|
|
574906
|
+
return void 0;
|
|
574907
|
+
}
|
|
574908
|
+
return { basePath: raw, pathParameters: [], pathsIncludeBasePath: false };
|
|
574909
|
+
}
|
|
574910
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
574911
|
+
return void 0;
|
|
574912
|
+
}
|
|
574913
|
+
const obj = raw;
|
|
574914
|
+
const path113 = obj["path"];
|
|
574915
|
+
if (typeof path113 !== "string" || !path113.startsWith("/")) {
|
|
574916
|
+
return void 0;
|
|
574917
|
+
}
|
|
574918
|
+
const placeholders = extractPlaceholders(path113);
|
|
574919
|
+
const rawParameters = obj["parameters"];
|
|
574920
|
+
const parametersMap = rawParameters != null && typeof rawParameters === "object" && !Array.isArray(rawParameters) ? rawParameters : {};
|
|
574921
|
+
const pathParameters = [];
|
|
574922
|
+
for (const name2 of placeholders) {
|
|
574923
|
+
const entry = parametersMap[name2];
|
|
574924
|
+
const docs2 = typeof entry === "object" && entry != null && !Array.isArray(entry) ? typeof entry["docs"] === "string" ? entry["docs"] : void 0 : void 0;
|
|
574925
|
+
const clientDefault = typeof entry === "object" && entry != null && !Array.isArray(entry) ? entry["default"] : void 0;
|
|
574926
|
+
pathParameters.push({
|
|
574927
|
+
name: name2,
|
|
574928
|
+
schema: Schema.primitive({
|
|
574929
|
+
description: docs2,
|
|
574930
|
+
availability: void 0,
|
|
574931
|
+
schema: PrimitiveSchemaValue.string({
|
|
574932
|
+
default: void 0,
|
|
574933
|
+
pattern: void 0,
|
|
574934
|
+
format: void 0,
|
|
574935
|
+
minLength: void 0,
|
|
574936
|
+
maxLength: void 0
|
|
574937
|
+
}),
|
|
574938
|
+
generatedName: name2,
|
|
574939
|
+
nameOverride: void 0,
|
|
574940
|
+
title: void 0,
|
|
574941
|
+
namespace: void 0,
|
|
574942
|
+
groupName: void 0
|
|
574943
|
+
}),
|
|
574944
|
+
description: docs2,
|
|
574945
|
+
availability: void 0,
|
|
574946
|
+
source: void 0,
|
|
574947
|
+
variableReference: void 0,
|
|
574948
|
+
parameterNameOverride: void 0,
|
|
574949
|
+
clientDefault
|
|
574950
|
+
});
|
|
574951
|
+
}
|
|
574952
|
+
const pathsIncludeBasePath = obj["paths-include-base-path"] === true;
|
|
574953
|
+
return { basePath: path113, pathParameters, pathsIncludeBasePath };
|
|
574954
|
+
}
|
|
574955
|
+
function extractPlaceholders(path113) {
|
|
574956
|
+
const result = [];
|
|
574957
|
+
const regex5 = new RegExp(PLACEHOLDER_REGEX.source, "g");
|
|
574958
|
+
let match3;
|
|
574959
|
+
while ((match3 = regex5.exec(path113)) != null) {
|
|
574960
|
+
if (match3[1] != null && !result.includes(match3[1])) {
|
|
574961
|
+
result.push(match3[1]);
|
|
574962
|
+
}
|
|
574963
|
+
}
|
|
574964
|
+
return result;
|
|
574965
|
+
}
|
|
574966
|
+
function stripBasePathFromPaths({ openApi, basePath, rootPathParameterNames }) {
|
|
574967
|
+
if (openApi.paths == null) {
|
|
574968
|
+
return [];
|
|
574969
|
+
}
|
|
574970
|
+
const trimmedBasePath = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
574971
|
+
const errors4 = [];
|
|
574972
|
+
const newPaths = {};
|
|
574973
|
+
for (const [path113, pathItem] of Object.entries(openApi.paths)) {
|
|
574974
|
+
if (pathItem == null) {
|
|
574975
|
+
newPaths[path113] = pathItem;
|
|
574976
|
+
continue;
|
|
574977
|
+
}
|
|
574978
|
+
if (!path113.startsWith(trimmedBasePath)) {
|
|
574979
|
+
errors4.push(`Expected path '${path113}' to start with base path '${trimmedBasePath}'`);
|
|
574980
|
+
newPaths[path113] = pathItem;
|
|
574981
|
+
continue;
|
|
574982
|
+
}
|
|
574983
|
+
const stripped = path113.slice(trimmedBasePath.length) || "/";
|
|
574984
|
+
const newPathItem = stripPathParametersFromPathItem({
|
|
574985
|
+
pathItem,
|
|
574986
|
+
rootPathParameterNames
|
|
574987
|
+
});
|
|
574988
|
+
newPaths[stripped] = newPathItem;
|
|
574989
|
+
}
|
|
574990
|
+
openApi.paths = newPaths;
|
|
574991
|
+
return errors4;
|
|
574992
|
+
}
|
|
574993
|
+
function stripPathParametersFromPathItem({ pathItem, rootPathParameterNames }) {
|
|
574994
|
+
const result = { ...pathItem };
|
|
574995
|
+
if (Array.isArray(result.parameters)) {
|
|
574996
|
+
result.parameters = result.parameters.filter((p14) => !isStrippablePathParameter(p14, rootPathParameterNames));
|
|
574997
|
+
}
|
|
574998
|
+
const operationKeys = [
|
|
574999
|
+
"get",
|
|
575000
|
+
"put",
|
|
575001
|
+
"post",
|
|
575002
|
+
"delete",
|
|
575003
|
+
"options",
|
|
575004
|
+
"head",
|
|
575005
|
+
"patch",
|
|
575006
|
+
"trace"
|
|
575007
|
+
];
|
|
575008
|
+
for (const opKey of operationKeys) {
|
|
575009
|
+
const op4 = result[opKey];
|
|
575010
|
+
if (op4 == null || !Array.isArray(op4.parameters)) {
|
|
575011
|
+
continue;
|
|
575012
|
+
}
|
|
575013
|
+
result[opKey] = {
|
|
575014
|
+
...op4,
|
|
575015
|
+
parameters: op4.parameters.filter((p14) => !isStrippablePathParameter(p14, rootPathParameterNames))
|
|
575016
|
+
};
|
|
575017
|
+
}
|
|
575018
|
+
return result;
|
|
575019
|
+
}
|
|
575020
|
+
function isStrippablePathParameter(parameter6, rootPathParameterNames) {
|
|
575021
|
+
if ("$ref" in parameter6) {
|
|
575022
|
+
return false;
|
|
575023
|
+
}
|
|
575024
|
+
return parameter6.in === "path" && rootPathParameterNames.has(parameter6.name);
|
|
575025
|
+
}
|
|
575026
|
+
|
|
574783
575027
|
// ../api-importers/openapi/openapi-ir-parser/lib/options.js
|
|
574784
575028
|
var DEFAULT_PARSE_OPENAPI_SETTINGS = {
|
|
574785
575029
|
disableExamples: false,
|
|
@@ -574864,31 +575108,6 @@ init_lib6();
|
|
|
574864
575108
|
init_lib6();
|
|
574865
575109
|
init_lodash();
|
|
574866
575110
|
|
|
574867
|
-
// ../api-importers/openapi/openapi-ir-parser/lib/getExtension.js
|
|
574868
|
-
init_lodash();
|
|
574869
|
-
function getExtension(object23, extension4) {
|
|
574870
|
-
const extensions2 = Array.isArray(extension4) ? extension4 : [extension4];
|
|
574871
|
-
for (const extension5 of extensions2) {
|
|
574872
|
-
const extensionValue = object23[extension5];
|
|
574873
|
-
if (extensionValue != null) {
|
|
574874
|
-
return extensionValue;
|
|
574875
|
-
}
|
|
574876
|
-
}
|
|
574877
|
-
return void 0;
|
|
574878
|
-
}
|
|
574879
|
-
function getExtensionAndValidate(object23, extension4, schema2, logger4, breadcrumbs = []) {
|
|
574880
|
-
try {
|
|
574881
|
-
const extensionValue = getExtension(object23, extension4);
|
|
574882
|
-
if (extensionValue != null) {
|
|
574883
|
-
return schema2.parse(extensionValue);
|
|
574884
|
-
}
|
|
574885
|
-
} catch (e8) {
|
|
574886
|
-
const breadcrumb = compact_default(breadcrumbs).join(" -> ");
|
|
574887
|
-
logger4.error(`${breadcrumb.length > 0 ? `${breadcrumb}: ` : ""}Failed to parse ${extension4}`);
|
|
574888
|
-
}
|
|
574889
|
-
return void 0;
|
|
574890
|
-
}
|
|
574891
|
-
|
|
574892
575111
|
// ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/extensions/getExamples.js
|
|
574893
575112
|
function getExamples(schema2) {
|
|
574894
575113
|
const examples = getExtension(schema2, "examples");
|
|
@@ -585164,11 +585383,6 @@ function getScopes(oauthSecurityScheme, source2) {
|
|
|
585164
585383
|
return void 0;
|
|
585165
585384
|
}
|
|
585166
585385
|
|
|
585167
|
-
// ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/extensions/getFernBasePath.js
|
|
585168
|
-
function getFernBasePath(parameter6) {
|
|
585169
|
-
return getExtension(parameter6, FernOpenAPIExtension.BASE_PATH);
|
|
585170
|
-
}
|
|
585171
|
-
|
|
585172
585386
|
// ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/extensions/getFernGroups.js
|
|
585173
585387
|
init_zod();
|
|
585174
585388
|
var XFernGroupsSchema = external_exports2.record(external_exports2.string(), external_exports2.object({
|
|
@@ -585479,6 +585693,17 @@ function generateIr({ openApi, taskContext, options: options2, source: source2,
|
|
|
585479
585693
|
if (context3.filter.hasEndpoints()) {
|
|
585480
585694
|
taskContext.logger.debug("Endpoint filter applied...");
|
|
585481
585695
|
}
|
|
585696
|
+
const fernBasePathParsed = getFernBasePath(openApi);
|
|
585697
|
+
if (fernBasePathParsed?.pathsIncludeBasePath) {
|
|
585698
|
+
const stripErrors = stripBasePathFromPaths({
|
|
585699
|
+
openApi,
|
|
585700
|
+
basePath: fernBasePathParsed.basePath,
|
|
585701
|
+
rootPathParameterNames: new Set(fernBasePathParsed.pathParameters.map((p14) => p14.name))
|
|
585702
|
+
});
|
|
585703
|
+
for (const message of stripErrors) {
|
|
585704
|
+
taskContext.logger.warn(message);
|
|
585705
|
+
}
|
|
585706
|
+
}
|
|
585482
585707
|
Object.entries(openApi.paths ?? {}).forEach(([path113, pathItem]) => {
|
|
585483
585708
|
if (pathItem == null) {
|
|
585484
585709
|
return;
|
|
@@ -585706,7 +585931,17 @@ function generateIr({ openApi, taskContext, options: options2, source: source2,
|
|
|
585706
585931
|
context: context3,
|
|
585707
585932
|
document: openApi
|
|
585708
585933
|
}),
|
|
585709
|
-
basePath:
|
|
585934
|
+
basePath: (() => {
|
|
585935
|
+
const parsed = getFernBasePath(openApi);
|
|
585936
|
+
return parsed?.basePath;
|
|
585937
|
+
})(),
|
|
585938
|
+
basePathParameters: (() => {
|
|
585939
|
+
const parsed = getFernBasePath(openApi);
|
|
585940
|
+
if (parsed == null || parsed.pathParameters.length === 0) {
|
|
585941
|
+
return void 0;
|
|
585942
|
+
}
|
|
585943
|
+
return parsed.pathParameters;
|
|
585944
|
+
})(),
|
|
585710
585945
|
title: openApi.info.title ?? "",
|
|
585711
585946
|
description: openApi.info.description,
|
|
585712
585947
|
groups: Object.fromEntries(Object.entries(groupInfo ?? {}).map(([key2, value2]) => {
|
|
@@ -585898,6 +586133,7 @@ function parse8({ context: context3, documents, options: options2 }) {
|
|
|
585898
586133
|
title: void 0,
|
|
585899
586134
|
description: void 0,
|
|
585900
586135
|
basePath: void 0,
|
|
586136
|
+
basePathParameters: void 0,
|
|
585901
586137
|
servers: [],
|
|
585902
586138
|
websocketServers: [],
|
|
585903
586139
|
tags: {
|
|
@@ -586113,6 +586349,7 @@ function merge7(ir1, ir23, options2) {
|
|
|
586113
586349
|
title: ir1.title ?? ir23.title,
|
|
586114
586350
|
description: ir1.description ?? ir23.description,
|
|
586115
586351
|
basePath: ir1.basePath ?? ir23.basePath,
|
|
586352
|
+
basePathParameters: ir1.basePathParameters ?? ir23.basePathParameters,
|
|
586116
586353
|
servers: [...ir1.servers, ...ir23.servers],
|
|
586117
586354
|
websocketServers: [...ir1.websocketServers, ...ir23.websocketServers],
|
|
586118
586355
|
tags: {
|
|
@@ -586243,6 +586480,7 @@ function merge7(ir1, ir23, options2) {
|
|
|
586243
586480
|
title: ir1.title ?? ir23.title,
|
|
586244
586481
|
description: ir1.description ?? ir23.description,
|
|
586245
586482
|
basePath: ir1.basePath ?? ir23.basePath,
|
|
586483
|
+
basePathParameters: ir1.basePathParameters ?? ir23.basePathParameters,
|
|
586246
586484
|
// Cast grouped servers to Server[] - buildEnvironments.ts handles the grouped structure
|
|
586247
586485
|
// biome-ignore lint/suspicious/noExplicitAny: Required to preserve grouped server metadata through type system
|
|
586248
586486
|
servers: mergedServers,
|
|
@@ -586295,6 +586533,7 @@ function merge7(ir1, ir23, options2) {
|
|
|
586295
586533
|
title: ir1.title ?? ir23.title,
|
|
586296
586534
|
description: ir1.description ?? ir23.description,
|
|
586297
586535
|
basePath: ir1.basePath ?? ir23.basePath,
|
|
586536
|
+
basePathParameters: ir1.basePathParameters ?? ir23.basePathParameters,
|
|
586298
586537
|
servers: [...ir1.servers, ...ir23.servers],
|
|
586299
586538
|
websocketServers: [...ir1.websocketServers, ...ir23.websocketServers],
|
|
586300
586539
|
tags: {
|
|
@@ -606419,17 +606658,16 @@ function convertExampleResponseBody({ endpoint: endpoint3, example, typeResolver
|
|
|
606419
606658
|
workspace
|
|
606420
606659
|
});
|
|
606421
606660
|
}
|
|
606422
|
-
function buildUrl({ file: file4, service, endpoint: endpoint3,
|
|
606661
|
+
function buildUrl({ file: file4, service, endpoint: endpoint3, pathParams }) {
|
|
606423
606662
|
let url3 = (0, import_url_join6.default)(file4.rootApiFile["base-path"] ?? "", service["base-path"], endpoint3.path);
|
|
606424
|
-
|
|
606425
|
-
|
|
606426
|
-
|
|
606427
|
-
|
|
606428
|
-
|
|
606429
|
-
|
|
606430
|
-
url3 = url3.replaceAll(`{${getOriginalName(parameter6.name)}}`, encodeURIComponent(`${parameter6.value.jsonExample}`));
|
|
606431
|
-
}
|
|
606663
|
+
for (const parameter6 of [
|
|
606664
|
+
...pathParams.endpointPathParameters,
|
|
606665
|
+
...pathParams.servicePathParameters,
|
|
606666
|
+
...pathParams.rootPathParameters
|
|
606667
|
+
]) {
|
|
606668
|
+
url3 = url3.replaceAll(`{${getOriginalName(parameter6.name)}}`, encodeURIComponent(`${parameter6.value.jsonExample}`));
|
|
606432
606669
|
}
|
|
606670
|
+
url3 = url3.replace(/\{([^}]+)\}/g, (_7, name2) => encodeURIComponent(name2));
|
|
606433
606671
|
url3 = url3.replaceAll("//", "/");
|
|
606434
606672
|
if (!url3.startsWith("/")) {
|
|
606435
606673
|
url3 = `/${url3}`;
|
|
@@ -653738,6 +653976,7 @@ init_lib8();
|
|
|
653738
653976
|
var import_openapi_types2 = __toESM(require_dist10(), 1);
|
|
653739
653977
|
|
|
653740
653978
|
// ../api-importers/openapi-to-ir/lib/extensions/x-fern-base-path.js
|
|
653979
|
+
var PLACEHOLDER_REGEX2 = /\{([^}]+)\}/g;
|
|
653741
653980
|
var FernBasePathExtension = class extends AbstractExtension {
|
|
653742
653981
|
document;
|
|
653743
653982
|
key = "x-fern-base-path";
|
|
@@ -653746,20 +653985,108 @@ var FernBasePathExtension = class extends AbstractExtension {
|
|
|
653746
653985
|
this.document = document4;
|
|
653747
653986
|
}
|
|
653748
653987
|
convert() {
|
|
653749
|
-
const
|
|
653750
|
-
if (
|
|
653988
|
+
const value2 = this.getExtensionValue(this.document);
|
|
653989
|
+
if (value2 == null) {
|
|
653751
653990
|
return void 0;
|
|
653752
653991
|
}
|
|
653753
|
-
if (typeof
|
|
653992
|
+
if (typeof value2 === "string") {
|
|
653993
|
+
return this.parseString(value2);
|
|
653994
|
+
}
|
|
653995
|
+
if (typeof value2 === "object" && !Array.isArray(value2)) {
|
|
653996
|
+
return this.parseStructured(value2);
|
|
653997
|
+
}
|
|
653998
|
+
this.context.errorCollector.collect({
|
|
653999
|
+
message: "Expected `x-fern-base-path` to be a string or object",
|
|
654000
|
+
path: this.breadcrumbs
|
|
654001
|
+
});
|
|
654002
|
+
return void 0;
|
|
654003
|
+
}
|
|
654004
|
+
parseString(path113) {
|
|
654005
|
+
if (!this.validatePath(path113)) {
|
|
654006
|
+
return void 0;
|
|
654007
|
+
}
|
|
654008
|
+
return { path: path113, parameters: [], pathsIncludeBasePath: false };
|
|
654009
|
+
}
|
|
654010
|
+
parseStructured(obj) {
|
|
654011
|
+
const path113 = obj["path"];
|
|
654012
|
+
if (typeof path113 !== "string") {
|
|
653754
654013
|
this.context.errorCollector.collect({
|
|
653755
|
-
message: "
|
|
654014
|
+
message: "`x-fern-base-path.path` must be a string",
|
|
653756
654015
|
path: this.breadcrumbs
|
|
653757
654016
|
});
|
|
653758
654017
|
return void 0;
|
|
653759
654018
|
}
|
|
653760
|
-
|
|
654019
|
+
if (!this.validatePath(path113)) {
|
|
654020
|
+
return void 0;
|
|
654021
|
+
}
|
|
654022
|
+
const placeholders = extractPlaceholders2(path113);
|
|
654023
|
+
const rawParameters = obj["parameters"];
|
|
654024
|
+
if (rawParameters != null && (typeof rawParameters !== "object" || Array.isArray(rawParameters))) {
|
|
654025
|
+
this.context.errorCollector.collect({
|
|
654026
|
+
message: "`x-fern-base-path.parameters` must be an object map",
|
|
654027
|
+
path: [...this.breadcrumbs, "parameters"]
|
|
654028
|
+
});
|
|
654029
|
+
return void 0;
|
|
654030
|
+
}
|
|
654031
|
+
const parametersMap = rawParameters ?? {};
|
|
654032
|
+
for (const name2 of Object.keys(parametersMap)) {
|
|
654033
|
+
if (!placeholders.has(name2)) {
|
|
654034
|
+
this.context.errorCollector.collect({
|
|
654035
|
+
message: `Parameter '${name2}' does not appear in the base path '${path113}'`,
|
|
654036
|
+
path: [...this.breadcrumbs, "parameters", name2]
|
|
654037
|
+
});
|
|
654038
|
+
return void 0;
|
|
654039
|
+
}
|
|
654040
|
+
}
|
|
654041
|
+
const parameters2 = [];
|
|
654042
|
+
for (const name2 of placeholders) {
|
|
654043
|
+
const raw = parametersMap[name2];
|
|
654044
|
+
if (raw == null) {
|
|
654045
|
+
parameters2.push({ name: name2, type: "string", default: void 0, docs: void 0 });
|
|
654046
|
+
continue;
|
|
654047
|
+
}
|
|
654048
|
+
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
654049
|
+
this.context.errorCollector.collect({
|
|
654050
|
+
message: `Parameter '${name2}' must be an object`,
|
|
654051
|
+
path: [...this.breadcrumbs, "parameters", name2]
|
|
654052
|
+
});
|
|
654053
|
+
return void 0;
|
|
654054
|
+
}
|
|
654055
|
+
const entry = raw;
|
|
654056
|
+
const type8 = typeof entry["type"] === "string" ? entry["type"] : "string";
|
|
654057
|
+
const docs2 = typeof entry["docs"] === "string" ? entry["docs"] : void 0;
|
|
654058
|
+
parameters2.push({
|
|
654059
|
+
name: name2,
|
|
654060
|
+
type: type8,
|
|
654061
|
+
default: entry["default"],
|
|
654062
|
+
docs: docs2
|
|
654063
|
+
});
|
|
654064
|
+
}
|
|
654065
|
+
const pathsIncludeBasePath = obj["paths-include-base-path"] === true;
|
|
654066
|
+
return { path: path113, parameters: parameters2, pathsIncludeBasePath };
|
|
654067
|
+
}
|
|
654068
|
+
validatePath(path113) {
|
|
654069
|
+
if (!path113.startsWith("/")) {
|
|
654070
|
+
this.context.errorCollector.collect({
|
|
654071
|
+
message: "`x-fern-base-path` path must start with '/'",
|
|
654072
|
+
path: this.breadcrumbs
|
|
654073
|
+
});
|
|
654074
|
+
return false;
|
|
654075
|
+
}
|
|
654076
|
+
return true;
|
|
653761
654077
|
}
|
|
653762
654078
|
};
|
|
654079
|
+
function extractPlaceholders2(path113) {
|
|
654080
|
+
const result = /* @__PURE__ */ new Set();
|
|
654081
|
+
let match3;
|
|
654082
|
+
const regex5 = new RegExp(PLACEHOLDER_REGEX2.source, "g");
|
|
654083
|
+
while ((match3 = regex5.exec(path113)) != null) {
|
|
654084
|
+
if (match3[1] != null) {
|
|
654085
|
+
result.add(match3[1]);
|
|
654086
|
+
}
|
|
654087
|
+
}
|
|
654088
|
+
return result;
|
|
654089
|
+
}
|
|
653763
654090
|
|
|
653764
654091
|
// ../api-importers/openapi-to-ir/lib/extensions/x-fern-global-headers.js
|
|
653765
654092
|
var FernGlobalHeadersExtension = class extends AbstractExtension {
|
|
@@ -657023,9 +657350,44 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
|
|
|
657023
657350
|
document: this.context.spec,
|
|
657024
657351
|
context: this.context
|
|
657025
657352
|
});
|
|
657026
|
-
const
|
|
657027
|
-
if (
|
|
657028
|
-
|
|
657353
|
+
const parsed = basePathExtension.convert();
|
|
657354
|
+
if (parsed == null) {
|
|
657355
|
+
return;
|
|
657356
|
+
}
|
|
657357
|
+
this.ir.basePath = constructHttpPath(parsed.path);
|
|
657358
|
+
for (const param of parsed.parameters) {
|
|
657359
|
+
if (param.type !== "string") {
|
|
657360
|
+
this.context.errorCollector.collect({
|
|
657361
|
+
message: `x-fern-base-path parameter '${param.name}' uses type '${param.type}' which is not yet supported; treating as string`,
|
|
657362
|
+
path: ["x-fern-base-path", "parameters", param.name]
|
|
657363
|
+
});
|
|
657364
|
+
}
|
|
657365
|
+
this.ir.pathParameters.push({
|
|
657366
|
+
name: this.context.casingsGenerator.generateName(param.name),
|
|
657367
|
+
valueType: AbstractConverter.STRING,
|
|
657368
|
+
docs: param.docs,
|
|
657369
|
+
location: api_exports.PathParameterLocation.Root,
|
|
657370
|
+
variable: void 0,
|
|
657371
|
+
clientDefault: convertExtensionDefaultToLiteral(param.default),
|
|
657372
|
+
v2Examples: {
|
|
657373
|
+
userSpecifiedExamples: {},
|
|
657374
|
+
autogeneratedExamples: {}
|
|
657375
|
+
},
|
|
657376
|
+
explode: void 0
|
|
657377
|
+
});
|
|
657378
|
+
}
|
|
657379
|
+
if (parsed.pathsIncludeBasePath) {
|
|
657380
|
+
const stripErrors = stripBasePathFromPaths({
|
|
657381
|
+
openApi: this.context.spec,
|
|
657382
|
+
basePath: parsed.path,
|
|
657383
|
+
rootPathParameterNames: new Set(parsed.parameters.map((p14) => p14.name))
|
|
657384
|
+
});
|
|
657385
|
+
for (const message of stripErrors) {
|
|
657386
|
+
this.context.errorCollector.collect({
|
|
657387
|
+
message,
|
|
657388
|
+
path: ["x-fern-base-path", "paths-include-base-path"]
|
|
657389
|
+
});
|
|
657390
|
+
}
|
|
657029
657391
|
}
|
|
657030
657392
|
}
|
|
657031
657393
|
convertSecuritySchemes() {
|
|
@@ -657264,6 +657626,18 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
|
|
|
657264
657626
|
}
|
|
657265
657627
|
}
|
|
657266
657628
|
};
|
|
657629
|
+
function convertExtensionDefaultToLiteral(value2) {
|
|
657630
|
+
if (value2 == null) {
|
|
657631
|
+
return void 0;
|
|
657632
|
+
}
|
|
657633
|
+
if (typeof value2 === "string") {
|
|
657634
|
+
return Literal.string(value2);
|
|
657635
|
+
}
|
|
657636
|
+
if (typeof value2 === "boolean") {
|
|
657637
|
+
return Literal.boolean(value2);
|
|
657638
|
+
}
|
|
657639
|
+
return void 0;
|
|
657640
|
+
}
|
|
657267
657641
|
|
|
657268
657642
|
// ../api-importers/openapi-to-ir/lib/extensions/x-display-name.js
|
|
657269
657643
|
var DisplayNameExtension2 = class extends AbstractExtension {
|
|
@@ -668069,7 +668443,7 @@ var AccessTokenPosthogManager = class {
|
|
|
668069
668443
|
properties: {
|
|
668070
668444
|
...event,
|
|
668071
668445
|
...event.properties,
|
|
668072
|
-
version: "5.
|
|
668446
|
+
version: "5.32.1",
|
|
668073
668447
|
usingAccessToken: true,
|
|
668074
668448
|
...getRunIdProperties()
|
|
668075
668449
|
}
|
|
@@ -668133,7 +668507,7 @@ var UserPosthogManager = class {
|
|
|
668133
668507
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
668134
668508
|
event: "CLI",
|
|
668135
668509
|
properties: {
|
|
668136
|
-
version: "5.
|
|
668510
|
+
version: "5.32.1",
|
|
668137
668511
|
...event,
|
|
668138
668512
|
...event.properties,
|
|
668139
668513
|
usingAccessToken: false,
|
|
@@ -859909,7 +860283,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
859909
860283
|
var LOGS_FOLDER_NAME = "logs";
|
|
859910
860284
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
859911
860285
|
function getCliSource() {
|
|
859912
|
-
const version7 = "5.
|
|
860286
|
+
const version7 = "5.32.1";
|
|
859913
860287
|
return `cli@${version7}`;
|
|
859914
860288
|
}
|
|
859915
860289
|
var DebugLogger = class {
|
|
@@ -878741,7 +879115,7 @@ var LegacyDocsPublisher = class {
|
|
|
878741
879115
|
previewId,
|
|
878742
879116
|
disableTemplates: void 0,
|
|
878743
879117
|
skipUpload,
|
|
878744
|
-
cliVersion: "5.
|
|
879118
|
+
cliVersion: "5.32.1",
|
|
878745
879119
|
loginCommand: "fern auth login"
|
|
878746
879120
|
});
|
|
878747
879121
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -953151,7 +953525,7 @@ function getAutomationContextFromEnv() {
|
|
|
953151
953525
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
953152
953526
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
953153
953527
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
953154
|
-
cli_version: "5.
|
|
953528
|
+
cli_version: "5.32.1"
|
|
953155
953529
|
};
|
|
953156
953530
|
}
|
|
953157
953531
|
function isAutomationMode() {
|
|
@@ -953977,7 +954351,7 @@ var CliContext = class _CliContext {
|
|
|
953977
954351
|
if (false) {
|
|
953978
954352
|
this.logger.error("CLI_VERSION is not defined");
|
|
953979
954353
|
}
|
|
953980
|
-
return "5.
|
|
954354
|
+
return "5.32.1";
|
|
953981
954355
|
}
|
|
953982
954356
|
getCliName() {
|
|
953983
954357
|
if (false) {
|
package/package.json
CHANGED