@fern-api/fern-api-dev 5.55.1 → 5.56.0
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 +354 -144
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -99819,8 +99819,8 @@ var require_graceful_fs = __commonJS({
|
|
|
99819
99819
|
}
|
|
99820
99820
|
}
|
|
99821
99821
|
var fs$writeFile = fs35.writeFile;
|
|
99822
|
-
fs35.writeFile =
|
|
99823
|
-
function
|
|
99822
|
+
fs35.writeFile = writeFile99;
|
|
99823
|
+
function writeFile99(path119, data2, options2, cb) {
|
|
99824
99824
|
if (typeof options2 === "function")
|
|
99825
99825
|
cb = options2, options2 = null;
|
|
99826
99826
|
return go$writeFile(path119, data2, options2, cb);
|
|
@@ -129372,7 +129372,8 @@ var init_OpenApiSettingsSchema2 = __esm({
|
|
|
129372
129372
|
"resolve-aliases": ResolveAliases.optional(),
|
|
129373
129373
|
"group-multi-api-environments": schemas_exports8.boolean().optional(),
|
|
129374
129374
|
"default-integer-format": DefaultIntegerFormat2.optional(),
|
|
129375
|
-
"infer-discriminated-union-base-properties": schemas_exports8.boolean().optional()
|
|
129375
|
+
"infer-discriminated-union-base-properties": schemas_exports8.boolean().optional(),
|
|
129376
|
+
"disambiguate-request-names": schemas_exports8.boolean().optional()
|
|
129376
129377
|
}).extend(BaseApiSettingsSchema);
|
|
129377
129378
|
}
|
|
129378
129379
|
});
|
|
@@ -150769,7 +150770,8 @@ var init_options2 = __esm({
|
|
|
150769
150770
|
inferForwardCompatible: false,
|
|
150770
150771
|
coerceConstsTo: "enums-coerceable-to-literals",
|
|
150771
150772
|
respectByteFormat: false,
|
|
150772
|
-
shouldInferDiscriminatedUnionBaseProperties: false
|
|
150773
|
+
shouldInferDiscriminatedUnionBaseProperties: false,
|
|
150774
|
+
disambiguateRequestNames: true
|
|
150773
150775
|
};
|
|
150774
150776
|
}
|
|
150775
150777
|
});
|
|
@@ -164834,6 +164836,9 @@ function endpointHasNonRequestBodyParameters({ context: context3, convertedParam
|
|
|
164834
164836
|
function getDisambiguatedRequestName({ baseBreadcrumbs, requestBreadcrumbs, isMultipleRequests, request: request7, context: context3 }) {
|
|
164835
164837
|
const nameBreadcrumbs = isMultipleRequests ? getDifferentiatedBreadcrumbs({ breadcrumbs: requestBreadcrumbs, request: request7 }) : requestBreadcrumbs;
|
|
164836
164838
|
const computedName = getGeneratedTypeName(nameBreadcrumbs, context3.options.preserveSchemaIds);
|
|
164839
|
+
if (!context3.options.disambiguateRequestNames) {
|
|
164840
|
+
return computedName;
|
|
164841
|
+
}
|
|
164837
164842
|
const componentSchemas = context3.document.components?.schemas;
|
|
164838
164843
|
if (componentSchemas == null) {
|
|
164839
164844
|
return computedName;
|
|
@@ -197626,7 +197631,8 @@ var init_getAPIDefinitionSettings = __esm({
|
|
|
197626
197631
|
resolveSchemaCollisions: "resolveSchemaCollisions",
|
|
197627
197632
|
inferForwardCompatible: "inferForwardCompatible",
|
|
197628
197633
|
coerceConstsTo: "coerceConstsTo",
|
|
197629
|
-
shouldInferDiscriminatedUnionBaseProperties: "shouldInferDiscriminatedUnionBaseProperties"
|
|
197634
|
+
shouldInferDiscriminatedUnionBaseProperties: "shouldInferDiscriminatedUnionBaseProperties",
|
|
197635
|
+
disambiguateRequestNames: "disambiguateRequestNames"
|
|
197630
197636
|
};
|
|
197631
197637
|
}
|
|
197632
197638
|
});
|
|
@@ -259145,7 +259151,8 @@ function parseOpenApiDefinitionSettingsSchema(settings) {
|
|
|
259145
259151
|
multiServerStrategy: settings?.["multi-server-strategy"],
|
|
259146
259152
|
defaultIntegerFormat: settings?.["default-integer-format"],
|
|
259147
259153
|
pathParameterOrder: settings?.["path-parameter-order"],
|
|
259148
|
-
shouldInferDiscriminatedUnionBaseProperties: settings?.["infer-discriminated-union-base-properties"]
|
|
259154
|
+
shouldInferDiscriminatedUnionBaseProperties: settings?.["infer-discriminated-union-base-properties"],
|
|
259155
|
+
disambiguateRequestNames: settings?.["disambiguate-request-names"]
|
|
259149
259156
|
};
|
|
259150
259157
|
}
|
|
259151
259158
|
function parseAsyncApiDefinitionSettingsSchema(settings) {
|
|
@@ -260004,7 +260011,8 @@ var init_convertGeneratorsConfiguration = __esm({
|
|
|
260004
260011
|
resolveSchemaCollisions: void 0,
|
|
260005
260012
|
inferForwardCompatible: void 0,
|
|
260006
260013
|
coerceConstsTo: void 0,
|
|
260007
|
-
shouldInferDiscriminatedUnionBaseProperties: void 0
|
|
260014
|
+
shouldInferDiscriminatedUnionBaseProperties: void 0,
|
|
260015
|
+
disambiguateRequestNames: void 0
|
|
260008
260016
|
};
|
|
260009
260017
|
}
|
|
260010
260018
|
});
|
|
@@ -455307,13 +455315,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
455307
455315
|
}
|
|
455308
455316
|
}
|
|
455309
455317
|
}
|
|
455310
|
-
const { writeFile:
|
|
455318
|
+
const { writeFile: writeFile99 } = await import("fs/promises");
|
|
455311
455319
|
const yamlContent = index_vite_proxy_tmp_default.dump(parsed, {
|
|
455312
455320
|
indent: 2,
|
|
455313
455321
|
lineWidth: -1,
|
|
455314
455322
|
noRefs: true
|
|
455315
455323
|
});
|
|
455316
|
-
await
|
|
455324
|
+
await writeFile99(overrideFilePath, yamlContent, "utf-8");
|
|
455317
455325
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
455318
455326
|
return {
|
|
455319
455327
|
removedCount: validationResult.invalidCount,
|
|
@@ -478555,8 +478563,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
478555
478563
|
}
|
|
478556
478564
|
}
|
|
478557
478565
|
var fs$writeFile = fs35.writeFile;
|
|
478558
|
-
fs35.writeFile =
|
|
478559
|
-
function
|
|
478566
|
+
fs35.writeFile = writeFile99;
|
|
478567
|
+
function writeFile99(path119, data2, options2, cb) {
|
|
478560
478568
|
if (typeof options2 === "function")
|
|
478561
478569
|
cb = options2, options2 = null;
|
|
478562
478570
|
return go$writeFile(path119, data2, options2, cb);
|
|
@@ -571784,7 +571792,7 @@ var require_dist24 = __commonJS({
|
|
|
571784
571792
|
return copy;
|
|
571785
571793
|
}
|
|
571786
571794
|
};
|
|
571787
|
-
var
|
|
571795
|
+
var import_promises214 = require("fs/promises");
|
|
571788
571796
|
var import_node_path310 = require("path");
|
|
571789
571797
|
async function resolveInputs(args) {
|
|
571790
571798
|
const {
|
|
@@ -571837,7 +571845,7 @@ var require_dist24 = __commonJS({
|
|
|
571837
571845
|
}
|
|
571838
571846
|
}
|
|
571839
571847
|
const oursPath = (0, import_node_path310.join)(outputDir, resolvedPath);
|
|
571840
|
-
const ours = await (0,
|
|
571848
|
+
const ours = await (0, import_promises214.readFile)(oursPath, "utf-8").catch(() => null);
|
|
571841
571849
|
let ghostTheirs = null;
|
|
571842
571850
|
let baseTreeUnreachable = false;
|
|
571843
571851
|
if (!base4 && !renameSourcePath) {
|
|
@@ -572079,7 +572087,7 @@ var require_dist24 = __commonJS({
|
|
|
572079
572087
|
conflictReasonHint
|
|
572080
572088
|
};
|
|
572081
572089
|
}
|
|
572082
|
-
var
|
|
572090
|
+
var import_promises215 = require("fs/promises");
|
|
572083
572091
|
var import_node_path45 = require("path");
|
|
572084
572092
|
async function runMergeAndRecord(args) {
|
|
572085
572093
|
const { plan, inputs, patch: patch5, accumulator } = args;
|
|
@@ -572089,14 +572097,14 @@ var require_dist24 = __commonJS({
|
|
|
572089
572097
|
}
|
|
572090
572098
|
if (plan.kind === "new-file-only-user") {
|
|
572091
572099
|
accumulator.recordMerge(resolvedPath, plan.theirs, patch5.base_generation);
|
|
572092
|
-
await (0,
|
|
572093
|
-
await (0,
|
|
572100
|
+
await (0, import_promises215.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572101
|
+
await (0, import_promises215.writeFile)(oursPath, plan.theirs);
|
|
572094
572102
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
572095
572103
|
}
|
|
572096
572104
|
if (plan.kind === "new-file-both") {
|
|
572097
572105
|
const merged2 = threeWayMerge("", ours, plan.theirs);
|
|
572098
|
-
await (0,
|
|
572099
|
-
await (0,
|
|
572106
|
+
await (0, import_promises215.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572107
|
+
await (0, import_promises215.writeFile)(oursPath, merged2.content);
|
|
572100
572108
|
const unreachableFlag = plan.baseTreeUnreachable ? { baseTreeUnreachable: true } : {};
|
|
572101
572109
|
if (merged2.hasConflicts) {
|
|
572102
572110
|
return {
|
|
@@ -572112,8 +572120,8 @@ var require_dist24 = __commonJS({
|
|
|
572112
572120
|
return { file: resolvedPath, status: "merged", ...unreachableFlag };
|
|
572113
572121
|
}
|
|
572114
572122
|
const merged = threeWayMerge(plan.mergeBase, ours, plan.theirs);
|
|
572115
|
-
await (0,
|
|
572116
|
-
await (0,
|
|
572123
|
+
await (0, import_promises215.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572124
|
+
await (0, import_promises215.writeFile)(oursPath, merged.content);
|
|
572117
572125
|
if (merged.hasConflicts) {
|
|
572118
572126
|
accumulator.recordConflict(resolvedPath, plan.theirs, patch5.base_generation);
|
|
572119
572127
|
return {
|
|
@@ -620636,7 +620644,7 @@ var require_jsonfile = __commonJS({
|
|
|
620636
620644
|
const str2 = stringify5(obj, options2);
|
|
620637
620645
|
await universalify.fromCallback(fs34.writeFile)(file4, str2, options2);
|
|
620638
620646
|
}
|
|
620639
|
-
var
|
|
620647
|
+
var writeFile99 = universalify.fromPromise(_writeFile);
|
|
620640
620648
|
function writeFileSync9(file4, obj, options2 = {}) {
|
|
620641
620649
|
const fs34 = options2.fs || _fs;
|
|
620642
620650
|
const str2 = stringify5(obj, options2);
|
|
@@ -620645,7 +620653,7 @@ var require_jsonfile = __commonJS({
|
|
|
620645
620653
|
module4.exports = {
|
|
620646
620654
|
readFile: readFile119,
|
|
620647
620655
|
readFileSync: readFileSync19,
|
|
620648
|
-
writeFile:
|
|
620656
|
+
writeFile: writeFile99,
|
|
620649
620657
|
writeFileSync: writeFileSync9
|
|
620650
620658
|
};
|
|
620651
620659
|
}
|
|
@@ -678367,7 +678375,14 @@ var OpenApiSettingsSchema2 = BaseApiSettingsSchema2.extend({
|
|
|
678367
678375
|
* so SDKs can expose them directly on the union type without casting.
|
|
678368
678376
|
* Defaults to false.
|
|
678369
678377
|
*/
|
|
678370
|
-
inferDiscriminatedUnionBaseProperties: external_exports.boolean().optional()
|
|
678378
|
+
inferDiscriminatedUnionBaseProperties: external_exports.boolean().optional(),
|
|
678379
|
+
/**
|
|
678380
|
+
* If true, disambiguate generated request wrapper names that collide with
|
|
678381
|
+
* component schema names by replacing the "Request" suffix with "Body".
|
|
678382
|
+
* If false, keep the original "Request" suffix regardless of collisions.
|
|
678383
|
+
* Defaults to true.
|
|
678384
|
+
*/
|
|
678385
|
+
"disambiguate-request-names": external_exports.boolean().optional()
|
|
678371
678386
|
});
|
|
678372
678387
|
|
|
678373
678388
|
// ../config/lib/schemas/specs/OpenApiSpecSchema.js
|
|
@@ -686956,7 +686971,7 @@ var AccessTokenPosthogManager = class {
|
|
|
686956
686971
|
properties: {
|
|
686957
686972
|
...event,
|
|
686958
686973
|
...event.properties,
|
|
686959
|
-
version: "5.
|
|
686974
|
+
version: "5.56.0",
|
|
686960
686975
|
usingAccessToken: true,
|
|
686961
686976
|
...getRunIdProperties()
|
|
686962
686977
|
}
|
|
@@ -687022,7 +687037,7 @@ var UserPosthogManager = class {
|
|
|
687022
687037
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
687023
687038
|
event: "CLI",
|
|
687024
687039
|
properties: {
|
|
687025
|
-
version: "5.
|
|
687040
|
+
version: "5.56.0",
|
|
687026
687041
|
...event,
|
|
687027
687042
|
...event.properties,
|
|
687028
687043
|
usingAccessToken: false,
|
|
@@ -693834,7 +693849,8 @@ var LegacyApiSpecAdapter = class {
|
|
|
693834
693849
|
groupMultiApiEnvironments: settings.groupMultiApiEnvironments,
|
|
693835
693850
|
defaultIntegerFormat: this.adaptDefaultIntegerFormat(settings.defaultIntegerFormat),
|
|
693836
693851
|
coerceConstsTo: settings.coerceConstsTo,
|
|
693837
|
-
shouldInferDiscriminatedUnionBaseProperties: settings.inferDiscriminatedUnionBaseProperties
|
|
693852
|
+
shouldInferDiscriminatedUnionBaseProperties: settings.inferDiscriminatedUnionBaseProperties,
|
|
693853
|
+
disambiguateRequestNames: settings["disambiguate-request-names"]
|
|
693838
693854
|
};
|
|
693839
693855
|
const hasSettings = Object.values(result).some((v3) => v3 != null);
|
|
693840
693856
|
return hasSettings ? result : void 0;
|
|
@@ -832441,10 +832457,10 @@ var IntermediateRepresentationMigratorBuilderImpl = class {
|
|
|
832441
832457
|
constructor(migrations) {
|
|
832442
832458
|
this.migrations = migrations;
|
|
832443
832459
|
}
|
|
832444
|
-
withMigration(
|
|
832460
|
+
withMigration(migration24) {
|
|
832445
832461
|
return new BuildaleIntermediateRepresentationMigratorBuilderImpl([
|
|
832446
832462
|
...this.migrations,
|
|
832447
|
-
|
|
832463
|
+
migration24
|
|
832448
832464
|
]);
|
|
832449
832465
|
}
|
|
832450
832466
|
};
|
|
@@ -832462,14 +832478,14 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
832462
832478
|
migrateForGenerator({ intermediateRepresentation, context: context3, targetGenerator }) {
|
|
832463
832479
|
return this.migrate({
|
|
832464
832480
|
intermediateRepresentation,
|
|
832465
|
-
shouldMigrate: (
|
|
832481
|
+
shouldMigrate: (migration24) => this.shouldRunMigration({ migration: migration24, targetGenerator }),
|
|
832466
832482
|
context: context3,
|
|
832467
832483
|
targetGenerator
|
|
832468
832484
|
});
|
|
832469
832485
|
}
|
|
832470
|
-
migrateThroughMigration({ migration:
|
|
832486
|
+
migrateThroughMigration({ migration: migration24, intermediateRepresentation, context: context3, targetGenerator }) {
|
|
832471
832487
|
return this.migrateThroughVersion({
|
|
832472
|
-
version:
|
|
832488
|
+
version: migration24.earlierVersion,
|
|
832473
832489
|
intermediateRepresentation,
|
|
832474
832490
|
context: context3,
|
|
832475
832491
|
targetGenerator
|
|
@@ -832531,24 +832547,24 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
832531
832547
|
unrecognizedObjectKeys: "strip"
|
|
832532
832548
|
});
|
|
832533
832549
|
};
|
|
832534
|
-
for (const
|
|
832535
|
-
if (!shouldMigrate(
|
|
832550
|
+
for (const migration24 of this.migrations) {
|
|
832551
|
+
if (!shouldMigrate(migration24)) {
|
|
832536
832552
|
break;
|
|
832537
832553
|
}
|
|
832538
|
-
context3.logger.debug(`Migrating IR from ${
|
|
832539
|
-
migrated =
|
|
832554
|
+
context3.logger.debug(`Migrating IR from ${migration24.laterVersion} to ${migration24.earlierVersion}`);
|
|
832555
|
+
migrated = migration24.migrateBackwards(migrated, {
|
|
832540
832556
|
taskContext: context3,
|
|
832541
832557
|
targetGenerator
|
|
832542
832558
|
});
|
|
832543
|
-
jsonify = () => Promise.resolve().then(() =>
|
|
832559
|
+
jsonify = () => Promise.resolve().then(() => migration24.jsonifyEarlierVersion(migrated));
|
|
832544
832560
|
}
|
|
832545
832561
|
return {
|
|
832546
832562
|
ir: migrated,
|
|
832547
832563
|
jsonify
|
|
832548
832564
|
};
|
|
832549
832565
|
}
|
|
832550
|
-
shouldRunMigration({ migration:
|
|
832551
|
-
const minVersionToExclude =
|
|
832566
|
+
shouldRunMigration({ migration: migration24, targetGenerator }) {
|
|
832567
|
+
const minVersionToExclude = migration24.firstGeneratorVersionToConsumeNewIR[targetGenerator.name];
|
|
832552
832568
|
if (minVersionToExclude == null) {
|
|
832553
832569
|
throw new CliError({
|
|
832554
832570
|
message: `Cannot migrate intermediate representation. Unrecognized generator: ${targetGenerator.name}. If leveraging a custom generator, ensure you are specifying "ir-version" within the generator configuration.`,
|
|
@@ -832560,7 +832576,7 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
832560
832576
|
return true;
|
|
832561
832577
|
case GeneratorWasNotCreatedYet:
|
|
832562
832578
|
throw new CliError({
|
|
832563
|
-
message: `Cannot migrate intermediate representation. Generator was created after intermediate representation ${
|
|
832579
|
+
message: `Cannot migrate intermediate representation. Generator was created after intermediate representation ${migration24.laterVersion}.`,
|
|
832564
832580
|
code: CliError.Code.VersionError
|
|
832565
832581
|
});
|
|
832566
832582
|
}
|
|
@@ -832575,9 +832591,9 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
832575
832591
|
}
|
|
832576
832592
|
getIRVersionForGenerator({ targetGenerator }) {
|
|
832577
832593
|
let lastIrVersion = this.migrations[0]?.laterVersion;
|
|
832578
|
-
for (const
|
|
832579
|
-
if (this.shouldRunMigration({ migration:
|
|
832580
|
-
lastIrVersion =
|
|
832594
|
+
for (const migration24 of this.migrations) {
|
|
832595
|
+
if (this.shouldRunMigration({ migration: migration24, targetGenerator })) {
|
|
832596
|
+
lastIrVersion = migration24.earlierVersion;
|
|
832581
832597
|
} else {
|
|
832582
832598
|
break;
|
|
832583
832599
|
}
|
|
@@ -868116,7 +868132,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
868116
868132
|
var LOGS_FOLDER_NAME = "logs";
|
|
868117
868133
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
868118
868134
|
function getCliSource() {
|
|
868119
|
-
const version7 = "5.
|
|
868135
|
+
const version7 = "5.56.0";
|
|
868120
868136
|
return `cli@${version7}`;
|
|
868121
868137
|
}
|
|
868122
868138
|
var DebugLogger = class {
|
|
@@ -870607,6 +870623,32 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
870607
870623
|
}
|
|
870608
870624
|
}
|
|
870609
870625
|
|
|
870626
|
+
// ../docs-preview/lib/getExternalDocsWatchPaths.js
|
|
870627
|
+
init_lib8();
|
|
870628
|
+
function getExternalDocsWatchPaths(absoluteFilePathToFern, docsDefinition) {
|
|
870629
|
+
const fernDirWithSep = absoluteFilePathToFern + "/";
|
|
870630
|
+
const externalDirs = /* @__PURE__ */ new Set();
|
|
870631
|
+
for (const pageId of Object.keys(docsDefinition.pages)) {
|
|
870632
|
+
const absolutePath = resolve6(absoluteFilePathToFern, pageId);
|
|
870633
|
+
if (!absolutePath.startsWith(fernDirWithSep)) {
|
|
870634
|
+
const dir = dirname6(absolutePath);
|
|
870635
|
+
externalDirs.add(dir);
|
|
870636
|
+
}
|
|
870637
|
+
}
|
|
870638
|
+
if (externalDirs.size === 0) {
|
|
870639
|
+
return [];
|
|
870640
|
+
}
|
|
870641
|
+
const sortedDirs = [...externalDirs].sort((a3, b5) => a3.length - b5.length);
|
|
870642
|
+
const rootDirs = [];
|
|
870643
|
+
for (const dir of sortedDirs) {
|
|
870644
|
+
const alreadyCovered = rootDirs.some((root6) => dir.startsWith(root6 + "/") || dir === root6);
|
|
870645
|
+
if (!alreadyCovered) {
|
|
870646
|
+
rootDirs.push(dir);
|
|
870647
|
+
}
|
|
870648
|
+
}
|
|
870649
|
+
return rootDirs.map(AbsoluteFilePath2.of);
|
|
870650
|
+
}
|
|
870651
|
+
|
|
870610
870652
|
// ../docs-preview/lib/nodePolyfills.js
|
|
870611
870653
|
var import_fs29 = require("fs");
|
|
870612
870654
|
var import_path70 = __toESM(require("path"), 1);
|
|
@@ -871876,6 +871918,13 @@ ${err.stack}`);
|
|
|
871876
871918
|
slugTracker.initialize(previewResult.docsDefinition);
|
|
871877
871919
|
}
|
|
871878
871920
|
const additionalFilepaths = project.apiWorkspaces.flatMap((workspace) => workspace.getAbsoluteFilePaths());
|
|
871921
|
+
if (previewResult != null) {
|
|
871922
|
+
const externalDocsPaths = getExternalDocsWatchPaths(absoluteFilePathToFern, previewResult.docsDefinition);
|
|
871923
|
+
if (externalDocsPaths.length > 0) {
|
|
871924
|
+
context3.logger.debug(`Watching external docs directories: ${externalDocsPaths.join(", ")}`);
|
|
871925
|
+
additionalFilepaths.push(...externalDocsPaths);
|
|
871926
|
+
}
|
|
871927
|
+
}
|
|
871879
871928
|
const watcher = await createDocsPreviewWatcher({
|
|
871880
871929
|
absoluteFilePathToFern,
|
|
871881
871930
|
additionalFilepaths,
|
|
@@ -872439,6 +872488,13 @@ ${err.stack}`);
|
|
|
872439
872488
|
}
|
|
872440
872489
|
}
|
|
872441
872490
|
const additionalFilepaths = project.apiWorkspaces.flatMap((workspace) => workspace.getAbsoluteFilePaths());
|
|
872491
|
+
if (previewResult != null) {
|
|
872492
|
+
const externalDocsPaths = getExternalDocsWatchPaths(absoluteFilePathToFern, previewResult.docsDefinition);
|
|
872493
|
+
if (externalDocsPaths.length > 0) {
|
|
872494
|
+
context3.logger.debug(`Watching external docs directories: ${externalDocsPaths.join(", ")}`);
|
|
872495
|
+
additionalFilepaths.push(...externalDocsPaths);
|
|
872496
|
+
}
|
|
872497
|
+
}
|
|
872442
872498
|
const bundleRoot = bundlePath ? AbsoluteFilePath2.of(import_path72.default.resolve(bundlePath)) : getPathToBundleFolder({ cacheDir });
|
|
872443
872499
|
const watcher = await createDocsPreviewWatcher({
|
|
872444
872500
|
absoluteFilePathToFern,
|
|
@@ -900470,7 +900526,7 @@ var LegacyDocsPublisher = class {
|
|
|
900470
900526
|
previewId,
|
|
900471
900527
|
disableTemplates: void 0,
|
|
900472
900528
|
skipUpload,
|
|
900473
|
-
cliVersion: "5.
|
|
900529
|
+
cliVersion: "5.56.0",
|
|
900474
900530
|
loginCommand: "fern auth login"
|
|
900475
900531
|
});
|
|
900476
900532
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -957234,20 +957290,20 @@ Please check your internet connection and npm configuration, then try again.`,
|
|
|
957234
957290
|
* Returns migrations where: from < migration.version <= to
|
|
957235
957291
|
*/
|
|
957236
957292
|
filterMigrations({ migrations, from: from4, to: to2 }) {
|
|
957237
|
-
return migrations.filter((
|
|
957238
|
-
const migrationVersion = import_semver14.default.parse(
|
|
957293
|
+
return migrations.filter((migration24) => {
|
|
957294
|
+
const migrationVersion = import_semver14.default.parse(migration24.version);
|
|
957239
957295
|
const fromVersion = import_semver14.default.parse(from4);
|
|
957240
957296
|
const toVersion = import_semver14.default.parse(to2);
|
|
957241
957297
|
if (migrationVersion == null) {
|
|
957242
|
-
this.logger.warn(`Migration has invalid semver version: ${
|
|
957298
|
+
this.logger.warn(`Migration has invalid semver version: ${migration24.version}. Skipping.`);
|
|
957243
957299
|
return false;
|
|
957244
957300
|
}
|
|
957245
957301
|
if (fromVersion == null) {
|
|
957246
|
-
this.logger.warn(`Invalid 'from' version: ${from4}. Skipping migration ${
|
|
957302
|
+
this.logger.warn(`Invalid 'from' version: ${from4}. Skipping migration ${migration24.version}.`);
|
|
957247
957303
|
return false;
|
|
957248
957304
|
}
|
|
957249
957305
|
if (toVersion == null) {
|
|
957250
|
-
this.logger.warn(`Invalid 'to' version: ${to2}. Skipping migration ${
|
|
957306
|
+
this.logger.warn(`Invalid 'to' version: ${to2}. Skipping migration ${migration24.version}.`);
|
|
957251
957307
|
return false;
|
|
957252
957308
|
}
|
|
957253
957309
|
return import_semver14.default.gt(migrationVersion, fromVersion) && import_semver14.default.lte(migrationVersion, toVersion);
|
|
@@ -957267,17 +957323,17 @@ Please check your internet connection and npm configuration, then try again.`,
|
|
|
957267
957323
|
runMigrations({ migrations, config: config5 }) {
|
|
957268
957324
|
let currentConfig = config5;
|
|
957269
957325
|
const appliedVersions = [];
|
|
957270
|
-
for (const
|
|
957326
|
+
for (const migration24 of migrations) {
|
|
957271
957327
|
try {
|
|
957272
|
-
currentConfig =
|
|
957328
|
+
currentConfig = migration24.migrateGeneratorConfig({
|
|
957273
957329
|
config: currentConfig,
|
|
957274
957330
|
context: { logger: this.logger }
|
|
957275
957331
|
});
|
|
957276
|
-
appliedVersions.push(
|
|
957332
|
+
appliedVersions.push(migration24.version);
|
|
957277
957333
|
} catch (error50) {
|
|
957278
957334
|
const errorMessage = extractErrorMessage(error50);
|
|
957279
957335
|
throw new CliError({
|
|
957280
|
-
message: `Failed to apply migration for version ${
|
|
957336
|
+
message: `Failed to apply migration for version ${migration24.version}.
|
|
957281
957337
|
|
|
957282
957338
|
Reason: ${errorMessage}
|
|
957283
957339
|
|
|
@@ -957473,9 +957529,9 @@ var UpdateCommand = class {
|
|
|
957473
957529
|
context3.stderr.info(`${Icons.success} ${source_default.green("Updated SDK targets:")}`);
|
|
957474
957530
|
for (const update of updates) {
|
|
957475
957531
|
context3.stderr.info(source_default.green(` ${update.name}: ${source_default.dim(update.currentVersion)} \u2192 ${update.latestVersion}`));
|
|
957476
|
-
const
|
|
957477
|
-
if (
|
|
957478
|
-
context3.stderr.info(source_default.dim(` Applied ${
|
|
957532
|
+
const migration24 = migrationInfo.get(update.name);
|
|
957533
|
+
if (migration24 != null) {
|
|
957534
|
+
context3.stderr.info(source_default.dim(` Applied ${migration24.migrationsApplied} config migration(s): ${migration24.appliedVersions.join(", ")}`));
|
|
957479
957535
|
}
|
|
957480
957536
|
if (update.changelogUrl != null) {
|
|
957481
957537
|
context3.stderr.info(source_default.dim(` Changelog: ${update.changelogUrl}`));
|
|
@@ -966739,7 +966795,7 @@ function getAutomationContextFromEnv() {
|
|
|
966739
966795
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
966740
966796
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
966741
966797
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
966742
|
-
cli_version: "5.
|
|
966798
|
+
cli_version: "5.56.0"
|
|
966743
966799
|
};
|
|
966744
966800
|
}
|
|
966745
966801
|
function isAutomationMode() {
|
|
@@ -967571,7 +967627,7 @@ var CliContext = class _CliContext {
|
|
|
967571
967627
|
if (false) {
|
|
967572
967628
|
this.logger.error("CLI_VERSION is not defined");
|
|
967573
967629
|
}
|
|
967574
|
-
return "5.
|
|
967630
|
+
return "5.56.0";
|
|
967575
967631
|
}
|
|
967576
967632
|
getCliName() {
|
|
967577
967633
|
if (false) {
|
|
@@ -968386,20 +968442,20 @@ If the problem persists, you can:
|
|
|
968386
968442
|
}
|
|
968387
968443
|
function filterMigrations(params2) {
|
|
968388
968444
|
const { migrations, from: from4, to: to2, logger: logger4 } = params2;
|
|
968389
|
-
return migrations.filter((
|
|
968390
|
-
const migrationVersion = import_semver15.default.parse(
|
|
968445
|
+
return migrations.filter((migration24) => {
|
|
968446
|
+
const migrationVersion = import_semver15.default.parse(migration24.version);
|
|
968391
968447
|
const fromVersion = import_semver15.default.parse(from4);
|
|
968392
968448
|
const toVersion = import_semver15.default.parse(to2);
|
|
968393
968449
|
if (migrationVersion == null) {
|
|
968394
|
-
logger4.warn(`Migration has invalid semver version: ${
|
|
968450
|
+
logger4.warn(`Migration has invalid semver version: ${migration24.version}. Skipping this migration.`);
|
|
968395
968451
|
return false;
|
|
968396
968452
|
}
|
|
968397
968453
|
if (fromVersion == null) {
|
|
968398
|
-
logger4.warn(`Invalid 'from' version: ${from4}. Skipping migration ${
|
|
968454
|
+
logger4.warn(`Invalid 'from' version: ${from4}. Skipping migration ${migration24.version}.`);
|
|
968399
968455
|
return false;
|
|
968400
968456
|
}
|
|
968401
968457
|
if (toVersion == null) {
|
|
968402
|
-
logger4.warn(`Invalid 'to' version: ${to2}. Skipping migration ${
|
|
968458
|
+
logger4.warn(`Invalid 'to' version: ${to2}. Skipping migration ${migration24.version}.`);
|
|
968403
968459
|
return false;
|
|
968404
968460
|
}
|
|
968405
968461
|
return import_semver15.default.gt(migrationVersion, fromVersion) && import_semver15.default.lte(migrationVersion, toVersion);
|
|
@@ -968419,17 +968475,17 @@ function runMigrations(params2) {
|
|
|
968419
968475
|
const { migrations, logger: logger4 } = params2;
|
|
968420
968476
|
let currentConfig = params2.config;
|
|
968421
968477
|
const appliedVersions = [];
|
|
968422
|
-
for (const
|
|
968478
|
+
for (const migration24 of migrations) {
|
|
968423
968479
|
try {
|
|
968424
968480
|
const context3 = {
|
|
968425
968481
|
logger: logger4
|
|
968426
968482
|
};
|
|
968427
|
-
currentConfig =
|
|
968428
|
-
appliedVersions.push(
|
|
968483
|
+
currentConfig = migration24.migrateGeneratorConfig({ config: currentConfig, context: context3 });
|
|
968484
|
+
appliedVersions.push(migration24.version);
|
|
968429
968485
|
} catch (error50) {
|
|
968430
968486
|
const errorMessage = extractErrorMessage(error50);
|
|
968431
968487
|
throw new CliError({
|
|
968432
|
-
message: `Failed to apply migration for version ${
|
|
968488
|
+
message: `Failed to apply migration for version ${migration24.version}.
|
|
968433
968489
|
|
|
968434
968490
|
Reason: ${errorMessage}
|
|
968435
968491
|
|
|
@@ -970825,7 +970881,7 @@ function listPreviewGroups({
|
|
|
970825
970881
|
init_lib19();
|
|
970826
970882
|
init_lib6();
|
|
970827
970883
|
init_source();
|
|
970828
|
-
var
|
|
970884
|
+
var import_promises195 = require("fs/promises");
|
|
970829
970885
|
|
|
970830
970886
|
// ../cli-migrations/lib/runMigrations.js
|
|
970831
970887
|
init_lib4();
|
|
@@ -973899,6 +973955,159 @@ var versionMigrations22 = {
|
|
|
973899
973955
|
};
|
|
973900
973956
|
var __default22 = versionMigrations22;
|
|
973901
973957
|
|
|
973958
|
+
// ../cli-migrations/lib/migrations/4.106.1/disable-disambiguate-request-names/migration.js
|
|
973959
|
+
init_lib19();
|
|
973960
|
+
init_lib8();
|
|
973961
|
+
init_source();
|
|
973962
|
+
var import_promises193 = require("fs/promises");
|
|
973963
|
+
init_js_yaml();
|
|
973964
|
+
var migration23 = {
|
|
973965
|
+
name: "disable-disambiguate-request-names",
|
|
973966
|
+
summary: `Sets 'disambiguate-request-names: false' for existing OpenAPI specs to preserve backwards compatibility.
|
|
973967
|
+
Starting with version 4.106.1, generated request wrapper names that collide with component schema names
|
|
973968
|
+
are disambiguated by replacing the "Request" suffix with "Body". This migration explicitly disables that
|
|
973969
|
+
behavior so existing projects keep their current request wrapper names.`,
|
|
973970
|
+
run: async ({ context: context3 }) => {
|
|
973971
|
+
const absolutePathToFernDirectory = await getFernDirectory();
|
|
973972
|
+
if (absolutePathToFernDirectory == null) {
|
|
973973
|
+
context3.failAndThrow("Fern directory not found. Failed to run migration");
|
|
973974
|
+
return;
|
|
973975
|
+
}
|
|
973976
|
+
const { files, directories } = await getFilesAndDirectories8(absolutePathToFernDirectory);
|
|
973977
|
+
const apisDirectory = directories.find((dir) => dir.name === "apis");
|
|
973978
|
+
if (apisDirectory == null) {
|
|
973979
|
+
await updateGeneratorsYml6({
|
|
973980
|
+
context: context3,
|
|
973981
|
+
files
|
|
973982
|
+
});
|
|
973983
|
+
} else {
|
|
973984
|
+
for (const workspace of apisDirectory.contents) {
|
|
973985
|
+
if (workspace.type !== "directory") {
|
|
973986
|
+
continue;
|
|
973987
|
+
}
|
|
973988
|
+
const absoluteFilepathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of("apis"), RelativeFilePath2.of(workspace.name));
|
|
973989
|
+
await updateGeneratorsYml6({
|
|
973990
|
+
context: context3,
|
|
973991
|
+
...await getFilesAndDirectories8(join8(absoluteFilepathToWorkspace))
|
|
973992
|
+
});
|
|
973993
|
+
}
|
|
973994
|
+
}
|
|
973995
|
+
}
|
|
973996
|
+
};
|
|
973997
|
+
async function updateGeneratorsYml6({ context: context3, files }) {
|
|
973998
|
+
const generatorsYmlFile = files.find((file4) => file4.name === "generators.yml" || file4.name === "generators.yaml");
|
|
973999
|
+
if (generatorsYmlFile == null) {
|
|
974000
|
+
return;
|
|
974001
|
+
}
|
|
974002
|
+
const generatorsYmlContents = index_vite_proxy_tmp_default.load(generatorsYmlFile.contents);
|
|
974003
|
+
if (generatorsYmlContents == null || typeof generatorsYmlContents !== "object") {
|
|
974004
|
+
return;
|
|
974005
|
+
}
|
|
974006
|
+
let modified = false;
|
|
974007
|
+
const doc = generatorsYmlContents;
|
|
974008
|
+
if ("api" in doc && typeof doc.api === "object" && doc.api != null) {
|
|
974009
|
+
const api2 = doc.api;
|
|
974010
|
+
if ("specs" in api2 && Array.isArray(api2.specs)) {
|
|
974011
|
+
for (const spec of api2.specs) {
|
|
974012
|
+
if (typeof spec !== "object" || spec == null) {
|
|
974013
|
+
continue;
|
|
974014
|
+
}
|
|
974015
|
+
const specObj = spec;
|
|
974016
|
+
if (!("openapi" in specObj)) {
|
|
974017
|
+
continue;
|
|
974018
|
+
}
|
|
974019
|
+
if (!("settings" in specObj) || typeof specObj.settings !== "object" || specObj.settings == null) {
|
|
974020
|
+
specObj.settings = {};
|
|
974021
|
+
}
|
|
974022
|
+
const settings = specObj.settings;
|
|
974023
|
+
if (!("disambiguate-request-names" in settings)) {
|
|
974024
|
+
settings["disambiguate-request-names"] = false;
|
|
974025
|
+
modified = true;
|
|
974026
|
+
}
|
|
974027
|
+
}
|
|
974028
|
+
}
|
|
974029
|
+
if ("settings" in api2 && typeof api2.settings === "object" && api2.settings != null) {
|
|
974030
|
+
const settings = api2.settings;
|
|
974031
|
+
if (!("disambiguate-request-names" in settings)) {
|
|
974032
|
+
settings["disambiguate-request-names"] = false;
|
|
974033
|
+
modified = true;
|
|
974034
|
+
}
|
|
974035
|
+
} else if (!("specs" in api2)) {
|
|
974036
|
+
if (!("settings" in api2)) {
|
|
974037
|
+
api2.settings = { "disambiguate-request-names": false };
|
|
974038
|
+
modified = true;
|
|
974039
|
+
}
|
|
974040
|
+
}
|
|
974041
|
+
}
|
|
974042
|
+
if ("groups" in doc && typeof doc.groups === "object" && doc.groups != null) {
|
|
974043
|
+
const groups2 = doc.groups;
|
|
974044
|
+
for (const groupName of Object.keys(groups2)) {
|
|
974045
|
+
const group = groups2[groupName];
|
|
974046
|
+
if (typeof group !== "object" || group == null) {
|
|
974047
|
+
continue;
|
|
974048
|
+
}
|
|
974049
|
+
const groupObj = group;
|
|
974050
|
+
if (!("generators" in groupObj) || !Array.isArray(groupObj.generators)) {
|
|
974051
|
+
continue;
|
|
974052
|
+
}
|
|
974053
|
+
for (const generator of groupObj.generators) {
|
|
974054
|
+
if (typeof generator !== "object" || generator == null) {
|
|
974055
|
+
continue;
|
|
974056
|
+
}
|
|
974057
|
+
const generatorObj = generator;
|
|
974058
|
+
if (!("api" in generatorObj) || typeof generatorObj.api !== "object" || generatorObj.api == null) {
|
|
974059
|
+
continue;
|
|
974060
|
+
}
|
|
974061
|
+
const apiObj = generatorObj.api;
|
|
974062
|
+
if (!("settings" in apiObj) || typeof apiObj.settings !== "object" || apiObj.settings == null) {
|
|
974063
|
+
continue;
|
|
974064
|
+
}
|
|
974065
|
+
const settings = apiObj.settings;
|
|
974066
|
+
if (!("disambiguate-request-names" in settings)) {
|
|
974067
|
+
settings["disambiguate-request-names"] = false;
|
|
974068
|
+
modified = true;
|
|
974069
|
+
}
|
|
974070
|
+
}
|
|
974071
|
+
}
|
|
974072
|
+
}
|
|
974073
|
+
if (!modified) {
|
|
974074
|
+
context3.logger.debug("No OpenAPI specs found for disambiguate-request-names migration. Skipping...");
|
|
974075
|
+
return;
|
|
974076
|
+
}
|
|
974077
|
+
const firstLine = generatorsYmlFile.contents.split("\n")[0];
|
|
974078
|
+
let schemaComment;
|
|
974079
|
+
if (firstLine?.startsWith("# yaml-language-server:")) {
|
|
974080
|
+
schemaComment = firstLine;
|
|
974081
|
+
}
|
|
974082
|
+
let documentToWrite = index_vite_proxy_tmp_default.dump(generatorsYmlContents);
|
|
974083
|
+
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
974084
|
+
documentToWrite = `${schemaComment}
|
|
974085
|
+
${documentToWrite}`;
|
|
974086
|
+
}
|
|
974087
|
+
await (0, import_promises193.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
974088
|
+
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
974089
|
+
}
|
|
974090
|
+
async function getFilesAndDirectories8(absoluteFilepath) {
|
|
974091
|
+
const contents = await getDirectoryContents(absoluteFilepath);
|
|
974092
|
+
const files = [];
|
|
974093
|
+
const directories = [];
|
|
974094
|
+
for (const fileOrFolder of contents) {
|
|
974095
|
+
if (fileOrFolder.type === "directory") {
|
|
974096
|
+
directories.push(fileOrFolder);
|
|
974097
|
+
} else {
|
|
974098
|
+
files.push(fileOrFolder);
|
|
974099
|
+
}
|
|
974100
|
+
}
|
|
974101
|
+
return { files, directories };
|
|
974102
|
+
}
|
|
974103
|
+
|
|
974104
|
+
// ../cli-migrations/lib/migrations/4.106.1/index.js
|
|
974105
|
+
var versionMigrations23 = {
|
|
974106
|
+
version: "4.106.1",
|
|
974107
|
+
migrations: [migration23]
|
|
974108
|
+
};
|
|
974109
|
+
var __default23 = versionMigrations23;
|
|
974110
|
+
|
|
973902
974111
|
// ../cli-migrations/lib/migrations/all.js
|
|
973903
974112
|
var ALL_MIGRATIONS = [
|
|
973904
974113
|
__default,
|
|
@@ -973922,7 +974131,8 @@ var ALL_MIGRATIONS = [
|
|
|
973922
974131
|
__default19,
|
|
973923
974132
|
__default20,
|
|
973924
974133
|
__default21,
|
|
973925
|
-
__default22
|
|
974134
|
+
__default22,
|
|
974135
|
+
__default23
|
|
973926
974136
|
];
|
|
973927
974137
|
|
|
973928
974138
|
// ../cli-migrations/lib/migrations/getMigrationsToRun.js
|
|
@@ -973951,7 +974161,7 @@ async function runMigrations2({ fromVersion, toVersion, context: context3, yes =
|
|
|
973951
974161
|
context3.logger.debug("No migrations needed.");
|
|
973952
974162
|
return;
|
|
973953
974163
|
} else {
|
|
973954
|
-
context3.logger.debug("Migrations need to be run:\n" + migrationsToRun.flatMap(({ migrations }) => migrations.map((
|
|
974164
|
+
context3.logger.debug("Migrations need to be run:\n" + migrationsToRun.flatMap(({ migrations }) => migrations.map((migration24) => ` - ${migration24.name}`)).join("\n"));
|
|
973955
974165
|
}
|
|
973956
974166
|
if (yes) {
|
|
973957
974167
|
context3.logger.debug("Skipping migration confirmation prompt because --yes was provided.");
|
|
@@ -973966,13 +974176,13 @@ async function runMigrations2({ fromVersion, toVersion, context: context3, yes =
|
|
|
973966
974176
|
return;
|
|
973967
974177
|
}
|
|
973968
974178
|
}
|
|
973969
|
-
const migrationsWithTasks = migrationsToRun.flatMap(({ migrations, version: version7 }) => migrations.map((
|
|
973970
|
-
migration:
|
|
973971
|
-
context: context3.addInteractiveTask({ name: `${version7} ${
|
|
974179
|
+
const migrationsWithTasks = migrationsToRun.flatMap(({ migrations, version: version7 }) => migrations.map((migration24) => ({
|
|
974180
|
+
migration: migration24,
|
|
974181
|
+
context: context3.addInteractiveTask({ name: `${version7} ${migration24.name}` })
|
|
973972
974182
|
})));
|
|
973973
|
-
for (const { migration:
|
|
974183
|
+
for (const { migration: migration24, context: contextForMigration } of migrationsWithTasks) {
|
|
973974
974184
|
const finishableContext = contextForMigration.start();
|
|
973975
|
-
await
|
|
974185
|
+
await migration24.run({
|
|
973976
974186
|
context: finishableContext
|
|
973977
974187
|
});
|
|
973978
974188
|
finishableContext.finish();
|
|
@@ -973986,11 +974196,11 @@ async function askForConfirmation2(migrationsToRun) {
|
|
|
973986
974196
|
const QUESTION_KEY = "wantsToContinue";
|
|
973987
974197
|
const lines = ["Some migrations need to be run:"];
|
|
973988
974198
|
for (const { migrations } of migrationsToRun) {
|
|
973989
|
-
for (const
|
|
974199
|
+
for (const migration24 of migrations) {
|
|
973990
974200
|
lines.push(addPrefixToString({
|
|
973991
974201
|
prefix: " \u25E6 ",
|
|
973992
|
-
content: `${
|
|
973993
|
-
${source_default.dim(
|
|
974202
|
+
content: `${migration24.name}
|
|
974203
|
+
${source_default.dim(migration24.summary)}`
|
|
973994
974204
|
}));
|
|
973995
974205
|
}
|
|
973996
974206
|
}
|
|
@@ -974009,7 +974219,7 @@ init_lib33();
|
|
|
974009
974219
|
init_lib27();
|
|
974010
974220
|
init_lib6();
|
|
974011
974221
|
init_source();
|
|
974012
|
-
var
|
|
974222
|
+
var import_promises194 = require("fs/promises");
|
|
974013
974223
|
|
|
974014
974224
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
974015
974225
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -975065,7 +975275,7 @@ async function upgrade({
|
|
|
975065
975275
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
975066
975276
|
draft.version = resolvedTargetVersion;
|
|
975067
975277
|
});
|
|
975068
|
-
await (0,
|
|
975278
|
+
await (0, import_promises194.writeFile)(
|
|
975069
975279
|
projectConfig2._absolutePath,
|
|
975070
975280
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
975071
975281
|
);
|
|
@@ -975222,7 +975432,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
975222
975432
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
975223
975433
|
});
|
|
975224
975434
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
975225
|
-
await (0,
|
|
975435
|
+
await (0, import_promises195.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
975226
975436
|
}
|
|
975227
975437
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
975228
975438
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -975700,7 +975910,7 @@ async function previewDocsWorkspace({
|
|
|
975700
975910
|
// src/commands/docs-diff/docsDiff.ts
|
|
975701
975911
|
init_lib8();
|
|
975702
975912
|
init_lib6();
|
|
975703
|
-
var
|
|
975913
|
+
var import_promises196 = require("fs/promises");
|
|
975704
975914
|
var import_pngjs2 = __toESM(require_png(), 1);
|
|
975705
975915
|
async function getSlugForFiles2({
|
|
975706
975916
|
previewUrl,
|
|
@@ -975923,8 +976133,8 @@ async function generateComparisons2({
|
|
|
975923
976133
|
afterPath,
|
|
975924
976134
|
comparisonBasePath
|
|
975925
976135
|
}) {
|
|
975926
|
-
const beforePng = import_pngjs2.PNG.sync.read(await (0,
|
|
975927
|
-
const afterPng = import_pngjs2.PNG.sync.read(await (0,
|
|
976136
|
+
const beforePng = import_pngjs2.PNG.sync.read(await (0, import_promises196.readFile)(beforePath));
|
|
976137
|
+
const afterPng = import_pngjs2.PNG.sync.read(await (0, import_promises196.readFile)(afterPath));
|
|
975928
976138
|
const beforeOriginalHeight = beforePng.height;
|
|
975929
976139
|
const afterOriginalHeight = afterPng.height;
|
|
975930
976140
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -975962,7 +976172,7 @@ async function generateComparisons2({
|
|
|
975962
976172
|
const sideBySide = createSideBySideComparison2(croppedBefore, croppedAfter, 20, true);
|
|
975963
976173
|
const outPath = `${base4}-region-${i5 + 1}.png`;
|
|
975964
976174
|
const pngBuffer = import_pngjs2.PNG.sync.write(sideBySide);
|
|
975965
|
-
await (0,
|
|
976175
|
+
await (0, import_promises196.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
975966
976176
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
975967
976177
|
}
|
|
975968
976178
|
return results;
|
|
@@ -976041,7 +976251,7 @@ async function docsDiff({
|
|
|
976041
976251
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
976042
976252
|
);
|
|
976043
976253
|
if (!await doesPathExist(outputPath)) {
|
|
976044
|
-
await (0,
|
|
976254
|
+
await (0, import_promises196.mkdir)(outputPath, { recursive: true });
|
|
976045
976255
|
}
|
|
976046
976256
|
const results = [];
|
|
976047
976257
|
await cliContext.runTask(async (context3) => {
|
|
@@ -976469,7 +976679,7 @@ init_lib6();
|
|
|
976469
976679
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
976470
976680
|
init_lib12();
|
|
976471
976681
|
init_lib8();
|
|
976472
|
-
var
|
|
976682
|
+
var import_promises197 = require("fs/promises");
|
|
976473
976683
|
init_js_yaml();
|
|
976474
976684
|
var import_path109 = __toESM(require("path"), 1);
|
|
976475
976685
|
var ThemeExporter = class {
|
|
@@ -976482,18 +976692,18 @@ var ThemeExporter = class {
|
|
|
976482
976692
|
const docsDir = import_path109.default.dirname(docsYmlPath);
|
|
976483
976693
|
const outDir = output2 != null ? import_path109.default.resolve(process.cwd(), output2) : import_path109.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
976484
976694
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
976485
|
-
const raw = index_vite_proxy_tmp_default.load(await (0,
|
|
976695
|
+
const raw = index_vite_proxy_tmp_default.load(await (0, import_promises197.readFile)(docsYmlPath, "utf-8"));
|
|
976486
976696
|
const themeConfig = {};
|
|
976487
976697
|
for (const [k4, v3] of Object.entries(raw)) {
|
|
976488
976698
|
if (docs_yml_exports.THEME_ELIGIBLE_YAML_KEYS.has(k4)) {
|
|
976489
976699
|
themeConfig[k4] = v3;
|
|
976490
976700
|
}
|
|
976491
976701
|
}
|
|
976492
|
-
await (0,
|
|
976702
|
+
await (0, import_promises197.mkdir)(outDir, { recursive: true });
|
|
976493
976703
|
const assetsDir = import_path109.default.join(outDir, "assets");
|
|
976494
|
-
await (0,
|
|
976704
|
+
await (0, import_promises197.mkdir)(assetsDir, { recursive: true });
|
|
976495
976705
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
976496
|
-
await (0,
|
|
976706
|
+
await (0, import_promises197.writeFile)(import_path109.default.join(outDir, "theme.yml"), index_vite_proxy_tmp_default.dump(exported), "utf-8");
|
|
976497
976707
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
976498
976708
|
}
|
|
976499
976709
|
};
|
|
@@ -976507,8 +976717,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
976507
976717
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path109.default.basename(abs) : relFromProject : relFromSource;
|
|
976508
976718
|
const dest = import_path109.default.join(assetsDir, destRelative);
|
|
976509
976719
|
try {
|
|
976510
|
-
await (0,
|
|
976511
|
-
await (0,
|
|
976720
|
+
await (0, import_promises197.mkdir)(import_path109.default.dirname(dest), { recursive: true });
|
|
976721
|
+
await (0, import_promises197.copyFile)(abs, dest);
|
|
976512
976722
|
return `./assets/${destRelative.split(import_path109.default.sep).join("/")}`;
|
|
976513
976723
|
} catch {
|
|
976514
976724
|
return obj;
|
|
@@ -976600,7 +976810,7 @@ async function listDocsThemes({
|
|
|
976600
976810
|
|
|
976601
976811
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
976602
976812
|
init_lib6();
|
|
976603
|
-
var
|
|
976813
|
+
var import_promises199 = require("fs/promises");
|
|
976604
976814
|
init_js_yaml();
|
|
976605
976815
|
var import_path111 = __toESM(require("path"), 1);
|
|
976606
976816
|
|
|
@@ -976609,7 +976819,7 @@ init_lib8();
|
|
|
976609
976819
|
init_lib6();
|
|
976610
976820
|
var import_child_process13 = require("child_process");
|
|
976611
976821
|
var import_crypto10 = require("crypto");
|
|
976612
|
-
var
|
|
976822
|
+
var import_promises198 = require("fs/promises");
|
|
976613
976823
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
976614
976824
|
var import_path110 = __toESM(require("path"), 1);
|
|
976615
976825
|
function getGitRoot() {
|
|
@@ -976653,7 +976863,7 @@ var ThemeConfigProcessor = class {
|
|
|
976653
976863
|
filePaths.map(async (filePath) => {
|
|
976654
976864
|
const abs = import_path110.default.resolve(this.themeDir, filePath);
|
|
976655
976865
|
try {
|
|
976656
|
-
await (0,
|
|
976866
|
+
await (0, import_promises198.access)(abs);
|
|
976657
976867
|
} catch {
|
|
976658
976868
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
976659
976869
|
}
|
|
@@ -976818,7 +977028,7 @@ ${errors4.map((e2) => ` - ${e2}`).join("\n")}`,
|
|
|
976818
977028
|
return { config: cfg, filesUploaded };
|
|
976819
977029
|
}
|
|
976820
977030
|
async uploadFileToCas(absolutePath) {
|
|
976821
|
-
const content5 = await (0,
|
|
977031
|
+
const content5 = await (0, import_promises198.readFile)(absolutePath);
|
|
976822
977032
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
976823
977033
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
976824
977034
|
return this.uploadToCas(content5, contentType, bindPath, import_path110.default.basename(absolutePath));
|
|
@@ -976933,7 +977143,7 @@ async function uploadDocsTheme({
|
|
|
976933
977143
|
await cliContext.runTask(async (context3) => {
|
|
976934
977144
|
let rawYaml;
|
|
976935
977145
|
try {
|
|
976936
|
-
const content5 = await (0,
|
|
977146
|
+
const content5 = await (0, import_promises199.readFile)(themeYmlPath, "utf-8");
|
|
976937
977147
|
rawYaml = index_vite_proxy_tmp_default.load(content5, { schema: index_vite_proxy_tmp_default.JSON_SCHEMA });
|
|
976938
977148
|
} catch {
|
|
976939
977149
|
context3.failAndThrow(
|
|
@@ -976988,7 +977198,7 @@ async function uploadDocsTheme({
|
|
|
976988
977198
|
// src/commands/downgrade/downgrade.ts
|
|
976989
977199
|
init_lib19();
|
|
976990
977200
|
init_lib6();
|
|
976991
|
-
var
|
|
977201
|
+
var import_promises200 = require("fs/promises");
|
|
976992
977202
|
function ensureFinalNewline2(content5) {
|
|
976993
977203
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
976994
977204
|
}
|
|
@@ -977013,7 +977223,7 @@ async function downgrade({
|
|
|
977013
977223
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
977014
977224
|
draft.version = targetVersion;
|
|
977015
977225
|
});
|
|
977016
|
-
await (0,
|
|
977226
|
+
await (0, import_promises200.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
977017
977227
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
977018
977228
|
}
|
|
977019
977229
|
|
|
@@ -977021,7 +977231,7 @@ async function downgrade({
|
|
|
977021
977231
|
init_lib36();
|
|
977022
977232
|
init_lib8();
|
|
977023
977233
|
init_lib22();
|
|
977024
|
-
var
|
|
977234
|
+
var import_promises201 = require("fs/promises");
|
|
977025
977235
|
init_js_yaml();
|
|
977026
977236
|
|
|
977027
977237
|
// src/commands/export/convertIrToOpenApi.ts
|
|
@@ -978443,8 +978653,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
978443
978653
|
ir: ir3,
|
|
978444
978654
|
mode: "openapi"
|
|
978445
978655
|
});
|
|
978446
|
-
await (0,
|
|
978447
|
-
await (0,
|
|
978656
|
+
await (0, import_promises201.mkdir)(dirname6(outputPath), { recursive: true });
|
|
978657
|
+
await (0, import_promises201.writeFile)(
|
|
978448
978658
|
outputPath,
|
|
978449
978659
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : index_vite_proxy_tmp_default.dump(openapi, { indent: indent4 })
|
|
978450
978660
|
);
|
|
@@ -979050,7 +979260,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
979050
979260
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
979051
979261
|
init_lib8();
|
|
979052
979262
|
init_lib6();
|
|
979053
|
-
var
|
|
979263
|
+
var import_promises202 = require("fs/promises");
|
|
979054
979264
|
init_js_yaml();
|
|
979055
979265
|
async function compareOpenAPISpecs({
|
|
979056
979266
|
originalPath,
|
|
@@ -979092,12 +979302,12 @@ async function compareOpenAPISpecs({
|
|
|
979092
979302
|
}
|
|
979093
979303
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
979094
979304
|
}
|
|
979095
|
-
await (0,
|
|
979305
|
+
await (0, import_promises202.writeFile)(outputPath, index_vite_proxy_tmp_default.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
979096
979306
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
979097
979307
|
});
|
|
979098
979308
|
}
|
|
979099
979309
|
async function loadSpec2(filepath, context3) {
|
|
979100
|
-
const contents = await (0,
|
|
979310
|
+
const contents = await (0, import_promises202.readFile)(filepath, "utf8");
|
|
979101
979311
|
try {
|
|
979102
979312
|
return JSON.parse(contents);
|
|
979103
979313
|
} catch {
|
|
@@ -979205,7 +979415,7 @@ init_lib35();
|
|
|
979205
979415
|
init_lib16();
|
|
979206
979416
|
init_lib15();
|
|
979207
979417
|
init_lib6();
|
|
979208
|
-
var
|
|
979418
|
+
var import_promises203 = require("fs/promises");
|
|
979209
979419
|
init_js_yaml();
|
|
979210
979420
|
async function writeOverridesForWorkspaces({
|
|
979211
979421
|
project,
|
|
@@ -979231,7 +979441,7 @@ async function writeOverridesForWorkspaces({
|
|
|
979231
979441
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
979232
979442
|
let parsedOverrides = null;
|
|
979233
979443
|
try {
|
|
979234
|
-
const contents = (await (0,
|
|
979444
|
+
const contents = (await (0, import_promises203.readFile)(overridesFilepath, "utf8")).toString();
|
|
979235
979445
|
try {
|
|
979236
979446
|
parsedOverrides = JSON.parse(contents);
|
|
979237
979447
|
} catch (err) {
|
|
@@ -979296,7 +979506,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979296
979506
|
for (const overridesPath of overridesPaths) {
|
|
979297
979507
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
979298
979508
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides, includeModels, context: context3 });
|
|
979299
|
-
await (0,
|
|
979509
|
+
await (0, import_promises203.writeFile)(overridesPath, index_vite_proxy_tmp_default.dump(content5));
|
|
979300
979510
|
}
|
|
979301
979511
|
} else {
|
|
979302
979512
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -979310,7 +979520,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979310
979520
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
979311
979521
|
}
|
|
979312
979522
|
}
|
|
979313
|
-
await (0,
|
|
979523
|
+
await (0, import_promises203.writeFile)(
|
|
979314
979524
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
979315
979525
|
index_vite_proxy_tmp_default.dump(content5)
|
|
979316
979526
|
);
|
|
@@ -979769,7 +979979,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
979769
979979
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
979770
979980
|
init_lib21();
|
|
979771
979981
|
init_source();
|
|
979772
|
-
var
|
|
979982
|
+
var import_promises204 = require("fs/promises");
|
|
979773
979983
|
async function generateJsonschemaForWorkspaces({
|
|
979774
979984
|
typeLocator,
|
|
979775
979985
|
project,
|
|
@@ -979817,9 +980027,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
979817
980027
|
context: context3
|
|
979818
980028
|
});
|
|
979819
980029
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
979820
|
-
await (0,
|
|
980030
|
+
await (0, import_promises204.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
979821
980031
|
}
|
|
979822
|
-
await (0,
|
|
980032
|
+
await (0, import_promises204.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
979823
980033
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
979824
980034
|
});
|
|
979825
980035
|
})
|
|
@@ -979829,7 +980039,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
979829
980039
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
979830
980040
|
init_lib8();
|
|
979831
980041
|
init_lib6();
|
|
979832
|
-
var
|
|
980042
|
+
var import_promises205 = require("fs/promises");
|
|
979833
980043
|
init_js_yaml();
|
|
979834
980044
|
var HTTP_METHODS4 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
979835
980045
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -979858,11 +980068,11 @@ async function mergeOpenAPIWithOverrides({
|
|
|
979858
980068
|
if (split2) {
|
|
979859
980069
|
const examples = extractEnrichedExamples2(openapi, merged);
|
|
979860
980070
|
const output2 = isJson ? JSON.stringify(examples, null, 2) : index_vite_proxy_tmp_default.dump(examples, { lineWidth: -1, noRefs: true });
|
|
979861
|
-
await (0,
|
|
980071
|
+
await (0, import_promises205.writeFile)(outputPath, output2);
|
|
979862
980072
|
context3.logger.info(`Extracted enriched examples written to ${outputPath}`);
|
|
979863
980073
|
} else {
|
|
979864
980074
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : index_vite_proxy_tmp_default.dump(merged, { lineWidth: -1, noRefs: true });
|
|
979865
|
-
await (0,
|
|
980075
|
+
await (0, import_promises205.writeFile)(outputPath, output2);
|
|
979866
980076
|
if (outputPath === openapiPath) {
|
|
979867
980077
|
context3.logger.info(`Enriched ${openapiPath} in-place`);
|
|
979868
980078
|
} else {
|
|
@@ -979872,7 +980082,7 @@ async function mergeOpenAPIWithOverrides({
|
|
|
979872
980082
|
});
|
|
979873
980083
|
}
|
|
979874
980084
|
async function loadYamlOrJson(filepath, context3) {
|
|
979875
|
-
const contents = await (0,
|
|
980085
|
+
const contents = await (0, import_promises205.readFile)(filepath, "utf8");
|
|
979876
980086
|
try {
|
|
979877
980087
|
return JSON.parse(contents);
|
|
979878
980088
|
} catch {
|
|
@@ -980667,7 +980877,7 @@ init_lib35();
|
|
|
980667
980877
|
init_lib6();
|
|
980668
980878
|
init_esm19();
|
|
980669
980879
|
init_axios2();
|
|
980670
|
-
var
|
|
980880
|
+
var import_promises206 = require("fs/promises");
|
|
980671
980881
|
var import_path117 = __toESM(require("path"), 1);
|
|
980672
980882
|
init_index_min2();
|
|
980673
980883
|
var import_tmp_promise20 = __toESM(require_tmp_promise(), 1);
|
|
@@ -980721,7 +980931,7 @@ async function registerWorkspacesV1({
|
|
|
980721
980931
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
980722
980932
|
await Kn({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
980723
980933
|
context3.logger.info("Uploading definition...");
|
|
980724
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
980934
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises206.readFile)(tarPath));
|
|
980725
980935
|
context3.logger.info(
|
|
980726
980936
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
980727
980937
|
);
|
|
@@ -980778,7 +980988,7 @@ function getAIEnhancerConfig2() {
|
|
|
980778
980988
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
980779
980989
|
init_lib8();
|
|
980780
980990
|
init_lib35();
|
|
980781
|
-
var
|
|
980991
|
+
var import_promises207 = require("fs/promises");
|
|
980782
980992
|
var import_path118 = __toESM(require("path"), 1);
|
|
980783
980993
|
async function resolveSpecsForWorkspaces({
|
|
980784
980994
|
project,
|
|
@@ -980798,14 +981008,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
980798
981008
|
return;
|
|
980799
981009
|
}
|
|
980800
981010
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path118.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
980801
|
-
await (0,
|
|
981011
|
+
await (0, import_promises207.mkdir)(workspaceOutputDir, { recursive: true });
|
|
980802
981012
|
const manifest = await collectRawSpecs({
|
|
980803
981013
|
specs,
|
|
980804
981014
|
hostOutputDir: workspaceOutputDir,
|
|
980805
981015
|
containerBaseDir: ".",
|
|
980806
981016
|
context: context3
|
|
980807
981017
|
});
|
|
980808
|
-
await (0,
|
|
981018
|
+
await (0, import_promises207.writeFile)(
|
|
980809
981019
|
import_path118.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
980810
981020
|
JSON.stringify(manifest, void 0, 4)
|
|
980811
981021
|
);
|
|
@@ -981015,7 +981225,7 @@ init_lib17();
|
|
|
981015
981225
|
init_lib19();
|
|
981016
981226
|
init_lib8();
|
|
981017
981227
|
init_lib6();
|
|
981018
|
-
var
|
|
981228
|
+
var import_promises208 = __toESM(require("fs/promises"), 1);
|
|
981019
981229
|
|
|
981020
981230
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
981021
981231
|
var BASE_VERSION = "0.0.1";
|
|
@@ -981135,7 +981345,7 @@ async function sdkPreview({
|
|
|
981135
981345
|
const firstPath = pathOutputs[0];
|
|
981136
981346
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
981137
981347
|
if (absolutePathToOutput != null) {
|
|
981138
|
-
await
|
|
981348
|
+
await import_promises208.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
981139
981349
|
}
|
|
981140
981350
|
for (const workspace of project.apiWorkspaces) {
|
|
981141
981351
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -981325,7 +981535,7 @@ async function sdkPreview({
|
|
|
981325
981535
|
init_lib33();
|
|
981326
981536
|
init_lib6();
|
|
981327
981537
|
init_source();
|
|
981328
|
-
var
|
|
981538
|
+
var import_promises209 = require("fs/promises");
|
|
981329
981539
|
var import_path119 = require("path");
|
|
981330
981540
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
981331
981541
|
let command3;
|
|
@@ -981371,7 +981581,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
981371
981581
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
981372
981582
|
let resolvedPath;
|
|
981373
981583
|
try {
|
|
981374
|
-
resolvedPath = await (0,
|
|
981584
|
+
resolvedPath = await (0, import_promises209.realpath)(fernPath);
|
|
981375
981585
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
981376
981586
|
} catch (error50) {
|
|
981377
981587
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -981685,22 +981895,22 @@ init_lib19();
|
|
|
981685
981895
|
init_lib8();
|
|
981686
981896
|
init_lib6();
|
|
981687
981897
|
var fs33 = __toESM(require("fs"), 1);
|
|
981688
|
-
var
|
|
981898
|
+
var import_promises210 = require("fs/promises");
|
|
981689
981899
|
init_graphql();
|
|
981690
981900
|
init_js_yaml();
|
|
981691
981901
|
var import_stream18 = require("stream");
|
|
981692
|
-
var
|
|
981902
|
+
var import_promises211 = require("stream/promises");
|
|
981693
981903
|
async function fetchAndWriteFile(url3, path119, logger4, indent4) {
|
|
981694
981904
|
const resp = await fetch(url3);
|
|
981695
981905
|
if (resp.ok && resp.body) {
|
|
981696
981906
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
981697
981907
|
const fileStream = fs33.createWriteStream(path119);
|
|
981698
|
-
await (0,
|
|
981699
|
-
const fileContents = await (0,
|
|
981908
|
+
await (0, import_promises211.finished)(import_stream18.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
981909
|
+
const fileContents = await (0, import_promises210.readFile)(path119, "utf8");
|
|
981700
981910
|
try {
|
|
981701
|
-
await (0,
|
|
981911
|
+
await (0, import_promises210.writeFile)(path119, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
981702
981912
|
} catch (e2) {
|
|
981703
|
-
await (0,
|
|
981913
|
+
await (0, import_promises210.writeFile)(path119, index_vite_proxy_tmp_default.dump(index_vite_proxy_tmp_default.load(fileContents), { indent: indent4 }), "utf8");
|
|
981704
981914
|
}
|
|
981705
981915
|
logger4.debug("File written successfully");
|
|
981706
981916
|
}
|
|
@@ -981856,14 +982066,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
981856
982066
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path119, logger4) {
|
|
981857
982067
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
981858
982068
|
if (postResult.success) {
|
|
981859
|
-
await (0,
|
|
982069
|
+
await (0, import_promises210.writeFile)(path119, postResult.result, "utf8");
|
|
981860
982070
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
981861
982071
|
return;
|
|
981862
982072
|
}
|
|
981863
982073
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
981864
982074
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
981865
982075
|
if (getResult.success) {
|
|
981866
|
-
await (0,
|
|
982076
|
+
await (0, import_promises210.writeFile)(path119, getResult.result, "utf8");
|
|
981867
982077
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
981868
982078
|
return;
|
|
981869
982079
|
}
|
|
@@ -982573,7 +982783,7 @@ async function validateWorkspaces({
|
|
|
982573
982783
|
init_lib19();
|
|
982574
982784
|
init_lib8();
|
|
982575
982785
|
init_source();
|
|
982576
|
-
var
|
|
982786
|
+
var import_promises212 = require("fs/promises");
|
|
982577
982787
|
init_js_yaml();
|
|
982578
982788
|
var import_path121 = __toESM(require("path"), 1);
|
|
982579
982789
|
async function writeDefinitionForWorkspaces({
|
|
@@ -982655,22 +982865,22 @@ async function writeFernDefinition({
|
|
|
982655
982865
|
return a3.localeCompare(b5);
|
|
982656
982866
|
};
|
|
982657
982867
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
982658
|
-
await (0,
|
|
982868
|
+
await (0, import_promises212.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
982659
982869
|
}
|
|
982660
|
-
await (0,
|
|
982661
|
-
await (0,
|
|
982870
|
+
await (0, import_promises212.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
982871
|
+
await (0, import_promises212.writeFile)(
|
|
982662
982872
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
982663
982873
|
index_vite_proxy_tmp_default.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
982664
982874
|
);
|
|
982665
982875
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
982666
982876
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982667
|
-
await (0,
|
|
982668
|
-
await (0,
|
|
982877
|
+
await (0, import_promises212.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
982878
|
+
await (0, import_promises212.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(packageMarker.contents, { sortKeys }));
|
|
982669
982879
|
}
|
|
982670
982880
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
982671
982881
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982672
|
-
await (0,
|
|
982673
|
-
await (0,
|
|
982882
|
+
await (0, import_promises212.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
982883
|
+
await (0, import_promises212.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(definitionFile.contents, { sortKeys }));
|
|
982674
982884
|
}
|
|
982675
982885
|
}
|
|
982676
982886
|
|
|
@@ -982678,7 +982888,7 @@ async function writeFernDefinition({
|
|
|
982678
982888
|
init_lib67();
|
|
982679
982889
|
init_lib8();
|
|
982680
982890
|
init_source();
|
|
982681
|
-
var
|
|
982891
|
+
var import_promises213 = require("fs/promises");
|
|
982682
982892
|
async function writeDocsDefinitionForProject({
|
|
982683
982893
|
project,
|
|
982684
982894
|
outputPath,
|
|
@@ -982710,7 +982920,7 @@ async function writeDocsDefinitionForProject({
|
|
|
982710
982920
|
targetAudiences: docsWorkspace.config.instances[0]?.audiences ? Array.isArray(docsWorkspace.config.instances[0].audiences) ? docsWorkspace.config.instances[0].audiences : [docsWorkspace.config.instances[0].audiences] : void 0
|
|
982711
982921
|
});
|
|
982712
982922
|
const docsDefinition = await docsResolver.resolve();
|
|
982713
|
-
await (0,
|
|
982923
|
+
await (0, import_promises213.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
982714
982924
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
982715
982925
|
});
|
|
982716
982926
|
}
|
package/package.json
CHANGED