@fern-api/fern-api-dev 3.66.0 → 3.67.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 +566 -423
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -177612,8 +177612,8 @@ var require_graceful_fs = __commonJS({
|
|
|
177612
177612
|
fs34.createReadStream = createReadStream3;
|
|
177613
177613
|
fs34.createWriteStream = createWriteStream7;
|
|
177614
177614
|
var fs$readFile = fs34.readFile;
|
|
177615
|
-
fs34.readFile =
|
|
177616
|
-
function
|
|
177615
|
+
fs34.readFile = readFile93;
|
|
177616
|
+
function readFile93(path86, options2, cb2) {
|
|
177617
177617
|
if (typeof options2 === "function")
|
|
177618
177618
|
cb2 = options2, options2 = null;
|
|
177619
177619
|
return go$readFile(path86, options2, cb2);
|
|
@@ -1265060,8 +1265060,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
1265060
1265060
|
fs34.createReadStream = createReadStream3;
|
|
1265061
1265061
|
fs34.createWriteStream = createWriteStream7;
|
|
1265062
1265062
|
var fs$readFile = fs34.readFile;
|
|
1265063
|
-
fs34.readFile =
|
|
1265064
|
-
function
|
|
1265063
|
+
fs34.readFile = readFile93;
|
|
1265064
|
+
function readFile93(path86, options2, cb2) {
|
|
1265065
1265065
|
if (typeof options2 === "function")
|
|
1265066
1265066
|
cb2 = options2, options2 = null;
|
|
1265067
1265067
|
return go$readFile(path86, options2, cb2);
|
|
@@ -1284471,7 +1284471,7 @@ var require_jsonfile = __commonJS({
|
|
|
1284471
1284471
|
}
|
|
1284472
1284472
|
return obj;
|
|
1284473
1284473
|
}
|
|
1284474
|
-
var
|
|
1284474
|
+
var readFile93 = universalify.fromPromise(_readFile);
|
|
1284475
1284475
|
function readFileSync12(file4, options2 = {}) {
|
|
1284476
1284476
|
if (typeof options2 === "string") {
|
|
1284477
1284477
|
options2 = { encoding: options2 };
|
|
@@ -1284503,7 +1284503,7 @@ var require_jsonfile = __commonJS({
|
|
|
1284503
1284503
|
return fs33.writeFileSync(file4, str3, options2);
|
|
1284504
1284504
|
}
|
|
1284505
1284505
|
module4.exports = {
|
|
1284506
|
-
readFile:
|
|
1284506
|
+
readFile: readFile93,
|
|
1284507
1284507
|
readFileSync: readFileSync12,
|
|
1284508
1284508
|
writeFile: writeFile80,
|
|
1284509
1284509
|
writeFileSync: writeFileSync5
|
|
@@ -1350896,7 +1350896,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
1350896
1350896
|
} else if (archivePath.endsWith(".tar.bz2")) {
|
|
1350897
1350897
|
await extractTar(archivePath, folderPath, "bzip2");
|
|
1350898
1350898
|
} else if (archivePath.endsWith(".dmg")) {
|
|
1350899
|
-
await (0,
|
|
1350899
|
+
await (0, import_promises83.mkdir)(folderPath);
|
|
1350900
1350900
|
await installDMG(archivePath, folderPath);
|
|
1350901
1350901
|
} else if (archivePath.endsWith(".exe")) {
|
|
1350902
1350902
|
const result = (0, import_node_child_process3.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
@@ -1350985,7 +1350985,7 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
1350985
1350985
|
}
|
|
1350986
1350986
|
const mountPath = volumes[0];
|
|
1350987
1350987
|
try {
|
|
1350988
|
-
const fileNames = await (0,
|
|
1350988
|
+
const fileNames = await (0, import_promises83.readdir)(mountPath);
|
|
1350989
1350989
|
const appName = fileNames.find((item) => {
|
|
1350990
1350990
|
return typeof item === "string" && item.endsWith(".app");
|
|
1350991
1350991
|
});
|
|
@@ -1350998,13 +1350998,13 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
1350998
1350998
|
(0, import_node_child_process3.spawnSync)("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
1350999
1350999
|
}
|
|
1351000
1351000
|
}
|
|
1351001
|
-
var import_node_child_process3, import_node_fs15,
|
|
1351001
|
+
var import_node_child_process3, import_node_fs15, import_promises83, path60, import_node_stream3, import_debug5, debugFileUtil, internalConstantsForTesting;
|
|
1351002
1351002
|
var init_fileUtil = __esm({
|
|
1351003
1351003
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.11.2/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js"() {
|
|
1351004
1351004
|
"use strict";
|
|
1351005
1351005
|
import_node_child_process3 = require("child_process");
|
|
1351006
1351006
|
import_node_fs15 = require("fs");
|
|
1351007
|
-
|
|
1351007
|
+
import_promises83 = require("fs/promises");
|
|
1351008
1351008
|
path60 = __toESM(require("path"), 1);
|
|
1351009
1351009
|
import_node_stream3 = require("stream");
|
|
1351010
1351010
|
import_debug5 = __toESM(require_src(), 1);
|
|
@@ -1351128,7 +1351128,7 @@ async function installUrl(url3, options2) {
|
|
|
1351128
1351128
|
const browserRoot = cache4.browserRoot(options2.browser);
|
|
1351129
1351129
|
const archivePath = import_node_path25.default.join(browserRoot, `${options2.buildId}-${fileName}`);
|
|
1351130
1351130
|
if (!(0, import_node_fs16.existsSync)(browserRoot)) {
|
|
1351131
|
-
await (0,
|
|
1351131
|
+
await (0, import_promises84.mkdir)(browserRoot, { recursive: true });
|
|
1351132
1351132
|
}
|
|
1351133
1351133
|
if (!options2.unpack) {
|
|
1351134
1351134
|
if ((0, import_node_fs16.existsSync)(archivePath)) {
|
|
@@ -1351180,7 +1351180,7 @@ async function installUrl(url3, options2) {
|
|
|
1351180
1351180
|
return installedBrowser;
|
|
1351181
1351181
|
} finally {
|
|
1351182
1351182
|
if ((0, import_node_fs16.existsSync)(archivePath)) {
|
|
1351183
|
-
await (0,
|
|
1351183
|
+
await (0, import_promises84.unlink)(archivePath);
|
|
1351184
1351184
|
}
|
|
1351185
1351185
|
}
|
|
1351186
1351186
|
}
|
|
@@ -1351242,14 +1351242,14 @@ function toMegabytes(bytes) {
|
|
|
1351242
1351242
|
const mb2 = bytes / 1e3 / 1e3;
|
|
1351243
1351243
|
return `${Math.round(mb2 * 10) / 10} MB`;
|
|
1351244
1351244
|
}
|
|
1351245
|
-
var import_node_assert9, import_node_child_process4, import_node_fs16,
|
|
1351245
|
+
var import_node_assert9, import_node_child_process4, import_node_fs16, import_promises84, import_node_os7, import_node_path25, import_progress, debugInstall, times;
|
|
1351246
1351246
|
var init_install = __esm({
|
|
1351247
1351247
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.11.2/node_modules/@puppeteer/browsers/lib/esm/install.js"() {
|
|
1351248
1351248
|
"use strict";
|
|
1351249
1351249
|
import_node_assert9 = __toESM(require("assert"), 1);
|
|
1351250
1351250
|
import_node_child_process4 = require("child_process");
|
|
1351251
1351251
|
import_node_fs16 = require("fs");
|
|
1351252
|
-
|
|
1351252
|
+
import_promises84 = require("fs/promises");
|
|
1351253
1351253
|
import_node_os7 = __toESM(require("os"), 1);
|
|
1351254
1351254
|
import_node_path25 = __toESM(require("path"), 1);
|
|
1351255
1351255
|
import_progress = __toESM(require_progress(), 1);
|
|
@@ -1427240,7 +1427240,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1427240
1427240
|
properties: {
|
|
1427241
1427241
|
...event,
|
|
1427242
1427242
|
...event.properties,
|
|
1427243
|
-
version: "3.
|
|
1427243
|
+
version: "3.67.0",
|
|
1427244
1427244
|
usingAccessToken: true
|
|
1427245
1427245
|
}
|
|
1427246
1427246
|
});
|
|
@@ -1427339,7 +1427339,7 @@ var UserPosthogManager = class {
|
|
|
1427339
1427339
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1427340
1427340
|
event: "CLI",
|
|
1427341
1427341
|
properties: {
|
|
1427342
|
-
version: "3.
|
|
1427342
|
+
version: "3.67.0",
|
|
1427343
1427343
|
...event,
|
|
1427344
1427344
|
...event.properties,
|
|
1427345
1427345
|
usingAccessToken: false,
|
|
@@ -1486398,7 +1486398,8 @@ var BaseApiSettingsSchema2 = schemas_exports10.object({
|
|
|
1486398
1486398
|
"coerce-optional-schemas-to-nullable": schemas_exports10.boolean().optional(),
|
|
1486399
1486399
|
"group-environments-by-host": schemas_exports10.boolean().optional(),
|
|
1486400
1486400
|
"remove-discriminants-from-schemas": RemoveDiscriminantsFromSchemas2.optional(),
|
|
1486401
|
-
"path-parameter-order": PathParameterOrder2.optional()
|
|
1486401
|
+
"path-parameter-order": PathParameterOrder2.optional(),
|
|
1486402
|
+
"resolve-schema-collisions": schemas_exports10.boolean().optional()
|
|
1486402
1486403
|
});
|
|
1486403
1486404
|
|
|
1486404
1486405
|
// ../configuration/lib/generators-yml/schemas/serialization/resources/generators/types/AsyncApiSettingsSchema.js
|
|
@@ -1498014,7 +1498015,8 @@ var DEFAULT_PARSE_OPENAPI_SETTINGS = {
|
|
|
1498014
1498015
|
coerceOptionalSchemasToNullable: false,
|
|
1498015
1498016
|
removeDiscriminantsFromSchemas: generators_yml_exports.RemoveDiscriminantsFromSchemas.Always,
|
|
1498016
1498017
|
defaultIntegerFormat: generators_yml_exports.DefaultIntegerFormat.Int32,
|
|
1498017
|
-
pathParameterOrder: generators_yml_exports.PathParameterOrder.UrlOrder
|
|
1498018
|
+
pathParameterOrder: generators_yml_exports.PathParameterOrder.UrlOrder,
|
|
1498019
|
+
resolveSchemaCollisions: false
|
|
1498018
1498020
|
};
|
|
1498019
1498021
|
function mergeOptions2(params2) {
|
|
1498020
1498022
|
const { defaults: defaults3, options: options2, overrides, overrideOnly = /* @__PURE__ */ new Set(), undefinedIfAbsent = /* @__PURE__ */ new Set() } = params2;
|
|
@@ -1498428,6 +1498430,38 @@ function getValueIfBoolean(value) {
|
|
|
1498428
1498430
|
return void 0;
|
|
1498429
1498431
|
}
|
|
1498430
1498432
|
|
|
1498433
|
+
// ../api-importers/openapi/openapi-ir-parser/lib/utils/schemaCollision.js
|
|
1498434
|
+
function createSchemaCollisionTracker() {
|
|
1498435
|
+
const schemaIdRegistry = /* @__PURE__ */ new Map();
|
|
1498436
|
+
const titleNameRegistry = /* @__PURE__ */ new Map();
|
|
1498437
|
+
return {
|
|
1498438
|
+
getUniqueSchemaId(baseId, logger, resolveCollisions = false) {
|
|
1498439
|
+
const existingCount = schemaIdRegistry.get(baseId) || 0;
|
|
1498440
|
+
schemaIdRegistry.set(baseId, existingCount + 1);
|
|
1498441
|
+
if (existingCount > 0 && resolveCollisions) {
|
|
1498442
|
+
const uniqueId2 = `${baseId}${existingCount + 1}`;
|
|
1498443
|
+
logger?.warn?.(`Schema name collision detected: '${baseId}' already exists. Renaming to '${uniqueId2}' to avoid conflicts.`);
|
|
1498444
|
+
return uniqueId2;
|
|
1498445
|
+
}
|
|
1498446
|
+
return baseId;
|
|
1498447
|
+
},
|
|
1498448
|
+
getUniqueTitleName(baseTitle, originalSchemaId, logger, resolveCollisions = false) {
|
|
1498449
|
+
const existingCount = titleNameRegistry.get(baseTitle) || 0;
|
|
1498450
|
+
titleNameRegistry.set(baseTitle, existingCount + 1);
|
|
1498451
|
+
if (existingCount > 0 && resolveCollisions) {
|
|
1498452
|
+
const uniqueName = `${baseTitle}${existingCount + 1}`;
|
|
1498453
|
+
logger?.warn(`Schema title collision detected: Multiple schemas use title '${baseTitle}'. Schema '${originalSchemaId}' retitled to '${uniqueName}' to avoid conflicts.`);
|
|
1498454
|
+
return uniqueName;
|
|
1498455
|
+
}
|
|
1498456
|
+
return baseTitle;
|
|
1498457
|
+
},
|
|
1498458
|
+
reset() {
|
|
1498459
|
+
schemaIdRegistry.clear();
|
|
1498460
|
+
titleNameRegistry.clear();
|
|
1498461
|
+
}
|
|
1498462
|
+
};
|
|
1498463
|
+
}
|
|
1498464
|
+
|
|
1498431
1498465
|
// ../api-importers/openapi/openapi-ir-parser/lib/schema/utils/isReferenceObject.js
|
|
1498432
1498466
|
function isReferenceObject(parameter6) {
|
|
1498433
1498467
|
return parameter6?.$ref != null;
|
|
@@ -1500174,6 +1500208,25 @@ function getExampleAsArray({ schema: schema2, logger, fallback: fallback2 }) {
|
|
|
1500174
1500208
|
|
|
1500175
1500209
|
// ../api-importers/openapi/openapi-ir-parser/lib/schema/convertSchemas.js
|
|
1500176
1500210
|
var SCHEMA_REFERENCE_PREFIX = "#/components/schemas/";
|
|
1500211
|
+
var globalTitleCollisionTracker = createSchemaCollisionTracker();
|
|
1500212
|
+
function resetTitleCollisionTracker() {
|
|
1500213
|
+
globalTitleCollisionTracker.reset();
|
|
1500214
|
+
}
|
|
1500215
|
+
function getDisambiguatedNameOverride(schema2, context2, originalName) {
|
|
1500216
|
+
const explicitFernExtension = getExtension(schema2, FernOpenAPIExtension.TYPE_NAME);
|
|
1500217
|
+
const titleBasedName = context2.options.useTitlesAsName ? getTitleAsName(schema2.title) : void 0;
|
|
1500218
|
+
const baseOverride = explicitFernExtension ?? titleBasedName;
|
|
1500219
|
+
if (!baseOverride) {
|
|
1500220
|
+
return void 0;
|
|
1500221
|
+
}
|
|
1500222
|
+
const breadcrumbs = originalName.split(".");
|
|
1500223
|
+
const isComponentSchema = explicitFernExtension != null || // Explicit extension = intentional naming
|
|
1500224
|
+
breadcrumbs.length === 1;
|
|
1500225
|
+
if (!isComponentSchema) {
|
|
1500226
|
+
return baseOverride;
|
|
1500227
|
+
}
|
|
1500228
|
+
return globalTitleCollisionTracker.getUniqueTitleName(baseOverride, originalName, context2.logger, context2.options.resolveSchemaCollisions);
|
|
1500229
|
+
}
|
|
1500177
1500230
|
function isInlinable(schema2, context2) {
|
|
1500178
1500231
|
const resolvedSchema = isReferenceObject(schema2) ? context2.resolveSchemaReference(schema2) : schema2;
|
|
1500179
1500232
|
switch (resolvedSchema.type) {
|
|
@@ -1500300,7 +1500353,7 @@ function convertSchemaObject(schema2, wrapAsOptional, wrapAsNullable, context2,
|
|
|
1500300
1500353
|
if (typeof schema2 === "string") {
|
|
1500301
1500354
|
schema2 = { type: schema2 };
|
|
1500302
1500355
|
}
|
|
1500303
|
-
const nameOverride =
|
|
1500356
|
+
const nameOverride = getDisambiguatedNameOverride(schema2, context2, breadcrumbs.join("."));
|
|
1500304
1500357
|
const mixedGroupName = getExtension(schema2, FernOpenAPIExtension.SDK_GROUP_NAME) ?? getExtension(schema2, OpenAPIExtension.TAGS)?.[0];
|
|
1500305
1500358
|
let groupName = (typeof mixedGroupName === "string" ? [mixedGroupName] : mixedGroupName) ?? [];
|
|
1500306
1500359
|
groupName = context2.resolveGroupName(groupName);
|
|
@@ -1504219,14 +1504272,17 @@ var CHANNEL_REFERENCE_PREFIX = "#/channels/";
|
|
|
1504219
1504272
|
var SERVER_REFERENCE_PREFIX = "#/servers/";
|
|
1504220
1504273
|
var LOCATION_PREFIX = "$message.";
|
|
1504221
1504274
|
function parseAsyncAPIV3({ context: context2, breadcrumbs, source: source2, asyncApiOptions, document: document4 }) {
|
|
1504275
|
+
resetTitleCollisionTracker();
|
|
1504222
1504276
|
const schemas = {};
|
|
1504223
1504277
|
const messageSchemas = {};
|
|
1504224
1504278
|
const seenMessages = {};
|
|
1504225
1504279
|
const duplicatedMessageIds = [];
|
|
1504226
1504280
|
const parsedChannels = {};
|
|
1504227
1504281
|
context2.logger.debug("Parsing V3 AsyncAPI...");
|
|
1504282
|
+
const collisionTracker = createSchemaCollisionTracker();
|
|
1504228
1504283
|
for (const [schemaId, schema2] of Object.entries(document4.components?.schemas ?? {})) {
|
|
1504229
|
-
|
|
1504284
|
+
const uniqueSchemaId = collisionTracker.getUniqueSchemaId(schemaId, context2.logger, context2.options.resolveSchemaCollisions);
|
|
1504285
|
+
schemas[uniqueSchemaId] = convertSchema2(schema2, false, false, context2, [uniqueSchemaId], source2, context2.namespace);
|
|
1504230
1504286
|
}
|
|
1504231
1504287
|
for (const [channelId, channel] of Object.entries(document4.channels ?? {})) {
|
|
1504232
1504288
|
if (!messageSchemas[channelId]) {
|
|
@@ -1504269,8 +1504325,15 @@ function parseAsyncAPIV3({ context: context2, breadcrumbs, source: source2, asyn
|
|
|
1504269
1504325
|
}
|
|
1504270
1504326
|
}
|
|
1504271
1504327
|
}
|
|
1504272
|
-
const flattenedMessageSchemas =
|
|
1504273
|
-
const
|
|
1504328
|
+
const flattenedMessageSchemas = {};
|
|
1504329
|
+
const messageCollisionTracker = createSchemaCollisionTracker();
|
|
1504330
|
+
for (const [channelId, channelSchemas] of Object.entries(messageSchemas)) {
|
|
1504331
|
+
for (const [messageId, messageSchema] of Object.entries(channelSchemas)) {
|
|
1504332
|
+
const uniqueMessageId = messageCollisionTracker.getUniqueSchemaId(messageId, context2.logger, context2.options.resolveSchemaCollisions);
|
|
1504333
|
+
flattenedMessageSchemas[uniqueMessageId] = messageSchema;
|
|
1504334
|
+
}
|
|
1504335
|
+
}
|
|
1504336
|
+
const exampleFactory = new ExampleWebsocketSessionFactory({ ...schemas, ...flattenedMessageSchemas }, context2);
|
|
1504274
1504337
|
const servers = {};
|
|
1504275
1504338
|
for (const [serverId, server] of Object.entries(document4.servers ?? {})) {
|
|
1504276
1504339
|
servers[serverId] = {
|
|
@@ -1504459,6 +1504522,13 @@ function parseAsyncAPIV3({ context: context2, breadcrumbs, source: source2, asyn
|
|
|
1504459
1504522
|
context2.logger.warn(`Skipping AsyncAPI channel ${channelPath} as it does not qualify for inclusion (no headers, query params, or operations)`);
|
|
1504460
1504523
|
}
|
|
1504461
1504524
|
}
|
|
1504525
|
+
const allSchemasWithExample = { ...schemas, ...flattenedMessageSchemas };
|
|
1504526
|
+
const allSchemas = {};
|
|
1504527
|
+
const finalCollisionTracker = createSchemaCollisionTracker();
|
|
1504528
|
+
for (const [schemaId, schemaWithExample] of Object.entries(allSchemasWithExample)) {
|
|
1504529
|
+
const uniqueSchemaId = finalCollisionTracker.getUniqueSchemaId(schemaId, context2.logger, context2.options.resolveSchemaCollisions);
|
|
1504530
|
+
allSchemas[uniqueSchemaId] = convertSchemaWithExampleToSchema(schemaWithExample);
|
|
1504531
|
+
}
|
|
1504462
1504532
|
const groupedSchemas = getSchemas(context2.namespace, schemas);
|
|
1504463
1504533
|
const finalServers = Object.values(servers).map((server) => ({
|
|
1504464
1504534
|
...server,
|
|
@@ -1507376,6 +1507446,7 @@ function replaceWithSchemaReference({ openapi, replaceReference, schemaReference
|
|
|
1507376
1507446
|
// ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/generateIr.js
|
|
1507377
1507447
|
function generateIr({ openApi, taskContext, options: options2, source: source2, namespace }) {
|
|
1507378
1507448
|
openApi = runResolutions({ openapi: openApi });
|
|
1507449
|
+
resetTitleCollisionTracker();
|
|
1507379
1507450
|
const tempContext = new OpenAPIV3ParserContext({
|
|
1507380
1507451
|
document: openApi,
|
|
1507381
1507452
|
taskContext,
|
|
@@ -1507491,13 +1507562,15 @@ function generateIr({ openApi, taskContext, options: options2, source: source2,
|
|
|
1507491
1507562
|
}).filter((entry) => entry.length > 0));
|
|
1507492
1507563
|
const schemasWithoutDiscriminants = maybeRemoveDiscriminantsFromSchemas(schemasWithExample, context2, source2);
|
|
1507493
1507564
|
const schemasWithDiscriminants = maybeAddBackDiscriminantsFromSchemas(schemasWithoutDiscriminants, context2);
|
|
1507565
|
+
const collisionTracker = createSchemaCollisionTracker();
|
|
1507494
1507566
|
const schemas = {};
|
|
1507495
1507567
|
for (const [key2, schemaWithExample] of Object.entries(schemasWithDiscriminants)) {
|
|
1507496
1507568
|
const schema2 = convertSchemaWithExampleToSchema(schemaWithExample);
|
|
1507497
1507569
|
if (context2.isSchemaExcluded(key2)) {
|
|
1507498
1507570
|
continue;
|
|
1507499
1507571
|
}
|
|
1507500
|
-
|
|
1507572
|
+
const uniqueKey = collisionTracker.getUniqueSchemaId(key2, context2.logger, options2.resolveSchemaCollisions);
|
|
1507573
|
+
schemas[uniqueKey] = schema2;
|
|
1507501
1507574
|
}
|
|
1507502
1507575
|
const exampleTypeFactory = new ExampleTypeFactory(schemasWithDiscriminants, context2.nonRequestReferencedSchemas, context2);
|
|
1507503
1507576
|
const webhooks2 = webhooksWithExample.map((webhookWithExample) => {
|
|
@@ -1507879,7 +1507952,7 @@ function parse6({ context: context2, documents, options: options2 }) {
|
|
|
1507879
1507952
|
};
|
|
1507880
1507953
|
}
|
|
1507881
1507954
|
if (parsedAsyncAPI.groupedSchemas != null) {
|
|
1507882
|
-
ir14.groupedSchemas = mergeSchemaMaps(ir14.groupedSchemas, parsedAsyncAPI.groupedSchemas);
|
|
1507955
|
+
ir14.groupedSchemas = mergeSchemaMaps(ir14.groupedSchemas, parsedAsyncAPI.groupedSchemas, options2);
|
|
1507883
1507956
|
}
|
|
1507884
1507957
|
if (parsedAsyncAPI.basePath != null) {
|
|
1507885
1507958
|
ir14.basePath = parsedAsyncAPI.basePath;
|
|
@@ -1508039,7 +1508112,7 @@ function merge6(ir1, ir23, options2) {
|
|
|
1508039
1508112
|
...ir1.channels,
|
|
1508040
1508113
|
...ir23.channels
|
|
1508041
1508114
|
},
|
|
1508042
|
-
groupedSchemas: mergeSchemaMaps(ir1.groupedSchemas, ir23.groupedSchemas),
|
|
1508115
|
+
groupedSchemas: mergeSchemaMaps(ir1.groupedSchemas, ir23.groupedSchemas, options2),
|
|
1508043
1508116
|
variables: {
|
|
1508044
1508117
|
...ir1.variables,
|
|
1508045
1508118
|
...ir23.variables
|
|
@@ -1508172,7 +1508245,7 @@ function merge6(ir1, ir23, options2) {
|
|
|
1508172
1508245
|
...ir1.channels,
|
|
1508173
1508246
|
...ir23.channels
|
|
1508174
1508247
|
},
|
|
1508175
|
-
groupedSchemas: mergeSchemaMaps(ir1.groupedSchemas, ir23.groupedSchemas),
|
|
1508248
|
+
groupedSchemas: mergeSchemaMaps(ir1.groupedSchemas, ir23.groupedSchemas, options2),
|
|
1508176
1508249
|
variables: {
|
|
1508177
1508250
|
...ir1.variables,
|
|
1508178
1508251
|
...ir23.variables
|
|
@@ -1508215,7 +1508288,7 @@ function merge6(ir1, ir23, options2) {
|
|
|
1508215
1508288
|
...ir1.channels,
|
|
1508216
1508289
|
...ir23.channels
|
|
1508217
1508290
|
},
|
|
1508218
|
-
groupedSchemas: mergeSchemaMaps(ir1.groupedSchemas, ir23.groupedSchemas),
|
|
1508291
|
+
groupedSchemas: mergeSchemaMaps(ir1.groupedSchemas, ir23.groupedSchemas, options2),
|
|
1508219
1508292
|
variables: {
|
|
1508220
1508293
|
...ir1.variables,
|
|
1508221
1508294
|
...ir23.variables
|
|
@@ -1508234,11 +1508307,22 @@ function merge6(ir1, ir23, options2) {
|
|
|
1508234
1508307
|
}
|
|
1508235
1508308
|
};
|
|
1508236
1508309
|
}
|
|
1508237
|
-
function mergeSchemaMaps(schemas1, schemas2) {
|
|
1508238
|
-
|
|
1508310
|
+
function mergeSchemaMaps(schemas1, schemas2, options2) {
|
|
1508311
|
+
const collisionTracker = createSchemaCollisionTracker();
|
|
1508312
|
+
const shouldWarn2 = options2?.resolveSchemaCollisions ?? false;
|
|
1508313
|
+
const mergedRootSchemas = { ...schemas1.rootSchemas };
|
|
1508314
|
+
for (const [key2, schema2] of Object.entries(schemas2.rootSchemas)) {
|
|
1508315
|
+
const uniqueKey = collisionTracker.getUniqueSchemaId(key2, void 0, shouldWarn2);
|
|
1508316
|
+
mergedRootSchemas[uniqueKey] = schema2;
|
|
1508317
|
+
}
|
|
1508318
|
+
schemas1.rootSchemas = mergedRootSchemas;
|
|
1508239
1508319
|
for (const [namespace, namespaceSchemas] of Object.entries(schemas2.namespacedSchemas)) {
|
|
1508240
1508320
|
if (schemas1.namespacedSchemas[namespace] != null) {
|
|
1508241
|
-
|
|
1508321
|
+
const existingSchemas = schemas1.namespacedSchemas[namespace];
|
|
1508322
|
+
for (const [key2, schema2] of Object.entries(namespaceSchemas)) {
|
|
1508323
|
+
const uniqueKey = collisionTracker.getUniqueSchemaId(key2, void 0, shouldWarn2);
|
|
1508324
|
+
existingSchemas[uniqueKey] = schema2;
|
|
1508325
|
+
}
|
|
1508242
1508326
|
} else {
|
|
1508243
1508327
|
schemas1.namespacedSchemas[namespace] = namespaceSchemas;
|
|
1508244
1508328
|
}
|
|
@@ -1508300,7 +1508384,8 @@ var FIELD_MAPPINGS = {
|
|
|
1508300
1508384
|
coerceOptionalSchemasToNullable: "coerceOptionalSchemasToNullable",
|
|
1508301
1508385
|
removeDiscriminantsFromSchemas: "removeDiscriminantsFromSchemas",
|
|
1508302
1508386
|
defaultIntegerFormat: "defaultIntegerFormat",
|
|
1508303
|
-
pathParameterOrder: "pathParameterOrder"
|
|
1508387
|
+
pathParameterOrder: "pathParameterOrder",
|
|
1508388
|
+
resolveSchemaCollisions: "resolveSchemaCollisions"
|
|
1508304
1508389
|
};
|
|
1508305
1508390
|
function setIfDefined(target, key2, value) {
|
|
1508306
1508391
|
if (value !== void 0) {
|
|
@@ -1515326,7 +1515411,8 @@ var UNDEFINED_API_DEFINITION_SETTINGS = {
|
|
|
1515326
1515411
|
coerceOptionalSchemasToNullable: void 0,
|
|
1515327
1515412
|
removeDiscriminantsFromSchemas: void 0,
|
|
1515328
1515413
|
pathParameterOrder: void 0,
|
|
1515329
|
-
defaultIntegerFormat: void 0
|
|
1515414
|
+
defaultIntegerFormat: void 0,
|
|
1515415
|
+
resolveSchemaCollisions: void 0
|
|
1515330
1515416
|
};
|
|
1515331
1515417
|
async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfiguration, rawGeneratorsConfiguration, context: context2 }) {
|
|
1515332
1515418
|
const maybeTopLevelMetadata = getOutputMetadata(rawGeneratorsConfiguration.metadata);
|
|
@@ -1515413,7 +1515499,8 @@ function parseBaseApiDefinitionSettingsSchema(settings) {
|
|
|
1515413
1515499
|
groupEnvironmentsByHost: settings?.["group-environments-by-host"],
|
|
1515414
1515500
|
groupMultiApiEnvironments: settings != null && "group-multi-api-environments" in settings ? settings["group-multi-api-environments"] : void 0,
|
|
1515415
1515501
|
removeDiscriminantsFromSchemas: parseRemoveDiscriminantsFromSchemas(settings?.["remove-discriminants-from-schemas"]),
|
|
1515416
|
-
pathParameterOrder: settings?.["path-parameter-order"]
|
|
1515502
|
+
pathParameterOrder: settings?.["path-parameter-order"],
|
|
1515503
|
+
resolveSchemaCollisions: settings?.["resolve-schema-collisions"]
|
|
1515417
1515504
|
};
|
|
1515418
1515505
|
}
|
|
1515419
1515506
|
function parseRemoveDiscriminantsFromSchemas(option) {
|
|
@@ -1563413,9 +1563500,64 @@ function audiencesIntersect(a10, b18) {
|
|
|
1563413
1563500
|
return a10.some((aud) => b18.includes(aud));
|
|
1563414
1563501
|
}
|
|
1563415
1563502
|
|
|
1563503
|
+
// ../workspace/oss-validator/lib/rules/no-schema-title-collisions/no-schema-title-collisions.js
|
|
1563504
|
+
var import_promises41 = require("fs/promises");
|
|
1563505
|
+
var NoSchemaTitleCollisionsRule = {
|
|
1563506
|
+
name: "no-schema-title-collisions",
|
|
1563507
|
+
run: async ({ workspace, specs, context: context2 }) => {
|
|
1563508
|
+
const violations = [];
|
|
1563509
|
+
const titleRegistry = /* @__PURE__ */ new Map();
|
|
1563510
|
+
for (const spec of specs) {
|
|
1563511
|
+
if (spec.type !== "openapi") {
|
|
1563512
|
+
continue;
|
|
1563513
|
+
}
|
|
1563514
|
+
const settings = spec.settings;
|
|
1563515
|
+
if (settings?.useTitlesAsName !== true || settings?.resolveSchemaCollisions === true) {
|
|
1563516
|
+
continue;
|
|
1563517
|
+
}
|
|
1563518
|
+
const contents = (await (0, import_promises41.readFile)(spec.absoluteFilepath)).toString();
|
|
1563519
|
+
const isAsyncAPI = contents.includes("asyncapi:");
|
|
1563520
|
+
const isOpenAPI = contents.includes("openapi") || contents.includes("swagger");
|
|
1563521
|
+
if (!isOpenAPI && !isAsyncAPI) {
|
|
1563522
|
+
continue;
|
|
1563523
|
+
}
|
|
1563524
|
+
const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
|
|
1563525
|
+
const document4 = await loadOpenAPI({
|
|
1563526
|
+
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
1563527
|
+
context: context2,
|
|
1563528
|
+
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
1563529
|
+
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
1563530
|
+
});
|
|
1563531
|
+
const apiToValidate = isOpenAPIV2(document4) ? await convertOpenAPIV2ToV3(document4) : document4;
|
|
1563532
|
+
const schemas = apiToValidate.components?.schemas ?? {};
|
|
1563533
|
+
for (const [schemaId, schema2] of Object.entries(schemas)) {
|
|
1563534
|
+
if (typeof schema2 !== "object" || schema2 == null || !("title" in schema2)) {
|
|
1563535
|
+
continue;
|
|
1563536
|
+
}
|
|
1563537
|
+
const title4 = schema2.title;
|
|
1563538
|
+
if (typeof title4 !== "string" || title4.trim() === "") {
|
|
1563539
|
+
continue;
|
|
1563540
|
+
}
|
|
1563541
|
+
const existing = titleRegistry.get(title4);
|
|
1563542
|
+
if (existing != null) {
|
|
1563543
|
+
violations.push({
|
|
1563544
|
+
severity: "error",
|
|
1563545
|
+
relativeFilepath,
|
|
1563546
|
+
nodePath: ["components", "schemas", schemaId, "title"],
|
|
1563547
|
+
message: `Schema title collision detected: Multiple schemas use title '${title4}'. Schema '${schemaId}' conflicts with schema '${existing.schemaId}'. Use 'resolve-schema-collisions: true' to automatically resolve collisions.`
|
|
1563548
|
+
});
|
|
1563549
|
+
} else {
|
|
1563550
|
+
titleRegistry.set(title4, { schemaId, specFile: relativeFilepath });
|
|
1563551
|
+
}
|
|
1563552
|
+
}
|
|
1563553
|
+
}
|
|
1563554
|
+
return violations;
|
|
1563555
|
+
}
|
|
1563556
|
+
};
|
|
1563557
|
+
|
|
1563416
1563558
|
// ../workspace/oss-validator/lib/getAllRules.js
|
|
1563417
1563559
|
function getAllRules2() {
|
|
1563418
|
-
return [NoDuplicateOverridesRule];
|
|
1563560
|
+
return [NoDuplicateOverridesRule, NoSchemaTitleCollisionsRule];
|
|
1563419
1563561
|
}
|
|
1563420
1563562
|
|
|
1563421
1563563
|
// ../workspace/oss-validator/lib/validateOSSWorkspace.js
|
|
@@ -1564063,10 +1564205,10 @@ function addCheckCommand(cli) {
|
|
|
1564063
1564205
|
}
|
|
1564064
1564206
|
|
|
1564065
1564207
|
// ../cli-v2/lib/migrator/Migrator.js
|
|
1564066
|
-
var
|
|
1564208
|
+
var import_promises45 = require("fs/promises");
|
|
1564067
1564209
|
|
|
1564068
1564210
|
// ../cli-v2/lib/migrator/converters/convertApiSpecs.js
|
|
1564069
|
-
var
|
|
1564211
|
+
var import_promises42 = require("fs/promises");
|
|
1564070
1564212
|
|
|
1564071
1564213
|
// ../cli-v2/lib/migrator/converters/convertSettings.js
|
|
1564072
1564214
|
var SETTINGS_KEY_MAP = {
|
|
@@ -1564199,7 +1564341,7 @@ async function convertMultiApi(options2) {
|
|
|
1564199
1564341
|
const { apisDir, generatorsYmlApis } = options2;
|
|
1564200
1564342
|
const warnings = [];
|
|
1564201
1564343
|
const apis = {};
|
|
1564202
|
-
const apiDirs = await (0,
|
|
1564344
|
+
const apiDirs = await (0, import_promises42.readdir)(apisDir, { withFileTypes: true });
|
|
1564203
1564345
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
1564204
1564346
|
for (const apiName of apiNames) {
|
|
1564205
1564347
|
const apiDir = join4(apisDir, RelativeFilePath2.of(apiName));
|
|
@@ -1564894,7 +1565036,7 @@ function convertRawReadme(readme) {
|
|
|
1564894
1565036
|
}
|
|
1564895
1565037
|
|
|
1564896
1565038
|
// ../cli-v2/lib/migrator/fern-config-json/FernConfigJsonMigrator.js
|
|
1564897
|
-
var
|
|
1565039
|
+
var import_promises43 = require("fs/promises");
|
|
1564898
1565040
|
var FernConfigJsonMigrator = class {
|
|
1564899
1565041
|
cwd;
|
|
1564900
1565042
|
constructor({ cwd: cwd2 }) {
|
|
@@ -1564927,7 +1565069,7 @@ var FernConfigJsonMigrator = class {
|
|
|
1564927
1565069
|
};
|
|
1564928
1565070
|
}
|
|
1564929
1565071
|
try {
|
|
1564930
|
-
const content5 = await (0,
|
|
1565072
|
+
const content5 = await (0, import_promises43.readFile)(absoluteFilePath, "utf-8");
|
|
1564931
1565073
|
const config3 = JSON.parse(content5);
|
|
1564932
1565074
|
const org = typeof config3.organization === "string" ? config3.organization : void 0;
|
|
1564933
1565075
|
const cliVersion = typeof config3.version === "string" ? config3.version : void 0;
|
|
@@ -1564964,7 +1565106,7 @@ var FernConfigJsonMigrator = class {
|
|
|
1564964
1565106
|
};
|
|
1564965
1565107
|
|
|
1564966
1565108
|
// ../cli-v2/lib/migrator/generators-yml/GeneratorsYmlMigrator.js
|
|
1564967
|
-
var
|
|
1565109
|
+
var import_promises44 = require("fs/promises");
|
|
1564968
1565110
|
var GeneratorsYmlMigrator = class {
|
|
1564969
1565111
|
cwd;
|
|
1564970
1565112
|
apiName;
|
|
@@ -1564997,7 +1565139,7 @@ var GeneratorsYmlMigrator = class {
|
|
|
1564997
1565139
|
};
|
|
1564998
1565140
|
}
|
|
1564999
1565141
|
try {
|
|
1565000
|
-
const content5 = await (0,
|
|
1565142
|
+
const content5 = await (0, import_promises44.readFile)(absoluteFilePath, "utf-8");
|
|
1565001
1565143
|
const config3 = jsYaml.load(content5);
|
|
1565002
1565144
|
if (config3 == null || typeof config3 !== "object") {
|
|
1565003
1565145
|
return {
|
|
@@ -1565219,11 +1565361,11 @@ var Migrator = class {
|
|
|
1565219
1565361
|
}
|
|
1565220
1565362
|
const fernYmlPath = join4(this.cwd, RelativeFilePath2.of(FERN_YML_FILENAME));
|
|
1565221
1565363
|
const yamlContent = this.serializeFernYml(fernYml);
|
|
1565222
|
-
await (0,
|
|
1565364
|
+
await (0, import_promises45.writeFile)(fernYmlPath, yamlContent, "utf-8");
|
|
1565223
1565365
|
if (this.deleteOriginals) {
|
|
1565224
1565366
|
for (const absoluteFilePath of migratedFiles) {
|
|
1565225
1565367
|
try {
|
|
1565226
|
-
await (0,
|
|
1565368
|
+
await (0, import_promises45.rm)(absoluteFilePath);
|
|
1565227
1565369
|
this.logger.debug(`Deleted ${absoluteFilePath}`);
|
|
1565228
1565370
|
} catch {
|
|
1565229
1565371
|
warnings.push({
|
|
@@ -1565268,7 +1565410,7 @@ var Migrator = class {
|
|
|
1565268
1565410
|
}
|
|
1565269
1565411
|
async migrateMultiApi(options2) {
|
|
1565270
1565412
|
const { fernDir, apisDir, org, warnings, migratedFiles } = options2;
|
|
1565271
|
-
const apiDirs = await (0,
|
|
1565413
|
+
const apiDirs = await (0, import_promises45.readdir)(apisDir, { withFileTypes: true });
|
|
1565272
1565414
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
1565273
1565415
|
if (apiNames.length === 0) {
|
|
1565274
1565416
|
warnings.push({
|
|
@@ -1565768,7 +1565910,7 @@ var AutoVersioningService = class {
|
|
|
1565768
1565910
|
};
|
|
1565769
1565911
|
|
|
1565770
1565912
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
1565771
|
-
var
|
|
1565913
|
+
var import_promises46 = require("fs/promises");
|
|
1565772
1565914
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
1565773
1565915
|
async function runContainer({ logger, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner }) {
|
|
1565774
1565916
|
const tryRun = () => tryRunContainer({
|
|
@@ -1565817,7 +1565959,7 @@ async function tryRunContainer({ logger, imageName, args, binds, envVars = {}, p
|
|
|
1565817
1565959
|
const logs = stdout + stderr;
|
|
1565818
1565960
|
if (writeLogsToFile) {
|
|
1565819
1565961
|
const tmpFile = await import_tmp_promise8.default.file();
|
|
1565820
|
-
await (0,
|
|
1565962
|
+
await (0, import_promises46.writeFile)(tmpFile.path, logs);
|
|
1565821
1565963
|
logger.info(`Generator logs here: ${tmpFile.path}`);
|
|
1565822
1565964
|
}
|
|
1565823
1565965
|
if (exitCode == null) {
|
|
@@ -1577645,7 +1577787,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
1577645
1577787
|
};
|
|
1577646
1577788
|
|
|
1577647
1577789
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
1577648
|
-
var
|
|
1577790
|
+
var import_promises47 = require("fs/promises");
|
|
1577649
1577791
|
var import_path38 = __toESM(require("path"), 1);
|
|
1577650
1577792
|
|
|
1577651
1577793
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -1577778,8 +1577920,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
1577778
1577920
|
style: Style.Full
|
|
1577779
1577921
|
});
|
|
1577780
1577922
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
1577781
|
-
await (0,
|
|
1577782
|
-
await (0,
|
|
1577923
|
+
await (0, import_promises47.mkdir)(import_path38.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1577924
|
+
await (0, import_promises47.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1577783
1577925
|
} catch (error49) {
|
|
1577784
1577926
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1577785
1577927
|
}
|
|
@@ -1577788,8 +1577930,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
1577788
1577930
|
}
|
|
1577789
1577931
|
async initializeProject(outputDir) {
|
|
1577790
1577932
|
const absolutePathToOutputDir = join4(outputDir, RelativeFilePath2.of("src/SeedApi.DynamicSnippets"));
|
|
1577791
|
-
await (0,
|
|
1577792
|
-
await (0,
|
|
1577933
|
+
await (0, import_promises47.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
1577934
|
+
await (0, import_promises47.writeFile)(join4(absolutePathToOutputDir, RelativeFilePath2.of("SeedApi.DynamicSnippets.csproj")), PROJECT_FILE_CONTENT);
|
|
1577793
1577935
|
return absolutePathToOutputDir;
|
|
1577794
1577936
|
}
|
|
1577795
1577937
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -1581103,7 +1581245,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
1581103
1581245
|
};
|
|
1581104
1581246
|
|
|
1581105
1581247
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
1581106
|
-
var
|
|
1581248
|
+
var import_promises48 = require("fs/promises");
|
|
1581107
1581249
|
var import_path40 = __toESM(require("path"), 1);
|
|
1581108
1581250
|
var DynamicSnippetsGoTestGenerator = class {
|
|
1581109
1581251
|
context;
|
|
@@ -1581130,8 +1581272,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
1581130
1581272
|
}
|
|
1581131
1581273
|
const response = await this.dynamicSnippetsGenerator.generate(convertedRequest);
|
|
1581132
1581274
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
1581133
|
-
await (0,
|
|
1581134
|
-
await (0,
|
|
1581275
|
+
await (0, import_promises48.mkdir)(import_path40.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1581276
|
+
await (0, import_promises48.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1581135
1581277
|
} catch (error49) {
|
|
1581136
1581278
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1581137
1581279
|
if (error49 instanceof Error && error49.stack) {
|
|
@@ -1584326,7 +1584468,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
1584326
1584468
|
};
|
|
1584327
1584469
|
|
|
1584328
1584470
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
1584329
|
-
var
|
|
1584471
|
+
var import_promises49 = require("fs/promises");
|
|
1584330
1584472
|
var import_path41 = __toESM(require("path"), 1);
|
|
1584331
1584473
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
1584332
1584474
|
context;
|
|
@@ -1584360,8 +1584502,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
1584360
1584502
|
style: Style.Full
|
|
1584361
1584503
|
});
|
|
1584362
1584504
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
1584363
|
-
await (0,
|
|
1584364
|
-
await (0,
|
|
1584505
|
+
await (0, import_promises49.mkdir)(import_path41.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1584506
|
+
await (0, import_promises49.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1584365
1584507
|
} catch (error49) {
|
|
1584366
1584508
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1584367
1584509
|
}
|
|
@@ -1584388,7 +1584530,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
1584388
1584530
|
const reportsPath = join4(outputDir, RelativeFilePath2.of("reports"));
|
|
1584389
1584531
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
1584390
1584532
|
if (buildReportsExists) {
|
|
1584391
|
-
await (0,
|
|
1584533
|
+
await (0, import_promises49.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
1584392
1584534
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
1584393
1584535
|
} else {
|
|
1584394
1584536
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -1584402,7 +1584544,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
1584402
1584544
|
}
|
|
1584403
1584545
|
async initializeProject(outputDir) {
|
|
1584404
1584546
|
const absolutePathToOutputDir = join4(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
1584405
|
-
await (0,
|
|
1584547
|
+
await (0, import_promises49.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
1584406
1584548
|
return absolutePathToOutputDir;
|
|
1584407
1584549
|
}
|
|
1584408
1584550
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -1587535,7 +1587677,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
1587535
1587677
|
};
|
|
1587536
1587678
|
|
|
1587537
1587679
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
1587538
|
-
var
|
|
1587680
|
+
var import_promises50 = require("fs/promises");
|
|
1587539
1587681
|
var import_path42 = __toESM(require("path"), 1);
|
|
1587540
1587682
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
1587541
1587683
|
context;
|
|
@@ -1587562,8 +1587704,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
1587562
1587704
|
}
|
|
1587563
1587705
|
const response = await this.dynamicSnippetsGenerator.generate(convertedRequest);
|
|
1587564
1587706
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
1587565
|
-
await (0,
|
|
1587566
|
-
await (0,
|
|
1587707
|
+
await (0, import_promises50.mkdir)(import_path42.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1587708
|
+
await (0, import_promises50.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1587567
1587709
|
} catch (error49) {
|
|
1587568
1587710
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1587569
1587711
|
}
|
|
@@ -1590524,7 +1590666,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
1590524
1590666
|
};
|
|
1590525
1590667
|
|
|
1590526
1590668
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
1590527
|
-
var
|
|
1590669
|
+
var import_promises51 = require("fs/promises");
|
|
1590528
1590670
|
var import_path43 = __toESM(require("path"), 1);
|
|
1590529
1590671
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
1590530
1590672
|
context;
|
|
@@ -1590551,8 +1590693,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
1590551
1590693
|
}
|
|
1590552
1590694
|
const response = await this.dynamicSnippetsGenerator.generate(convertedRequest);
|
|
1590553
1590695
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
1590554
|
-
await (0,
|
|
1590555
|
-
await (0,
|
|
1590696
|
+
await (0, import_promises51.mkdir)(import_path43.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1590697
|
+
await (0, import_promises51.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1590556
1590698
|
} catch (error49) {
|
|
1590557
1590699
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1590558
1590700
|
}
|
|
@@ -1593115,7 +1593257,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
1593115
1593257
|
};
|
|
1593116
1593258
|
|
|
1593117
1593259
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
1593118
|
-
var
|
|
1593260
|
+
var import_promises52 = require("fs/promises");
|
|
1593119
1593261
|
var import_path44 = __toESM(require("path"), 1);
|
|
1593120
1593262
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
1593121
1593263
|
context;
|
|
@@ -1593142,8 +1593284,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
1593142
1593284
|
}
|
|
1593143
1593285
|
const response = await this.dynamicSnippetsGenerator.generate(convertedRequest);
|
|
1593144
1593286
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
1593145
|
-
await (0,
|
|
1593146
|
-
await (0,
|
|
1593287
|
+
await (0, import_promises52.mkdir)(import_path44.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1593288
|
+
await (0, import_promises52.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1593147
1593289
|
} catch (error49) {
|
|
1593148
1593290
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1593149
1593291
|
if (error49 instanceof Error && error49.stack) {
|
|
@@ -1593159,7 +1593301,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
1593159
1593301
|
};
|
|
1593160
1593302
|
|
|
1593161
1593303
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
1593162
|
-
var
|
|
1593304
|
+
var import_promises53 = require("fs/promises");
|
|
1593163
1593305
|
var import_node_path15 = __toESM(require("path"), 1);
|
|
1593164
1593306
|
|
|
1593165
1593307
|
// ../../../generators/rust/base/lib/constants/index.js
|
|
@@ -1598148,8 +1598290,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
1598148
1598290
|
absolutePathToOutputDir,
|
|
1598149
1598291
|
idx
|
|
1598150
1598292
|
});
|
|
1598151
|
-
await (0,
|
|
1598152
|
-
await (0,
|
|
1598293
|
+
await (0, import_promises53.mkdir)(import_node_path15.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1598294
|
+
await (0, import_promises53.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1598153
1598295
|
} catch (error49) {
|
|
1598154
1598296
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1598155
1598297
|
}
|
|
@@ -1598158,7 +1598300,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
1598158
1598300
|
}
|
|
1598159
1598301
|
async initializeProject(outputDir) {
|
|
1598160
1598302
|
const absolutePathToOutputDir = join4(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
1598161
|
-
await (0,
|
|
1598303
|
+
await (0, import_promises53.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
1598162
1598304
|
return absolutePathToOutputDir;
|
|
1598163
1598305
|
}
|
|
1598164
1598306
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -1598167,7 +1598309,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
1598167
1598309
|
};
|
|
1598168
1598310
|
|
|
1598169
1598311
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
1598170
|
-
var
|
|
1598312
|
+
var import_promises54 = require("fs/promises");
|
|
1598171
1598313
|
var import_node_path16 = __toESM(require("path"), 1);
|
|
1598172
1598314
|
|
|
1598173
1598315
|
// ../../../generators/swift/codegen/lib/helpers/enum-with-associated-values/enum-with-associated-values.js
|
|
@@ -1602693,8 +1602835,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
1602693
1602835
|
absolutePathToOutputDir,
|
|
1602694
1602836
|
idx
|
|
1602695
1602837
|
});
|
|
1602696
|
-
await (0,
|
|
1602697
|
-
await (0,
|
|
1602838
|
+
await (0, import_promises54.mkdir)(import_node_path16.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1602839
|
+
await (0, import_promises54.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1602698
1602840
|
} catch (error49) {
|
|
1602699
1602841
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1602700
1602842
|
}
|
|
@@ -1602703,7 +1602845,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
1602703
1602845
|
}
|
|
1602704
1602846
|
async initializeProject(outputDir) {
|
|
1602705
1602847
|
const absolutePathToOutputDir = join4(outputDir, RelativeFilePath2.of("Snippets"));
|
|
1602706
|
-
await (0,
|
|
1602848
|
+
await (0, import_promises54.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
1602707
1602849
|
return absolutePathToOutputDir;
|
|
1602708
1602850
|
}
|
|
1602709
1602851
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -1604857,7 +1604999,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
1604857
1604999
|
};
|
|
1604858
1605000
|
|
|
1604859
1605001
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
1604860
|
-
var
|
|
1605002
|
+
var import_promises55 = require("fs/promises");
|
|
1604861
1605003
|
var import_path45 = __toESM(require("path"), 1);
|
|
1604862
1605004
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
1604863
1605005
|
context;
|
|
@@ -1604884,8 +1605026,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
1604884
1605026
|
}
|
|
1604885
1605027
|
const response = await this.dynamicSnippetsGenerator.generate(convertedRequest);
|
|
1604886
1605028
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
1604887
|
-
await (0,
|
|
1604888
|
-
await (0,
|
|
1605029
|
+
await (0, import_promises55.mkdir)(import_path45.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
1605030
|
+
await (0, import_promises55.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
1604889
1605031
|
} catch (error49) {
|
|
1604890
1605032
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request6.endpoint)}: ${error49}`);
|
|
1604891
1605033
|
}
|
|
@@ -1604980,7 +1605122,7 @@ async function generateDynamicSnippetTests({ context: context2, ir: ir14, config
|
|
|
1604980
1605122
|
|
|
1604981
1605123
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
1604982
1605124
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
1604983
|
-
var
|
|
1605125
|
+
var import_promises57 = require("fs/promises");
|
|
1604984
1605126
|
var path47 = __toESM(require("path"), 1);
|
|
1604985
1605127
|
var import_path47 = require("path");
|
|
1604986
1605128
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
@@ -1618850,7 +1618992,7 @@ function configureBamlClient(config3) {
|
|
|
1618850
1618992
|
|
|
1618851
1618993
|
// ../generation/local-generation/local-workspace-runner/lib/LocalTaskHandler.js
|
|
1618852
1618994
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
1618853
|
-
var
|
|
1618995
|
+
var import_promises56 = require("fs/promises");
|
|
1618854
1618996
|
var import_os5 = require("os");
|
|
1618855
1618997
|
var import_path46 = require("path");
|
|
1618856
1618998
|
var import_semver6 = __toESM(require_semver2(), 1);
|
|
@@ -1618933,7 +1619075,7 @@ var LocalTaskHandler = class {
|
|
|
1618933
1619075
|
try {
|
|
1618934
1619076
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
1618935
1619077
|
diffFile = await this.generateDiffFile();
|
|
1618936
|
-
const diffContent = await (0,
|
|
1619078
|
+
const diffContent = await (0, import_promises56.readFile)(diffFile, "utf-8");
|
|
1618937
1619079
|
if (diffContent.trim().length === 0) {
|
|
1618938
1619080
|
this.context.logger.info("No changes detected in generated SDK");
|
|
1618939
1619081
|
return null;
|
|
@@ -1618980,7 +1619122,7 @@ var LocalTaskHandler = class {
|
|
|
1618980
1619122
|
} finally {
|
|
1618981
1619123
|
if (diffFile) {
|
|
1618982
1619124
|
try {
|
|
1618983
|
-
await (0,
|
|
1619125
|
+
await (0, import_promises56.rm)(diffFile);
|
|
1618984
1619126
|
} catch (cleanupError) {
|
|
1618985
1619127
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
1618986
1619128
|
}
|
|
@@ -1619060,7 +1619202,7 @@ var LocalTaskHandler = class {
|
|
|
1619060
1619202
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise9.default.dir({})).path);
|
|
1619061
1619203
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join4(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
1619062
1619204
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
1619063
|
-
await (0,
|
|
1619205
|
+
await (0, import_promises56.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
1619064
1619206
|
await this.runGitCommand(["init"], tmpOutputResolutionDir);
|
|
1619065
1619207
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
1619066
1619208
|
const response = await this.runGitCommand(["config", "--list"], tmpOutputResolutionDir);
|
|
@@ -1619075,13 +1619217,13 @@ var LocalTaskHandler = class {
|
|
|
1619075
1619217
|
await this.runGitCommand(["reset", "--", ...fernIgnorePaths], tmpOutputResolutionDir);
|
|
1619076
1619218
|
await this.runGitCommand(["clean", "-fd", "--", ...fernIgnorePaths], tmpOutputResolutionDir);
|
|
1619077
1619219
|
await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
1619078
|
-
await (0,
|
|
1619079
|
-
await (0,
|
|
1619080
|
-
await (0,
|
|
1619220
|
+
await (0, import_promises56.rm)(join4(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
1619221
|
+
await (0, import_promises56.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
1619222
|
+
await (0, import_promises56.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
1619081
1619223
|
}
|
|
1619082
1619224
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
1619083
|
-
const contents = await (0,
|
|
1619084
|
-
await Promise.all(contents.filter((item) => item !== ".git").map((item) => (0,
|
|
1619225
|
+
const contents = await (0, import_promises56.readdir)(this.absolutePathToLocalOutput);
|
|
1619226
|
+
await Promise.all(contents.filter((item) => item !== ".git").map((item) => (0, import_promises56.rm)(join4(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
1619085
1619227
|
force: true,
|
|
1619086
1619228
|
recursive: true
|
|
1619087
1619229
|
})));
|
|
@@ -1619089,11 +1619231,11 @@ var LocalTaskHandler = class {
|
|
|
1619089
1619231
|
}
|
|
1619090
1619232
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
1619091
1619233
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
1619092
|
-
await (0,
|
|
1619234
|
+
await (0, import_promises56.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
1619093
1619235
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
1619094
1619236
|
}
|
|
1619095
1619237
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
1619096
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
1619238
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises56.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
1619097
1619239
|
if (firstLocalOutputItem == null) {
|
|
1619098
1619240
|
return;
|
|
1619099
1619241
|
}
|
|
@@ -1619101,15 +1619243,15 @@ var LocalTaskHandler = class {
|
|
|
1619101
1619243
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
1619102
1619244
|
await (0, import_decompress.default)(join4(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
1619103
1619245
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
1619104
|
-
await (0,
|
|
1619246
|
+
await (0, import_promises56.cp)(join4(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join4(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
1619105
1619247
|
}
|
|
1619106
1619248
|
} else {
|
|
1619107
|
-
await (0,
|
|
1619249
|
+
await (0, import_promises56.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
1619108
1619250
|
}
|
|
1619109
1619251
|
}
|
|
1619110
1619252
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
1619111
1619253
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
1619112
|
-
await (0,
|
|
1619254
|
+
await (0, import_promises56.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
1619113
1619255
|
}
|
|
1619114
1619256
|
async runGitCommand(options2, cwd2) {
|
|
1619115
1619257
|
const response = await loggingExeca(this.context.logger, "git", options2, {
|
|
@@ -1619164,24 +1619306,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
1619164
1619306
|
context2.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
1619165
1619307
|
const configJsonFile = (0, import_path47.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
1619166
1619308
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
1619167
|
-
await (0,
|
|
1619309
|
+
await (0, import_promises57.writeFile)(configJsonFile, "");
|
|
1619168
1619310
|
context2.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
1619169
1619311
|
const tmpOutputDirectory = (0, import_path47.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
1619170
1619312
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
1619171
|
-
await (0,
|
|
1619313
|
+
await (0, import_promises57.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
1619172
1619314
|
context2.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
1619173
1619315
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
1619174
1619316
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
1619175
1619317
|
const snippetJsonFile = (0, import_path47.join)(workspaceTempDir.path, "snippet.json");
|
|
1619176
1619318
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
1619177
|
-
await (0,
|
|
1619319
|
+
await (0, import_promises57.writeFile)(snippetJsonFile, "");
|
|
1619178
1619320
|
context2.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
1619179
1619321
|
}
|
|
1619180
1619322
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
1619181
1619323
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
1619182
1619324
|
const snippetTemplatesJsonFile = (0, import_path47.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
1619183
1619325
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
1619184
|
-
await (0,
|
|
1619326
|
+
await (0, import_promises57.writeFile)(snippetTemplatesJsonFile, "");
|
|
1619185
1619327
|
context2.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
1619186
1619328
|
}
|
|
1619187
1619329
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -1619217,7 +1619359,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
1619217
1619359
|
whiteLabel,
|
|
1619218
1619360
|
paths
|
|
1619219
1619361
|
});
|
|
1619220
|
-
await (0,
|
|
1619362
|
+
await (0, import_promises57.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config3), void 0, 4));
|
|
1619221
1619363
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
1619222
1619364
|
await environment2.execute({
|
|
1619223
1619365
|
generatorName: generatorInvocation.name,
|
|
@@ -1619562,7 +1619704,7 @@ function parseIssue(issue2) {
|
|
|
1619562
1619704
|
}
|
|
1619563
1619705
|
|
|
1619564
1619706
|
// ../workspace/loader/lib/listFernFiles.js
|
|
1619565
|
-
var
|
|
1619707
|
+
var import_promises58 = require("fs/promises");
|
|
1619566
1619708
|
async function listFernFiles2(root6, extensionGlob) {
|
|
1619567
1619709
|
const files = [];
|
|
1619568
1619710
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -1619577,7 +1619719,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
|
|
|
1619577
1619719
|
return {
|
|
1619578
1619720
|
relativeFilepath,
|
|
1619579
1619721
|
absoluteFilepath,
|
|
1619580
|
-
fileContents: (await (0,
|
|
1619722
|
+
fileContents: (await (0, import_promises58.readFile)(absoluteFilepath)).toString()
|
|
1619581
1619723
|
};
|
|
1619582
1619724
|
}
|
|
1619583
1619725
|
|
|
@@ -1619852,7 +1619994,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context2, cl
|
|
|
1619852
1619994
|
}
|
|
1619853
1619995
|
|
|
1619854
1619996
|
// ../workspace/loader/lib/loadDocsWorkspace.js
|
|
1619855
|
-
var
|
|
1619997
|
+
var import_promises59 = require("fs/promises");
|
|
1619856
1619998
|
|
|
1619857
1619999
|
// ../workspace/loader/lib/docs-yml.schema.json
|
|
1619858
1620000
|
var docs_yml_schema_exports = {};
|
|
@@ -1625084,7 +1625226,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
|
|
|
1625084
1625226
|
});
|
|
1625085
1625227
|
}
|
|
1625086
1625228
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context2 }) {
|
|
1625087
|
-
const contentsStr = await (0,
|
|
1625229
|
+
const contentsStr = await (0, import_promises59.readFile)(absolutePathOfConfiguration);
|
|
1625088
1625230
|
const contentsJson = jsYaml.load(contentsStr.toString());
|
|
1625089
1625231
|
const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
|
|
1625090
1625232
|
filePath: absolutePathOfConfiguration
|
|
@@ -1625117,8 +1625259,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
|
|
|
1625117
1625259
|
|
|
1625118
1625260
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
1625119
1625261
|
var import_fs19 = require("fs");
|
|
1625120
|
-
var
|
|
1625121
|
-
var
|
|
1625262
|
+
var import_promises60 = require("fs/promises");
|
|
1625263
|
+
var import_promises61 = require("stream/promises");
|
|
1625122
1625264
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context2 }) {
|
|
1625123
1625265
|
try {
|
|
1625124
1625266
|
await downloadFileForTask({
|
|
@@ -1625135,10 +1625277,10 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
1625135
1625277
|
responseType: "stream"
|
|
1625136
1625278
|
});
|
|
1625137
1625279
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1625138
|
-
await (0,
|
|
1625280
|
+
await (0, import_promises60.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1625139
1625281
|
}
|
|
1625140
|
-
await (0,
|
|
1625141
|
-
await (0,
|
|
1625282
|
+
await (0, import_promises60.mkdir)(dirname4(absolutePathToLocalOutput), { recursive: true });
|
|
1625283
|
+
await (0, import_promises61.pipeline)(request6.data, (0, import_fs19.createWriteStream)(absolutePathToLocalOutput));
|
|
1625142
1625284
|
}
|
|
1625143
1625285
|
|
|
1625144
1625286
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForGenerator.js
|
|
@@ -1625708,7 +1625850,7 @@ var OpenAPIPruner = class {
|
|
|
1625708
1625850
|
};
|
|
1625709
1625851
|
|
|
1625710
1625852
|
// ../register/lib/ai-example-enhancer/enhanceExamplesWithAI.js
|
|
1625711
|
-
var
|
|
1625853
|
+
var import_promises64 = require("fs/promises");
|
|
1625712
1625854
|
|
|
1625713
1625855
|
// ../register/lib/ai-example-enhancer/filterHelpers.js
|
|
1625714
1625856
|
function isFdrTypedValueWrapper(value) {
|
|
@@ -1626060,12 +1626202,12 @@ var SpinnerStatusCoordinator = class _SpinnerStatusCoordinator {
|
|
|
1626060
1626202
|
};
|
|
1626061
1626203
|
|
|
1626062
1626204
|
// ../register/lib/ai-example-enhancer/validateAiExamples.js
|
|
1626063
|
-
var
|
|
1626205
|
+
var import_promises62 = require("fs/promises");
|
|
1626064
1626206
|
async function parseAiExamplesOverride(sourceFilePath, context2) {
|
|
1626065
1626207
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
1626066
1626208
|
const aiExamples = [];
|
|
1626067
1626209
|
try {
|
|
1626068
|
-
const existingContent = await (0,
|
|
1626210
|
+
const existingContent = await (0, import_promises62.readFile)(overrideFilePath, "utf-8");
|
|
1626069
1626211
|
const parsed = jsYaml.load(existingContent);
|
|
1626070
1626212
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
1626071
1626213
|
const paths = parsed.paths;
|
|
@@ -1626114,7 +1626256,7 @@ async function validateAiExamplesFromFile({ sourceFilePath, context: context2 })
|
|
|
1626114
1626256
|
}
|
|
1626115
1626257
|
let spec;
|
|
1626116
1626258
|
try {
|
|
1626117
|
-
const specContent = await (0,
|
|
1626259
|
+
const specContent = await (0, import_promises62.readFile)(sourceFilePath, "utf-8");
|
|
1626118
1626260
|
try {
|
|
1626119
1626261
|
spec = JSON.parse(specContent);
|
|
1626120
1626262
|
} catch {
|
|
@@ -1626173,7 +1626315,7 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context2 }) {
|
|
|
1626173
1626315
|
}
|
|
1626174
1626316
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
1626175
1626317
|
try {
|
|
1626176
|
-
const existingContent = await (0,
|
|
1626318
|
+
const existingContent = await (0, import_promises62.readFile)(overrideFilePath, "utf-8");
|
|
1626177
1626319
|
const parsed = jsYaml.load(existingContent);
|
|
1626178
1626320
|
if (!parsed || !parsed.paths) {
|
|
1626179
1626321
|
return {
|
|
@@ -1626217,12 +1626359,12 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context2 }) {
|
|
|
1626217
1626359
|
}
|
|
1626218
1626360
|
|
|
1626219
1626361
|
// ../register/lib/ai-example-enhancer/writeAiExamplesOverride.js
|
|
1626220
|
-
var
|
|
1626362
|
+
var import_promises63 = require("fs/promises");
|
|
1626221
1626363
|
async function loadExistingOverrideCoverage(sourceFilePath, context2) {
|
|
1626222
1626364
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
1626223
1626365
|
const coveredEndpoints = /* @__PURE__ */ new Set();
|
|
1626224
1626366
|
try {
|
|
1626225
|
-
const existingContent = await (0,
|
|
1626367
|
+
const existingContent = await (0, import_promises63.readFile)(overrideFilePath, "utf-8");
|
|
1626226
1626368
|
const parsed = jsYaml.load(existingContent);
|
|
1626227
1626369
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
1626228
1626370
|
const paths = parsed.paths;
|
|
@@ -1626348,7 +1626490,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
1626348
1626490
|
try {
|
|
1626349
1626491
|
let existingOverride = {};
|
|
1626350
1626492
|
try {
|
|
1626351
|
-
const existingContent = await (0,
|
|
1626493
|
+
const existingContent = await (0, import_promises63.readFile)(overrideFilePath, "utf-8");
|
|
1626352
1626494
|
const parsed = jsYaml.load(existingContent);
|
|
1626353
1626495
|
if (parsed && typeof parsed === "object") {
|
|
1626354
1626496
|
existingOverride = parsed;
|
|
@@ -1626391,7 +1626533,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
1626391
1626533
|
lineWidth: -1,
|
|
1626392
1626534
|
noRefs: true
|
|
1626393
1626535
|
});
|
|
1626394
|
-
await (0,
|
|
1626536
|
+
await (0, import_promises63.writeFile)(overrideFilePath, yamlContent, "utf-8");
|
|
1626395
1626537
|
context2.logger.debug(`AI enhanced examples written to: ${overrideFilePath}`);
|
|
1626396
1626538
|
} catch (error49) {
|
|
1626397
1626539
|
context2.logger.warn(`Failed to write AI examples override file: ${error49}`);
|
|
@@ -1626640,7 +1626782,7 @@ async function performAIEnhancement(apiDefinition, config3, context2, token, org
|
|
|
1626640
1626782
|
let endpointsNeedingRegeneration = /* @__PURE__ */ new Set();
|
|
1626641
1626783
|
if (sourceFilePath != null) {
|
|
1626642
1626784
|
try {
|
|
1626643
|
-
const specContent = await (0,
|
|
1626785
|
+
const specContent = await (0, import_promises64.readFile)(sourceFilePath, "utf-8");
|
|
1626644
1626786
|
if (!isOpenApiSpec2(specContent)) {
|
|
1626645
1626787
|
context2.logger.debug("Non-OpenAPI spec detected, skipping AI example enhancement");
|
|
1626646
1626788
|
return apiDefinition;
|
|
@@ -1628967,13 +1629109,13 @@ async function registerApi({ organization, workspace, context: context2, token,
|
|
|
1628967
1629109
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
1628968
1629110
|
var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
1628969
1629111
|
var import_form_data4 = __toESM(require_form_data(), 1);
|
|
1628970
|
-
var
|
|
1629112
|
+
var import_promises65 = require("fs/promises");
|
|
1628971
1629113
|
var import_url_join20 = __toESM(require_url_join(), 1);
|
|
1628972
1629114
|
async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version7, context: context2, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, fernignorePath }) {
|
|
1628973
1629115
|
let fernignoreContents;
|
|
1628974
1629116
|
if (fernignorePath != null) {
|
|
1628975
1629117
|
try {
|
|
1628976
|
-
fernignoreContents = await (0,
|
|
1629118
|
+
fernignoreContents = await (0, import_promises65.readFile)(fernignorePath, "utf-8");
|
|
1628977
1629119
|
} catch (error49) {
|
|
1628978
1629120
|
context2.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error49}`);
|
|
1628979
1629121
|
}
|
|
@@ -1629171,9 +1629313,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context2 })
|
|
|
1629171
1629313
|
|
|
1629172
1629314
|
// ../generation/remote-generation/remote-workspace-runner/lib/RemoteTaskHandler.js
|
|
1629173
1629315
|
var import_fs20 = require("fs");
|
|
1629174
|
-
var
|
|
1629316
|
+
var import_promises66 = require("fs/promises");
|
|
1629175
1629317
|
var import_path48 = __toESM(require("path"), 1);
|
|
1629176
|
-
var
|
|
1629318
|
+
var import_promises67 = require("stream/promises");
|
|
1629177
1629319
|
|
|
1629178
1629320
|
// ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
|
|
1629179
1629321
|
var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
|
|
@@ -1629342,9 +1629484,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1629342
1629484
|
});
|
|
1629343
1629485
|
const tmpDir = await import_tmp_promise11.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1629344
1629486
|
const outputZipPath = import_path48.default.join(tmpDir.path, "output.zip");
|
|
1629345
|
-
await (0,
|
|
1629487
|
+
await (0, import_promises67.pipeline)(request6.data, (0, import_fs20.createWriteStream)(outputZipPath));
|
|
1629346
1629488
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
1629347
|
-
await (0,
|
|
1629489
|
+
await (0, import_promises66.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
1629348
1629490
|
await extractZipToDirectory(outputZipPath, absolutePathToLocalOutput);
|
|
1629349
1629491
|
}
|
|
1629350
1629492
|
async function forceRemoveDirectory(dirPath) {
|
|
@@ -1629352,22 +1629494,22 @@ async function forceRemoveDirectory(dirPath) {
|
|
|
1629352
1629494
|
return;
|
|
1629353
1629495
|
}
|
|
1629354
1629496
|
await makeWritableRecursive(dirPath);
|
|
1629355
|
-
await (0,
|
|
1629497
|
+
await (0, import_promises66.rm)(dirPath, { recursive: true, force: true });
|
|
1629356
1629498
|
}
|
|
1629357
1629499
|
async function makeWritableRecursive(dirPath) {
|
|
1629358
1629500
|
try {
|
|
1629359
|
-
const entries10 = await (0,
|
|
1629501
|
+
const entries10 = await (0, import_promises66.readdir)(dirPath, { withFileTypes: true });
|
|
1629360
1629502
|
for (const entry of entries10) {
|
|
1629361
1629503
|
const fullPath = AbsoluteFilePath2.of(import_path48.default.join(dirPath, entry.name));
|
|
1629362
1629504
|
if (entry.isDirectory()) {
|
|
1629363
1629505
|
await makeWritableRecursive(fullPath);
|
|
1629364
1629506
|
}
|
|
1629365
1629507
|
try {
|
|
1629366
|
-
await (0,
|
|
1629508
|
+
await (0, import_promises66.chmod)(fullPath, 493);
|
|
1629367
1629509
|
} catch {
|
|
1629368
1629510
|
}
|
|
1629369
1629511
|
}
|
|
1629370
|
-
await (0,
|
|
1629512
|
+
await (0, import_promises66.chmod)(dirPath, 493);
|
|
1629371
1629513
|
} catch {
|
|
1629372
1629514
|
}
|
|
1629373
1629515
|
}
|
|
@@ -1629418,7 +1629560,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
1629418
1629560
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise11.default.dir({})).path);
|
|
1629419
1629561
|
const absolutePathToFernignore = join4(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
1629420
1629562
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
1629421
|
-
await (0,
|
|
1629563
|
+
await (0, import_promises66.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
1629422
1629564
|
await runGitCommand(["init"], tmpOutputResolutionDir, context2);
|
|
1629423
1629565
|
await runGitCommand(["add", "."], tmpOutputResolutionDir, context2);
|
|
1629424
1629566
|
const gitConfigResponse = await runGitCommand(["config", "--list"], tmpOutputResolutionDir, context2);
|
|
@@ -1629434,7 +1629576,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
1629434
1629576
|
await runGitCommand(["restore", "."], tmpOutputResolutionDir, context2);
|
|
1629435
1629577
|
await forceRemoveDirectory(join4(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
|
|
1629436
1629578
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
1629437
|
-
await (0,
|
|
1629579
|
+
await (0, import_promises66.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
|
|
1629438
1629580
|
}
|
|
1629439
1629581
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
1629440
1629582
|
const request6 = await axios_default.get(s3PreSignedReadUrl, {
|
|
@@ -1629442,7 +1629584,7 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
1629442
1629584
|
});
|
|
1629443
1629585
|
const tmpDir = await import_tmp_promise11.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1629444
1629586
|
const outputZipPath = import_path48.default.join(tmpDir.path, "output.zip");
|
|
1629445
|
-
await (0,
|
|
1629587
|
+
await (0, import_promises67.pipeline)(request6.data, (0, import_fs20.createWriteStream)(outputZipPath));
|
|
1629446
1629588
|
await extractZipToDirectory(outputZipPath, outputPath);
|
|
1629447
1629589
|
}
|
|
1629448
1629590
|
async function extractZipToDirectory(zipPath, outputDir) {
|
|
@@ -1629457,10 +1629599,10 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
1629457
1629599
|
zipFile.on("entry", (entry) => {
|
|
1629458
1629600
|
const outputPath = import_path48.default.join(outputDir, entry.fileName);
|
|
1629459
1629601
|
if (entry.fileName.endsWith("/")) {
|
|
1629460
|
-
(0,
|
|
1629602
|
+
(0, import_promises66.mkdir)(outputPath, { recursive: true }).then(() => zipFile.readEntry()).catch(reject);
|
|
1629461
1629603
|
return;
|
|
1629462
1629604
|
}
|
|
1629463
|
-
(0,
|
|
1629605
|
+
(0, import_promises66.mkdir)(import_path48.default.dirname(outputPath), { recursive: true }).then(() => {
|
|
1629464
1629606
|
zipFile.openReadStream(entry, (streamErr, readStream2) => {
|
|
1629465
1629607
|
if (streamErr || !readStream2) {
|
|
1629466
1629608
|
reject(streamErr ?? new Error("Failed to open read stream"));
|
|
@@ -1629476,7 +1629618,7 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
1629476
1629618
|
}
|
|
1629477
1629619
|
|
|
1629478
1629620
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
1629479
|
-
var
|
|
1629621
|
+
var import_promises68 = require("fs/promises");
|
|
1629480
1629622
|
var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
|
|
1629481
1629623
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
1629482
1629624
|
var SourceUploader = class {
|
|
@@ -1629497,7 +1629639,7 @@ var SourceUploader = class {
|
|
|
1629497
1629639
|
}
|
|
1629498
1629640
|
async uploadSource(source2, uploadURL) {
|
|
1629499
1629641
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
1629500
|
-
const fileData = await (0,
|
|
1629642
|
+
const fileData = await (0, import_promises68.readFile)(uploadCommand.absoluteFilePath);
|
|
1629501
1629643
|
const response = await fetch(uploadURL, {
|
|
1629502
1629644
|
method: "PUT",
|
|
1629503
1629645
|
body: fileData,
|
|
@@ -1629517,7 +1629659,7 @@ var SourceUploader = class {
|
|
|
1629517
1629659
|
absoluteFilePath,
|
|
1629518
1629660
|
cleanup: async () => {
|
|
1629519
1629661
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
1629520
|
-
await (0,
|
|
1629662
|
+
await (0, import_promises68.unlink)(absoluteFilePath);
|
|
1629521
1629663
|
}
|
|
1629522
1629664
|
};
|
|
1629523
1629665
|
}
|
|
@@ -1664669,9 +1664811,9 @@ function replaceFrontmatterImagesforLogo(data2, mapImage) {
|
|
|
1664669
1664811
|
}
|
|
1664670
1664812
|
|
|
1664671
1664813
|
// ../docs-markdown-utils/lib/replaceReferencedCode.js
|
|
1664672
|
-
var
|
|
1664814
|
+
var import_promises69 = require("fs/promises");
|
|
1664673
1664815
|
async function defaultFileLoader(filepath) {
|
|
1664674
|
-
const file4 = await (0,
|
|
1664816
|
+
const file4 = await (0, import_promises69.readFile)(filepath);
|
|
1664675
1664817
|
return file4.toString();
|
|
1664676
1664818
|
}
|
|
1664677
1664819
|
function isUrl(src) {
|
|
@@ -1664838,10 +1664980,10 @@ ${replacement}
|
|
|
1664838
1664980
|
}
|
|
1664839
1664981
|
|
|
1664840
1664982
|
// ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
1664841
|
-
var
|
|
1664983
|
+
var import_promises70 = require("fs/promises");
|
|
1664842
1664984
|
var import_gray_matter4 = __toESM(require_gray_matter(), 1);
|
|
1664843
1664985
|
async function defaultMarkdownLoader(filepath) {
|
|
1664844
|
-
const { content: content5 } = (0, import_gray_matter4.default)(await (0,
|
|
1664986
|
+
const { content: content5 } = (0, import_gray_matter4.default)(await (0, import_promises70.readFile)(filepath));
|
|
1664845
1664987
|
return content5;
|
|
1664846
1664988
|
}
|
|
1664847
1664989
|
function extractAttributes(markdownTag) {
|
|
@@ -1664983,7 +1665125,7 @@ init_js();
|
|
|
1664983
1665125
|
init_lib6();
|
|
1664984
1665126
|
var import_dayjs3 = __toESM(require_dayjs_min(), 1);
|
|
1664985
1665127
|
var import_utc3 = __toESM(require_utc(), 1);
|
|
1664986
|
-
var
|
|
1665128
|
+
var import_promises71 = require("fs/promises");
|
|
1664987
1665129
|
var import_gray_matter5 = __toESM(require_gray_matter(), 1);
|
|
1664988
1665130
|
|
|
1664989
1665131
|
// ../docs-resolver/lib/ApiReferenceNodeConverter.js
|
|
@@ -1669435,7 +1669577,7 @@ var DocsDefinitionResolver = class {
|
|
|
1669435
1669577
|
const jsFilePaths = /* @__PURE__ */ new Set();
|
|
1669436
1669578
|
await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
|
|
1669437
1669579
|
const absoluteFilePath = resolve5(this.docsWorkspace.absoluteFilePath, filepath);
|
|
1669438
|
-
const stats = await (0,
|
|
1669580
|
+
const stats = await (0, import_promises71.stat)(absoluteFilePath);
|
|
1669439
1669581
|
if (stats.isDirectory()) {
|
|
1669440
1669582
|
const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx,md,mdx}");
|
|
1669441
1669583
|
files.forEach((file4) => {
|
|
@@ -1669447,7 +1669589,7 @@ var DocsDefinitionResolver = class {
|
|
|
1669447
1669589
|
}));
|
|
1669448
1669590
|
jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
|
|
1669449
1669591
|
const relativeFilePath = this.toRelativeFilepath(filePath);
|
|
1669450
|
-
const contents = (await (0,
|
|
1669592
|
+
const contents = (await (0, import_promises71.readFile)(filePath)).toString();
|
|
1669451
1669593
|
return [relativeFilePath, contents];
|
|
1669452
1669594
|
})));
|
|
1669453
1669595
|
const mdxTime = performance.now() - mdxStart;
|
|
@@ -1669461,13 +1669603,13 @@ var DocsDefinitionResolver = class {
|
|
|
1669461
1669603
|
}
|
|
1669462
1669604
|
if (this._parsedDocsConfig.header != null) {
|
|
1669463
1669605
|
const relativeFilePath = this.toRelativeFilepath(this._parsedDocsConfig.header);
|
|
1669464
|
-
const contents = (await (0,
|
|
1669606
|
+
const contents = (await (0, import_promises71.readFile)(this._parsedDocsConfig.header)).toString();
|
|
1669465
1669607
|
jsFiles[relativeFilePath] = contents;
|
|
1669466
1669608
|
this.taskContext.logger.debug(`Added custom header component: ${relativeFilePath}`);
|
|
1669467
1669609
|
}
|
|
1669468
1669610
|
if (this._parsedDocsConfig.footer != null) {
|
|
1669469
1669611
|
const relativeFilePath = this.toRelativeFilepath(this._parsedDocsConfig.footer);
|
|
1669470
|
-
const contents = (await (0,
|
|
1669612
|
+
const contents = (await (0, import_promises71.readFile)(this._parsedDocsConfig.footer)).toString();
|
|
1669471
1669613
|
jsFiles[relativeFilePath] = contents;
|
|
1669472
1669614
|
this.taskContext.logger.debug(`Added custom footer component: ${relativeFilePath}`);
|
|
1669473
1669615
|
}
|
|
@@ -1676983,7 +1677125,7 @@ async function generateFdrFromOpenApiWorkspace(workspace, context2) {
|
|
|
1676983
1677125
|
// ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
|
|
1676984
1677126
|
init_js();
|
|
1676985
1677127
|
var import_crypto8 = require("crypto");
|
|
1676986
|
-
var
|
|
1677128
|
+
var import_promises72 = require("fs/promises");
|
|
1676987
1677129
|
var mime = __toESM(require_mime_types(), 1);
|
|
1676988
1677130
|
|
|
1676989
1677131
|
// ../workspace/lazy-fern-workspace/src/protobuf/utils.ts
|
|
@@ -1677080,7 +1677222,7 @@ var MEASURE_IMAGE_BATCH_SIZE = 10;
|
|
|
1677080
1677222
|
var UPLOAD_FILE_BATCH_SIZE = 10;
|
|
1677081
1677223
|
var HASH_CONCURRENCY = parseInt(process.env.FERN_DOCS_ASSET_HASH_CONCURRENCY ?? "32", 10);
|
|
1677082
1677224
|
async function calculateFileHash(absoluteFilePath) {
|
|
1677083
|
-
const fileBuffer = await (0,
|
|
1677225
|
+
const fileBuffer = await (0, import_promises72.readFile)(absoluteFilePath);
|
|
1677084
1677226
|
return (0, import_crypto8.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
|
|
1677085
1677227
|
}
|
|
1677086
1677228
|
async function publishDocs({ token, organization, docsWorkspace, domain: domain3, customDomains, apiWorkspaces, ossWorkspaces, context: context2, preview, editThisPage, isPrivate = false, disableTemplates = false, skipUpload = false, withAiExamples = true, excludeApis = false, targetAudiences, docsUrl }) {
|
|
@@ -1677413,7 +1677555,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context2, batchSize
|
|
|
1677413
1677555
|
const absoluteFilePath = resolve5(docsWorkspacePath, relativeFilePath);
|
|
1677414
1677556
|
try {
|
|
1677415
1677557
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
1677416
|
-
await axios_default.put(uploadUrl, await (0,
|
|
1677558
|
+
await axios_default.put(uploadUrl, await (0, import_promises72.readFile)(absoluteFilePath), {
|
|
1677417
1677559
|
headers: {
|
|
1677418
1677560
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
1677419
1677561
|
// Set max cache control for S3 uploads
|
|
@@ -1677945,7 +1678087,7 @@ async function extractPythonDocsSectionFromConfig(config3, absolutePathToFernFol
|
|
|
1677945
1678087
|
const searchVersionFile = async (versionPath) => {
|
|
1677946
1678088
|
try {
|
|
1677947
1678089
|
const absoluteFilepathToVersionFile = resolve5(absolutePathToFernFolder, RelativeFilePath2.of(versionPath));
|
|
1677948
|
-
const content5 = jsYaml.load((await (0,
|
|
1678090
|
+
const content5 = jsYaml.load((await (0, import_promises72.readFile)(absoluteFilepathToVersionFile)).toString());
|
|
1677949
1678091
|
if (content5 != null && typeof content5 === "object") {
|
|
1677950
1678092
|
const versionContent = content5;
|
|
1677951
1678093
|
return findInNavigationConfig(versionContent.navigation);
|
|
@@ -1677957,7 +1678099,7 @@ async function extractPythonDocsSectionFromConfig(config3, absolutePathToFernFol
|
|
|
1677957
1678099
|
const searchProductFile = async (productPath, productVersions) => {
|
|
1677958
1678100
|
try {
|
|
1677959
1678101
|
const absoluteFilepathToProductFile = resolve5(absolutePathToFernFolder, RelativeFilePath2.of(productPath));
|
|
1677960
|
-
const content5 = jsYaml.load((await (0,
|
|
1678102
|
+
const content5 = jsYaml.load((await (0, import_promises72.readFile)(absoluteFilepathToProductFile)).toString());
|
|
1677961
1678103
|
if (content5 != null && typeof content5 === "object") {
|
|
1677962
1678104
|
const productContent = content5;
|
|
1677963
1678105
|
const found = findInNavigationConfig(productContent.navigation);
|
|
@@ -1681998,7 +1682140,7 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
1681998
1682140
|
|
|
1681999
1682141
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
1682000
1682142
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
1682001
|
-
var
|
|
1682143
|
+
var import_promises73 = require("fs/promises");
|
|
1682002
1682144
|
var LegacyGeneratorInvocationAdapter = class {
|
|
1682003
1682145
|
context;
|
|
1682004
1682146
|
constructor(config3) {
|
|
@@ -1682169,7 +1682311,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
1682169
1682311
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
1682170
1682312
|
throw new Error(`Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`);
|
|
1682171
1682313
|
}
|
|
1682172
|
-
const contents = await (0,
|
|
1682314
|
+
const contents = await (0, import_promises73.readFile)(absolutePath, "utf-8");
|
|
1682173
1682315
|
return import_fiddle_sdk6.FernFiddle.GithubLicense.custom({ contents });
|
|
1682174
1682316
|
}
|
|
1682175
1682317
|
mapLanguage(lang) {
|
|
@@ -1683310,12 +1683452,12 @@ function createCliV2(argv) {
|
|
|
1683310
1683452
|
}
|
|
1683311
1683453
|
|
|
1683312
1683454
|
// ../init/lib/initializeAPI.js
|
|
1683313
|
-
var
|
|
1683455
|
+
var import_promises77 = require("fs/promises");
|
|
1683314
1683456
|
var import_fs_extra = __toESM(require_lib13(), 1);
|
|
1683315
1683457
|
var import_path52 = __toESM(require("path"), 1);
|
|
1683316
1683458
|
|
|
1683317
1683459
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
1683318
|
-
var
|
|
1683460
|
+
var import_promises74 = require("fs/promises");
|
|
1683319
1683461
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
1683320
1683462
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
1683321
1683463
|
const pathToFernDirectory = join4(cwd(), RelativeFilePath2.of(FERN_DIRECTORY));
|
|
@@ -1683344,7 +1683486,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
1683344
1683486
|
}
|
|
1683345
1683487
|
}
|
|
1683346
1683488
|
}
|
|
1683347
|
-
await (0,
|
|
1683489
|
+
await (0, import_promises74.mkdir)(FERN_DIRECTORY);
|
|
1683348
1683490
|
await writeProjectConfig({
|
|
1683349
1683491
|
filepath: join4(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
1683350
1683492
|
organization,
|
|
@@ -1683368,11 +1683510,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
1683368
1683510
|
organization,
|
|
1683369
1683511
|
version: versionOfCli
|
|
1683370
1683512
|
};
|
|
1683371
|
-
await (0,
|
|
1683513
|
+
await (0, import_promises74.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
1683372
1683514
|
}
|
|
1683373
1683515
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
1683374
1683516
|
const gitignorePath = join4(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
1683375
|
-
await (0,
|
|
1683517
|
+
await (0, import_promises74.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
1683376
1683518
|
}
|
|
1683377
1683519
|
|
|
1683378
1683520
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -1683556,7 +1683698,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
1683556
1683698
|
}
|
|
1683557
1683699
|
|
|
1683558
1683700
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
1683559
|
-
var
|
|
1683701
|
+
var import_promises75 = require("fs/promises");
|
|
1683560
1683702
|
async function formatFernWorkspace({ workspace, context: context2, shouldFix }) {
|
|
1683561
1683703
|
for (const [relativeFilepath, file4] of entries3(workspace.definition.namedDefinitionFiles)) {
|
|
1683562
1683704
|
const formatted = await formatDefinitionFile({
|
|
@@ -1683564,7 +1683706,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
|
|
|
1683564
1683706
|
});
|
|
1683565
1683707
|
if (formatted !== file4.rawContents) {
|
|
1683566
1683708
|
if (shouldFix) {
|
|
1683567
|
-
await (0,
|
|
1683709
|
+
await (0, import_promises75.writeFile)(file4.absoluteFilePath, formatted);
|
|
1683568
1683710
|
context2.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
1683569
1683711
|
} else {
|
|
1683570
1683712
|
context2.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -1683575,7 +1683717,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
|
|
|
1683575
1683717
|
}
|
|
1683576
1683718
|
|
|
1683577
1683719
|
// ../init/lib/createWorkspace.js
|
|
1683578
|
-
var
|
|
1683720
|
+
var import_promises76 = require("fs/promises");
|
|
1683579
1683721
|
|
|
1683580
1683722
|
// ../init/lib/sampleImdbApi.js
|
|
1683581
1683723
|
var SAMPLE_IMDB_API = `
|
|
@@ -1683643,7 +1683785,7 @@ errors:
|
|
|
1683643
1683785
|
// ../init/lib/createWorkspace.js
|
|
1683644
1683786
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context2 }) {
|
|
1683645
1683787
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
1683646
|
-
await (0,
|
|
1683788
|
+
await (0, import_promises76.mkdir)(directoryOfWorkspace);
|
|
1683647
1683789
|
}
|
|
1683648
1683790
|
await writeGeneratorsConfiguration({
|
|
1683649
1683791
|
filepath: join4(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -1683657,7 +1683799,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
1683657
1683799
|
}
|
|
1683658
1683800
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context2 }) {
|
|
1683659
1683801
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
1683660
|
-
await (0,
|
|
1683802
|
+
await (0, import_promises76.mkdir)(directoryOfWorkspace);
|
|
1683661
1683803
|
}
|
|
1683662
1683804
|
await writeGeneratorsConfiguration({
|
|
1683663
1683805
|
filepath: join4(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -1683703,7 +1683845,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context2
|
|
|
1683703
1683845
|
return config3;
|
|
1683704
1683846
|
}
|
|
1683705
1683847
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context2, apiConfiguration }) {
|
|
1683706
|
-
await (0,
|
|
1683848
|
+
await (0, import_promises76.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context2, apiConfiguration }), {
|
|
1683707
1683849
|
sortKeys: (a10, b18) => {
|
|
1683708
1683850
|
if (a10 === "api") {
|
|
1683709
1683851
|
return -1;
|
|
@@ -1683722,10 +1683864,10 @@ var ROOT_API = {
|
|
|
1683722
1683864
|
}
|
|
1683723
1683865
|
};
|
|
1683724
1683866
|
async function writeSampleApiDefinition({ directoryOfDefinition }) {
|
|
1683725
|
-
await (0,
|
|
1683726
|
-
await (0,
|
|
1683867
|
+
await (0, import_promises76.mkdir)(directoryOfDefinition);
|
|
1683868
|
+
await (0, import_promises76.writeFile)(join4(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(ROOT_API));
|
|
1683727
1683869
|
const absoluteFilepathToImdbYaml = join4(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
1683728
|
-
await (0,
|
|
1683870
|
+
await (0, import_promises76.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
|
|
1683729
1683871
|
fileContents: SAMPLE_IMDB_API
|
|
1683730
1683872
|
}));
|
|
1683731
1683873
|
}
|
|
@@ -1683771,13 +1683913,13 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
1683771
1683913
|
const apiWorkspaceDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
1683772
1683914
|
const inlinedDefinitionDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
1683773
1683915
|
const workspaceDefinitionDirectory = join4(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
1683774
|
-
await (0,
|
|
1683916
|
+
await (0, import_promises77.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
1683775
1683917
|
await import_fs_extra.default.move(inlinedDefinitionDirectory, workspaceDefinitionDirectory);
|
|
1683776
1683918
|
const inlinedGeneratorsYml = join4(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
|
|
1683777
1683919
|
const workspaceGeneratorsYml = join4(apiWorkspaceDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
|
|
1683778
1683920
|
await import_fs_extra.default.move(inlinedGeneratorsYml, workspaceGeneratorsYml);
|
|
1683779
1683921
|
const newApiDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api1"));
|
|
1683780
|
-
await (0,
|
|
1683922
|
+
await (0, import_promises77.mkdir)(workspaceDefinitionDirectory, { recursive: true });
|
|
1683781
1683923
|
return newApiDirectory;
|
|
1683782
1683924
|
}
|
|
1683783
1683925
|
return absolutePathToFernDirectory;
|
|
@@ -1683792,7 +1683934,7 @@ async function hasInlinedAPIDefinitions({ absolutePathToFernDirectory }) {
|
|
|
1683792
1683934
|
}
|
|
1683793
1683935
|
|
|
1683794
1683936
|
// ../init/lib/initializeDocs.js
|
|
1683795
|
-
var
|
|
1683937
|
+
var import_promises78 = require("fs/promises");
|
|
1683796
1683938
|
|
|
1683797
1683939
|
// ../../commons/core-utils/src/titleCase.ts
|
|
1683798
1683940
|
var import_title4 = __toESM(require_lib5(), 1);
|
|
@@ -1684208,7 +1684350,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
1684208
1684350
|
} else {
|
|
1684209
1684351
|
try {
|
|
1684210
1684352
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
1684211
|
-
await (0,
|
|
1684353
|
+
await (0, import_promises78.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
1684212
1684354
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
1684213
1684355
|
return;
|
|
1684214
1684356
|
} catch (writeError) {
|
|
@@ -1684256,7 +1684398,7 @@ var FernDocsBuilder = class {
|
|
|
1684256
1684398
|
};
|
|
1684257
1684399
|
|
|
1684258
1684400
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
1684259
|
-
var
|
|
1684401
|
+
var import_promises79 = require("fs/promises");
|
|
1684260
1684402
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
1684261
1684403
|
openApiSpecs = {};
|
|
1684262
1684404
|
nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
|
|
@@ -1684315,7 +1684457,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
1684315
1684457
|
}
|
|
1684316
1684458
|
async build({ outputDirectory }) {
|
|
1684317
1684459
|
const absolutePathToFernDirectory = join4(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
1684318
|
-
await (0,
|
|
1684460
|
+
await (0, import_promises79.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
1684319
1684461
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
1684320
1684462
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value]) => {
|
|
1684321
1684463
|
return [value.tabId, value.tabConfig];
|
|
@@ -1684340,27 +1684482,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
1684340
1684482
|
}))
|
|
1684341
1684483
|
};
|
|
1684342
1684484
|
}
|
|
1684343
|
-
await (0,
|
|
1684485
|
+
await (0, import_promises79.writeFile)(join4(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
1684344
1684486
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
1684345
1684487
|
const absolutePathToOpenAPI = join4(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
1684346
|
-
await (0,
|
|
1684347
|
-
await (0,
|
|
1684488
|
+
await (0, import_promises79.mkdir)(dirname4(absolutePathToOpenAPI), { recursive: true });
|
|
1684489
|
+
await (0, import_promises79.cp)(absolutePath, absolutePathToOpenAPI);
|
|
1684348
1684490
|
}));
|
|
1684349
1684491
|
}
|
|
1684350
|
-
await (0,
|
|
1684492
|
+
await (0, import_promises79.writeFile)(join4(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
1684351
1684493
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
1684352
1684494
|
const absoluteFilepathToMarkdownPage = join4(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
1684353
|
-
await (0,
|
|
1684495
|
+
await (0, import_promises79.mkdir)(dirname4(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
1684354
1684496
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
1684355
1684497
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
1684356
1684498
|
|
|
1684357
1684499
|
` : "";
|
|
1684358
|
-
await (0,
|
|
1684500
|
+
await (0, import_promises79.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
1684359
1684501
|
}));
|
|
1684360
1684502
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
1684361
1684503
|
const absolutePathToAsset = join4(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
1684362
|
-
await (0,
|
|
1684363
|
-
await (0,
|
|
1684504
|
+
await (0, import_promises79.mkdir)(dirname4(absolutePathToAsset), { recursive: true });
|
|
1684505
|
+
await (0, import_promises79.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
1684364
1684506
|
}));
|
|
1684365
1684507
|
}
|
|
1684366
1684508
|
setInstance({ companyName }) {
|
|
@@ -1684392,7 +1684534,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
1684392
1684534
|
};
|
|
1684393
1684535
|
|
|
1684394
1684536
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
1684395
|
-
var
|
|
1684537
|
+
var import_promises81 = require("fs/promises");
|
|
1684396
1684538
|
|
|
1684397
1684539
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
1684398
1684540
|
function convertColors(colors19) {
|
|
@@ -1684446,10 +1684588,10 @@ function convertLogo({ logo, builder, absolutePathToMintJson }) {
|
|
|
1684446
1684588
|
}
|
|
1684447
1684589
|
|
|
1684448
1684590
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
1684449
|
-
var
|
|
1684591
|
+
var import_promises80 = require("fs/promises");
|
|
1684450
1684592
|
var import_gray_matter6 = __toESM(require_gray_matter(), 1);
|
|
1684451
1684593
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
1684452
|
-
const text9 = await (0,
|
|
1684594
|
+
const text9 = await (0, import_promises80.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
1684453
1684595
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
1684454
1684596
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
1684455
1684597
|
const transformedContent = markReferencedAssets({
|
|
@@ -1684612,7 +1684754,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
1684612
1684754
|
documentationTab = void 0;
|
|
1684613
1684755
|
tabUrlToInfo = {};
|
|
1684614
1684756
|
async import({ args, builder }) {
|
|
1684615
|
-
const mintJsonContent = await (0,
|
|
1684757
|
+
const mintJsonContent = await (0, import_promises81.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
1684616
1684758
|
const mint = JSON.parse(mintJsonContent);
|
|
1684617
1684759
|
builder.setTitle({ title: mint.name });
|
|
1684618
1684760
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -1684737,7 +1684879,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
1684737
1684879
|
};
|
|
1684738
1684880
|
|
|
1684739
1684881
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
1684740
|
-
var
|
|
1684882
|
+
var import_promises82 = require("fs/promises");
|
|
1684741
1684883
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
1684742
1684884
|
const mintlifyImporter = new MintlifyImporter({
|
|
1684743
1684885
|
context: taskContext
|
|
@@ -1684748,7 +1684890,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
1684748
1684890
|
builder
|
|
1684749
1684891
|
});
|
|
1684750
1684892
|
await builder.build({ outputDirectory: outputPath });
|
|
1684751
|
-
await (0,
|
|
1684893
|
+
await (0, import_promises82.writeFile)(join4(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
1684752
1684894
|
version: versionOfCli,
|
|
1684753
1684895
|
organization
|
|
1684754
1684896
|
}, void 0, 4));
|
|
@@ -1684797,7 +1684939,7 @@ function assertIsStringArray(val) {
|
|
|
1684797
1684939
|
}
|
|
1684798
1684940
|
|
|
1684799
1684941
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
1684800
|
-
var
|
|
1684942
|
+
var import_promises87 = require("fs/promises");
|
|
1684801
1684943
|
|
|
1684802
1684944
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
1684803
1684945
|
async function getFavicon(hast) {
|
|
@@ -1707903,7 +1708045,7 @@ init_disposable();
|
|
|
1707903
1708045
|
init_incremental_id_generator();
|
|
1707904
1708046
|
|
|
1707905
1708047
|
// ../../../node_modules/.pnpm/puppeteer-core@24.36.1/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
1707906
|
-
var
|
|
1708048
|
+
var import_promises85 = require("fs/promises");
|
|
1707907
1708049
|
var import_node_os9 = __toESM(require("os"), 1);
|
|
1707908
1708050
|
var import_node_path27 = __toESM(require("path"), 1);
|
|
1707909
1708051
|
init_main();
|
|
@@ -1708346,7 +1708488,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
1708346
1708488
|
});
|
|
1708347
1708489
|
if (userDataDirIndex < 0) {
|
|
1708348
1708490
|
isTempUserDataDir = true;
|
|
1708349
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
1708491
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises85.mkdtemp)(this.getProfilePath())}`);
|
|
1708350
1708492
|
userDataDirIndex = chromeArguments.length - 1;
|
|
1708351
1708493
|
}
|
|
1708352
1708494
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -1708498,7 +1708640,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
1708498
1708640
|
|
|
1708499
1708641
|
// ../../../node_modules/.pnpm/puppeteer-core@24.36.1/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
1708500
1708642
|
var import_node_fs19 = __toESM(require("fs"), 1);
|
|
1708501
|
-
var
|
|
1708643
|
+
var import_promises86 = require("fs/promises");
|
|
1708502
1708644
|
var import_node_os10 = __toESM(require("os"), 1);
|
|
1708503
1708645
|
var import_node_path28 = __toESM(require("path"), 1);
|
|
1708504
1708646
|
init_main();
|
|
@@ -1708552,7 +1708694,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
1708552
1708694
|
}
|
|
1708553
1708695
|
isTempUserDataDir = false;
|
|
1708554
1708696
|
} else {
|
|
1708555
|
-
userDataDir = await (0,
|
|
1708697
|
+
userDataDir = await (0, import_promises86.mkdtemp)(this.getProfilePath());
|
|
1708556
1708698
|
firefoxArguments.push("--profile");
|
|
1708557
1708699
|
firefoxArguments.push(userDataDir);
|
|
1708558
1708700
|
}
|
|
@@ -1708593,8 +1708735,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
1708593
1708735
|
const prefsBackupPath = import_node_path28.default.join(userDataDir, file4 + backupSuffix);
|
|
1708594
1708736
|
if (import_node_fs19.default.existsSync(prefsBackupPath)) {
|
|
1708595
1708737
|
const prefsPath = import_node_path28.default.join(userDataDir, file4);
|
|
1708596
|
-
await (0,
|
|
1708597
|
-
await (0,
|
|
1708738
|
+
await (0, import_promises86.unlink)(prefsPath);
|
|
1708739
|
+
await (0, import_promises86.rename)(prefsBackupPath, prefsPath);
|
|
1708598
1708740
|
}
|
|
1708599
1708741
|
}));
|
|
1708600
1708742
|
for (const result of results) {
|
|
@@ -1709627,7 +1709769,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1709627
1709769
|
if (response.ok) {
|
|
1709628
1709770
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
1709629
1709771
|
const faviconPath = join4(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
1709630
|
-
await (0,
|
|
1709772
|
+
await (0, import_promises87.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
1709631
1709773
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
1709632
1709774
|
}
|
|
1709633
1709775
|
}
|
|
@@ -1709644,7 +1709786,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1709644
1709786
|
*/
|
|
1709645
1709787
|
async getAndCreateAssetsDirectory() {
|
|
1709646
1709788
|
const assetsDirectory = join4(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
1709647
|
-
await (0,
|
|
1709789
|
+
await (0, import_promises87.mkdir)(assetsDirectory, { recursive: true });
|
|
1709648
1709790
|
return assetsDirectory;
|
|
1709649
1709791
|
}
|
|
1709650
1709792
|
/**
|
|
@@ -1709694,7 +1709836,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1709694
1709836
|
absolutePathToOutputDirectory,
|
|
1709695
1709837
|
section
|
|
1709696
1709838
|
});
|
|
1709697
|
-
await (0,
|
|
1709839
|
+
await (0, import_promises87.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
1709698
1709840
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
1709699
1709841
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
1709700
1709842
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -1709709,7 +1709851,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1709709
1709851
|
absolutePathToOutputDirectoryForSection,
|
|
1709710
1709852
|
page: page.slug
|
|
1709711
1709853
|
});
|
|
1709712
|
-
await (0,
|
|
1709854
|
+
await (0, import_promises87.writeFile)(absolutePathForPage, result.data.mdx);
|
|
1709713
1709855
|
if (result.data.images.imageURLs.length > 0) {
|
|
1709714
1709856
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
1709715
1709857
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -1709722,8 +1709864,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1709722
1709864
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
1709723
1709865
|
const imagePath = join4(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
1709724
1709866
|
const imageDir = dirname4(imagePath);
|
|
1709725
|
-
await (0,
|
|
1709726
|
-
await (0,
|
|
1709867
|
+
await (0, import_promises87.mkdir)(imageDir, { recursive: true });
|
|
1709868
|
+
await (0, import_promises87.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
1709727
1709869
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
1709728
1709870
|
} catch (error49) {
|
|
1709729
1709871
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error49}`);
|
|
@@ -1709805,7 +1709947,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1709805
1709947
|
};
|
|
1709806
1709948
|
|
|
1709807
1709949
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
1709808
|
-
var
|
|
1709950
|
+
var import_promises88 = require("fs/promises");
|
|
1709809
1709951
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
1709810
1709952
|
const builder = new FernDocsBuilderImpl();
|
|
1709811
1709953
|
builder.setInstance({ companyName: organization });
|
|
@@ -1709820,7 +1709962,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
1709820
1709962
|
builder
|
|
1709821
1709963
|
});
|
|
1709822
1709964
|
await builder.build({ outputDirectory: outputPath });
|
|
1709823
|
-
await (0,
|
|
1709965
|
+
await (0, import_promises88.writeFile)(join4(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
1709824
1709966
|
version: versionOfCli,
|
|
1709825
1709967
|
organization
|
|
1709826
1709968
|
}, void 0, 4));
|
|
@@ -1711687,7 +1711829,7 @@ Yargs2.Parser = Parser8;
|
|
|
1711687
1711829
|
var yargs_default2 = Yargs2;
|
|
1711688
1711830
|
|
|
1711689
1711831
|
// ../init/src/utils/loadOpenApiFromUrl.ts
|
|
1711690
|
-
var
|
|
1711832
|
+
var import_promises89 = require("fs/promises");
|
|
1711691
1711833
|
var import_path53 = require("path");
|
|
1711692
1711834
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
1711693
1711835
|
async function loadOpenAPIFromUrl({ url: url3, logger }) {
|
|
@@ -1711697,7 +1711839,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger }) {
|
|
|
1711697
1711839
|
const filePath = (0, import_path53.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
1711698
1711840
|
logger.debug("tmpDir", tmpDir.path);
|
|
1711699
1711841
|
logger.debug("filePath", filePath);
|
|
1711700
|
-
await (0,
|
|
1711842
|
+
await (0, import_promises89.writeFile)(filePath, data2);
|
|
1711701
1711843
|
return {
|
|
1711702
1711844
|
status: "success" /* Success */,
|
|
1711703
1711845
|
filePath
|
|
@@ -1714124,7 +1714266,7 @@ var CliContext = class {
|
|
|
1714124
1714266
|
if (false) {
|
|
1714125
1714267
|
this.logger.error("CLI_VERSION is not defined");
|
|
1714126
1714268
|
}
|
|
1714127
|
-
return "3.
|
|
1714269
|
+
return "3.67.0";
|
|
1714128
1714270
|
}
|
|
1714129
1714271
|
getCliName() {
|
|
1714130
1714272
|
if (false) {
|
|
@@ -1714378,7 +1714520,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
1714378
1714520
|
}
|
|
1714379
1714521
|
|
|
1714380
1714522
|
// ../project-loader/lib/loadProject.js
|
|
1714381
|
-
var
|
|
1714523
|
+
var import_promises90 = require("fs/promises");
|
|
1714382
1714524
|
async function loadProject({ context: context2, nameOverride, ...args }) {
|
|
1714383
1714525
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
1714384
1714526
|
if (fernDirectory == null) {
|
|
@@ -1714433,7 +1714575,7 @@ async function loadApis({ cliName, fernDirectory, context: context2, cliVersion,
|
|
|
1714433
1714575
|
const apisDirectory = join4(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
1714434
1714576
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
1714435
1714577
|
if (apisDirectoryExists) {
|
|
1714436
|
-
const apiDirectoryContents = await (0,
|
|
1714578
|
+
const apiDirectoryContents = await (0, import_promises90.readdir)(apisDirectory, { withFileTypes: true });
|
|
1714437
1714579
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
1714438
1714580
|
if (item.isDirectory()) {
|
|
1714439
1714581
|
all9.push(item.name);
|
|
@@ -1714510,10 +1714652,10 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
1714510
1714652
|
|
|
1714511
1714653
|
// src/cliV2.ts
|
|
1714512
1714654
|
var import_generators_sdk4 = __toESM(require_generators_sdk(), 1);
|
|
1714513
|
-
var
|
|
1714655
|
+
var import_promises95 = require("fs/promises");
|
|
1714514
1714656
|
|
|
1714515
1714657
|
// src/commands/generator-list/getGeneratorList.ts
|
|
1714516
|
-
var
|
|
1714658
|
+
var import_promises91 = require("fs/promises");
|
|
1714517
1714659
|
var GenerationModeFilter = {
|
|
1714518
1714660
|
GitHub: "github",
|
|
1714519
1714661
|
Local: "local-file-system",
|
|
@@ -1714573,7 +1714715,7 @@ async function getGeneratorList({
|
|
|
1714573
1714715
|
return;
|
|
1714574
1714716
|
}
|
|
1714575
1714717
|
try {
|
|
1714576
|
-
await (0,
|
|
1714718
|
+
await (0, import_promises91.writeFile)(outputLocation, generatorsListYaml);
|
|
1714577
1714719
|
} catch (error49) {
|
|
1714578
1714720
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
|
|
1714579
1714721
|
}
|
|
@@ -1714639,7 +1714781,7 @@ async function getGeneratorMetadata({
|
|
|
1714639
1714781
|
}
|
|
1714640
1714782
|
|
|
1714641
1714783
|
// src/commands/organization/getOrganization.ts
|
|
1714642
|
-
var
|
|
1714784
|
+
var import_promises92 = require("fs/promises");
|
|
1714643
1714785
|
async function getOrganization({
|
|
1714644
1714786
|
project,
|
|
1714645
1714787
|
outputLocation,
|
|
@@ -1714651,20 +1714793,20 @@ async function getOrganization({
|
|
|
1714651
1714793
|
return;
|
|
1714652
1714794
|
}
|
|
1714653
1714795
|
try {
|
|
1714654
|
-
await (0,
|
|
1714796
|
+
await (0, import_promises92.writeFile)(outputLocation, org);
|
|
1714655
1714797
|
} catch (error49) {
|
|
1714656
1714798
|
context2.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
|
|
1714657
1714799
|
}
|
|
1714658
1714800
|
}
|
|
1714659
1714801
|
|
|
1714660
1714802
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
1714661
|
-
var
|
|
1714803
|
+
var import_promises94 = require("fs/promises");
|
|
1714662
1714804
|
var import_path55 = __toESM(require("path"), 1);
|
|
1714663
1714805
|
var import_semver9 = __toESM(require_semver2(), 1);
|
|
1714664
1714806
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
1714665
1714807
|
|
|
1714666
1714808
|
// src/commands/upgrade/migrations/loader.ts
|
|
1714667
|
-
var
|
|
1714809
|
+
var import_promises93 = require("fs/promises");
|
|
1714668
1714810
|
var import_os7 = require("os");
|
|
1714669
1714811
|
var import_path54 = require("path");
|
|
1714670
1714812
|
var import_semver8 = __toESM(require_semver2(), 1);
|
|
@@ -1714675,7 +1714817,7 @@ function getMigrationCacheDir() {
|
|
|
1714675
1714817
|
async function loadMigrationModule(params2) {
|
|
1714676
1714818
|
const { generatorName, logger } = params2;
|
|
1714677
1714819
|
const cacheDir = getMigrationCacheDir();
|
|
1714678
|
-
await (0,
|
|
1714820
|
+
await (0, import_promises93.mkdir)(cacheDir, { recursive: true });
|
|
1714679
1714821
|
try {
|
|
1714680
1714822
|
await loggingExeca(logger, "npm", [
|
|
1714681
1714823
|
"install",
|
|
@@ -1714688,7 +1714830,7 @@ async function loadMigrationModule(params2) {
|
|
|
1714688
1714830
|
]);
|
|
1714689
1714831
|
const packageDir = (0, import_path54.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
1714690
1714832
|
const packageJsonPath = (0, import_path54.join)(packageDir, "package.json");
|
|
1714691
|
-
const packageJsonContent = await (0,
|
|
1714833
|
+
const packageJsonContent = await (0, import_promises93.readFile)(packageJsonPath, "utf-8");
|
|
1714692
1714834
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
1714693
1714835
|
if (packageJson2.main == null) {
|
|
1714694
1714836
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
|
|
@@ -1714839,7 +1714981,7 @@ async function loadAndUpdateGenerators({
|
|
|
1714839
1714981
|
context2.logger.debug("Generators configuration file was not found, no generators to upgrade.");
|
|
1714840
1714982
|
return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
|
|
1714841
1714983
|
}
|
|
1714842
|
-
const contents = await (0,
|
|
1714984
|
+
const contents = await (0, import_promises94.readFile)(filepath);
|
|
1714843
1714985
|
context2.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1714844
1714986
|
const parsedDocument = import_yaml4.default.parseDocument(contents.toString());
|
|
1714845
1714987
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -1715026,7 +1715168,7 @@ async function upgradeGenerator({
|
|
|
1715026
1715168
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
1715027
1715169
|
});
|
|
1715028
1715170
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
1715029
|
-
await (0,
|
|
1715171
|
+
await (0, import_promises94.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
1715030
1715172
|
}
|
|
1715031
1715173
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
1715032
1715174
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -1715380,7 +1715522,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
1715380
1715522
|
}
|
|
1715381
1715523
|
if (argv.output) {
|
|
1715382
1715524
|
try {
|
|
1715383
|
-
await (0,
|
|
1715525
|
+
await (0, import_promises95.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
1715384
1715526
|
} catch (error49) {
|
|
1715385
1715527
|
cliContext.failAndThrow(
|
|
1715386
1715528
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -1715394,7 +1715536,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
1715394
1715536
|
}
|
|
1715395
1715537
|
|
|
1715396
1715538
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
1715397
|
-
var
|
|
1715539
|
+
var import_promises96 = require("fs/promises");
|
|
1715398
1715540
|
async function addGeneratorToWorkspaces({
|
|
1715399
1715541
|
project: { apiWorkspaces },
|
|
1715400
1715542
|
generatorName,
|
|
@@ -1715421,7 +1715563,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1715421
1715563
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
1715422
1715564
|
return;
|
|
1715423
1715565
|
}
|
|
1715424
|
-
await (0,
|
|
1715566
|
+
await (0, import_promises96.writeFile)(
|
|
1715425
1715567
|
absolutePathToGeneratorsConfiguration,
|
|
1715426
1715568
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
1715427
1715569
|
);
|
|
@@ -1715432,7 +1715574,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1715432
1715574
|
}
|
|
1715433
1715575
|
|
|
1715434
1715576
|
// src/commands/diff/diff.ts
|
|
1715435
|
-
var
|
|
1715577
|
+
var import_promises97 = require("fs/promises");
|
|
1715436
1715578
|
var import_semver10 = __toESM(require_semver2(), 1);
|
|
1715437
1715579
|
async function diff({
|
|
1715438
1715580
|
context: context2,
|
|
@@ -1715475,7 +1715617,7 @@ async function readIr({
|
|
|
1715475
1715617
|
context2.failWithoutThrowing(`File not found: ${absoluteFilepath}`);
|
|
1715476
1715618
|
throw new FernCliError();
|
|
1715477
1715619
|
}
|
|
1715478
|
-
const ir14 = await (0,
|
|
1715620
|
+
const ir14 = await (0, import_promises97.readFile)(absoluteFilepath, "utf-8");
|
|
1715479
1715621
|
const parsed = serialization_exports3.IntermediateRepresentation.parse(JSON.parse(ir14));
|
|
1715480
1715622
|
if (!parsed.ok) {
|
|
1715481
1715623
|
context2.failWithoutThrowing(`Invalid --${flagName}; expected a filepath containing a valid IR`);
|
|
@@ -1715566,7 +1715708,7 @@ function bumpFromDiff(diff2) {
|
|
|
1715566
1715708
|
init_js();
|
|
1715567
1715709
|
var import_cors = __toESM(require_lib17(), 1);
|
|
1715568
1715710
|
var import_express = __toESM(require_express3(), 1);
|
|
1715569
|
-
var
|
|
1715711
|
+
var import_promises103 = require("fs/promises");
|
|
1715570
1715712
|
var import_http6 = __toESM(require("http"), 1);
|
|
1715571
1715713
|
var import_path58 = __toESM(require("path"), 1);
|
|
1715572
1715714
|
|
|
@@ -1717238,13 +1717380,13 @@ var watcher_default = Watcher;
|
|
|
1717238
1717380
|
init_wrapper();
|
|
1717239
1717381
|
|
|
1717240
1717382
|
// ../docs-preview/lib/DebugLogger.js
|
|
1717241
|
-
var
|
|
1717383
|
+
var import_promises98 = require("fs/promises");
|
|
1717242
1717384
|
var import_os8 = require("os");
|
|
1717243
1717385
|
var import_path56 = __toESM(require("path"), 1);
|
|
1717244
1717386
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1717245
1717387
|
var LOGS_FOLDER_NAME = "logs";
|
|
1717246
1717388
|
function getCliSource() {
|
|
1717247
|
-
const version7 = "3.
|
|
1717389
|
+
const version7 = "3.67.0";
|
|
1717248
1717390
|
return `cli@${version7}`;
|
|
1717249
1717391
|
}
|
|
1717250
1717392
|
var DebugLogger = class {
|
|
@@ -1717264,7 +1717406,7 @@ var DebugLogger = class {
|
|
|
1717264
1717406
|
const localStorageFolder = join4(AbsoluteFilePath2.of((0, import_os8.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
|
|
1717265
1717407
|
const logsDir = join4(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
|
|
1717266
1717408
|
if (!await doesPathExist(logsDir)) {
|
|
1717267
|
-
await (0,
|
|
1717409
|
+
await (0, import_promises98.mkdir)(logsDir, { recursive: true });
|
|
1717268
1717410
|
}
|
|
1717269
1717411
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
1717270
1717412
|
const logFileName = `${timestamp2}.debug.log`;
|
|
@@ -1717277,7 +1717419,7 @@ var DebugLogger = class {
|
|
|
1717277
1717419
|
"================================================================================",
|
|
1717278
1717420
|
""
|
|
1717279
1717421
|
].join("\n");
|
|
1717280
|
-
await (0,
|
|
1717422
|
+
await (0, import_promises98.writeFile)(this.logFilePath, header, "utf-8");
|
|
1717281
1717423
|
this.initialized = true;
|
|
1717282
1717424
|
}
|
|
1717283
1717425
|
/**
|
|
@@ -1717295,7 +1717437,7 @@ var DebugLogger = class {
|
|
|
1717295
1717437
|
}
|
|
1717296
1717438
|
const line = JSON.stringify(entry) + "\n";
|
|
1717297
1717439
|
try {
|
|
1717298
|
-
await (0,
|
|
1717440
|
+
await (0, import_promises98.appendFile)(this.logFilePath, line, "utf-8");
|
|
1717299
1717441
|
} catch (error49) {
|
|
1717300
1717442
|
}
|
|
1717301
1717443
|
}
|
|
@@ -1717419,7 +1717561,7 @@ var DebugLogger = class {
|
|
|
1717419
1717561
|
// ../docs-preview/lib/downloadLocalDocsBundle.js
|
|
1717420
1717562
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
1717421
1717563
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
1717422
|
-
var
|
|
1717564
|
+
var import_promises99 = require("fs/promises");
|
|
1717423
1717565
|
var import_os9 = require("os");
|
|
1717424
1717566
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
1717425
1717567
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
@@ -1717507,7 +1717649,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1717507
1717649
|
let currentETag = void 0;
|
|
1717508
1717650
|
if (currentETagExists) {
|
|
1717509
1717651
|
logger.debug("Reading existing ETag");
|
|
1717510
|
-
currentETag = (await (0,
|
|
1717652
|
+
currentETag = (await (0, import_promises99.readFile)(eTagFilepath)).toString();
|
|
1717511
1717653
|
}
|
|
1717512
1717654
|
if (currentETag != null && currentETag === eTag) {
|
|
1717513
1717655
|
logger.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -1717571,16 +1717713,16 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1717571
1717713
|
}
|
|
1717572
1717714
|
}
|
|
1717573
1717715
|
const nodeBuffer = Buffer.concat(chunks);
|
|
1717574
|
-
await (0,
|
|
1717716
|
+
await (0, import_promises99.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
|
|
1717575
1717717
|
logger.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
|
|
1717576
1717718
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
1717577
1717719
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1717578
1717720
|
logger.debug(`Removing previously cached bundle at: ${absolutePathToPreviewFolder}`);
|
|
1717579
|
-
await (0,
|
|
1717721
|
+
await (0, import_promises99.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1717580
1717722
|
}
|
|
1717581
|
-
await (0,
|
|
1717723
|
+
await (0, import_promises99.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
1717582
1717724
|
const absolutePathToBundleFolder = getPathToBundleFolder({ app });
|
|
1717583
|
-
await (0,
|
|
1717725
|
+
await (0, import_promises99.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
1717584
1717726
|
logger.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
|
|
1717585
1717727
|
let unzipProgressBar;
|
|
1717586
1717728
|
let unzipInterval;
|
|
@@ -1717615,7 +1717757,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1717615
1717757
|
unzipProgressBar.stop();
|
|
1717616
1717758
|
}
|
|
1717617
1717759
|
}
|
|
1717618
|
-
await (0,
|
|
1717760
|
+
await (0, import_promises99.writeFile)(eTagFilepath, eTag);
|
|
1717619
1717761
|
logger.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
1717620
1717762
|
if (app) {
|
|
1717621
1717763
|
logger.debug("Checking if pnpm is installed");
|
|
@@ -1717697,15 +1717839,15 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1717697
1717839
|
}
|
|
1717698
1717840
|
if (!pnpmfileExists) {
|
|
1717699
1717841
|
logger.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
|
|
1717700
|
-
await (0,
|
|
1717842
|
+
await (0, import_promises99.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
|
|
1717701
1717843
|
}
|
|
1717702
1717844
|
if (!npmrcExists) {
|
|
1717703
1717845
|
logger.debug(`Writing .npmrc at ${npmrcPath}`);
|
|
1717704
|
-
await (0,
|
|
1717846
|
+
await (0, import_promises99.writeFile)(npmrcPath, NPMRC_CONTENTS);
|
|
1717705
1717847
|
}
|
|
1717706
1717848
|
if (instrumentationJsExists) {
|
|
1717707
1717849
|
logger.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
|
|
1717708
|
-
await (0,
|
|
1717850
|
+
await (0, import_promises99.rm)(absPathToInstrumentationJs);
|
|
1717709
1717851
|
}
|
|
1717710
1717852
|
try {
|
|
1717711
1717853
|
logger.debug("Running pnpm install within standalone");
|
|
@@ -1717725,7 +1717867,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1717725
1717867
|
logger.error(`Error: ${error49}`);
|
|
1717726
1717868
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
1717727
1717869
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1717728
|
-
await (0,
|
|
1717870
|
+
await (0, import_promises99.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1717729
1717871
|
}
|
|
1717730
1717872
|
logger.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
|
|
1717731
1717873
|
return {
|
|
@@ -1717736,7 +1717878,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1717736
1717878
|
|
|
1717737
1717879
|
// ../docs-preview/lib/previewDocs.js
|
|
1717738
1717880
|
init_js();
|
|
1717739
|
-
var
|
|
1717881
|
+
var import_promises102 = require("fs/promises");
|
|
1717740
1717882
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
1717741
1717883
|
|
|
1717742
1717884
|
// ../docs-markdown-utils/src/extract-literals.ts
|
|
@@ -1718580,9 +1718722,9 @@ function replaceFrontmatterImagesforLogo2(data2, mapImage) {
|
|
|
1718580
1718722
|
}
|
|
1718581
1718723
|
|
|
1718582
1718724
|
// ../docs-markdown-utils/src/replaceReferencedCode.ts
|
|
1718583
|
-
var
|
|
1718725
|
+
var import_promises100 = require("fs/promises");
|
|
1718584
1718726
|
async function defaultFileLoader2(filepath) {
|
|
1718585
|
-
const file4 = await (0,
|
|
1718727
|
+
const file4 = await (0, import_promises100.readFile)(filepath);
|
|
1718586
1718728
|
return file4.toString();
|
|
1718587
1718729
|
}
|
|
1718588
1718730
|
function isUrl3(src) {
|
|
@@ -1718756,10 +1718898,10 @@ ${replacement}
|
|
|
1718756
1718898
|
}
|
|
1718757
1718899
|
|
|
1718758
1718900
|
// ../docs-markdown-utils/src/replaceReferencedMarkdown.ts
|
|
1718759
|
-
var
|
|
1718901
|
+
var import_promises101 = require("fs/promises");
|
|
1718760
1718902
|
var import_gray_matter9 = __toESM(require_gray_matter(), 1);
|
|
1718761
1718903
|
async function defaultMarkdownLoader2(filepath) {
|
|
1718762
|
-
const { content: content5 } = (0, import_gray_matter9.default)(await (0,
|
|
1718904
|
+
const { content: content5 } = (0, import_gray_matter9.default)(await (0, import_promises101.readFile)(filepath));
|
|
1718763
1718905
|
return content5;
|
|
1718764
1718906
|
}
|
|
1718765
1718907
|
function extractAttributes2(markdownTag) {
|
|
@@ -1718976,7 +1719118,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
1718976
1719118
|
navAffectingChange = true;
|
|
1718977
1719119
|
continue;
|
|
1718978
1719120
|
}
|
|
1718979
|
-
const markdown = (await (0,
|
|
1719121
|
+
const markdown = (await (0, import_promises102.readFile)(absoluteFilePath)).toString();
|
|
1718980
1719122
|
const isNewFile = previousValue == null;
|
|
1718981
1719123
|
if (isNewFile) {
|
|
1718982
1719124
|
navAffectingChange = true;
|
|
@@ -1719381,7 +1719523,7 @@ var SnippetDependencyTracker = class {
|
|
|
1719381
1719523
|
const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
|
|
1719382
1719524
|
for (const markdownFile of markdownFiles) {
|
|
1719383
1719525
|
try {
|
|
1719384
|
-
const content5 = await (0,
|
|
1719526
|
+
const content5 = await (0, import_promises103.readFile)(markdownFile, "utf-8");
|
|
1719385
1719527
|
const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
|
|
1719386
1719528
|
this.pageToSnippets.set(markdownFile, referencedFiles);
|
|
1719387
1719529
|
for (const referencedFile of referencedFiles) {
|
|
@@ -1719463,7 +1719605,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
1719463
1719605
|
const appPreviewFolder = getPathToPreviewFolder({ app: true });
|
|
1719464
1719606
|
if (await doesPathExist(appPreviewFolder)) {
|
|
1719465
1719607
|
context2.logger.info("Force download requested. Deleting cached bundle...");
|
|
1719466
|
-
await (0,
|
|
1719608
|
+
await (0, import_promises103.rm)(appPreviewFolder, { recursive: true });
|
|
1719467
1719609
|
}
|
|
1719468
1719610
|
}
|
|
1719469
1719611
|
if (bundlePath != null) {
|
|
@@ -1721976,7 +1722118,7 @@ async function validateVersionConfigFileSchema({ value }) {
|
|
|
1721976
1722118
|
}
|
|
1721977
1722119
|
|
|
1721978
1722120
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileYamlAst.js
|
|
1721979
|
-
var
|
|
1722121
|
+
var import_promises105 = require("fs/promises");
|
|
1721980
1722122
|
|
|
1721981
1722123
|
// ../yaml/docs-validator/lib/docsAst/products-yml.schema.json
|
|
1721982
1722124
|
var products_yml_schema_exports = {};
|
|
@@ -1723844,7 +1723986,7 @@ async function visitFilepath({ absoluteFilepathToConfiguration, rawUnresolvedFil
|
|
|
1723844
1723986
|
}
|
|
1723845
1723987
|
|
|
1723846
1723988
|
// ../yaml/docs-validator/lib/docsAst/visitNavigationAst.js
|
|
1723847
|
-
var
|
|
1723989
|
+
var import_promises104 = require("fs/promises");
|
|
1723848
1723990
|
|
|
1723849
1723991
|
// ../yaml/docs-validator/lib/utils/asyncPool.js
|
|
1723850
1723992
|
async function asyncPool2(limit, items, fn4) {
|
|
@@ -1723996,13 +1724138,13 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1723996
1724138
|
if (markdownPath != null) {
|
|
1723997
1724139
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), markdownPath);
|
|
1723998
1724140
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1723999
|
-
const fileStats = await (0,
|
|
1724141
|
+
const fileStats = await (0, import_promises104.stat)(absoluteFilepath);
|
|
1724000
1724142
|
const fileSizeMB = fileStats.size / (1024 * 1024);
|
|
1724001
1724143
|
if (fileSizeMB > 1) {
|
|
1724002
1724144
|
context2.logger.trace(`Processing large markdown file: ${markdownPath} (${fileSizeMB.toFixed(2)} MB)`);
|
|
1724003
1724145
|
}
|
|
1724004
1724146
|
const startTime = performance.now();
|
|
1724005
|
-
const content5 = (await (0,
|
|
1724147
|
+
const content5 = (await (0, import_promises104.readFile)(absoluteFilepath, "utf8")).toString();
|
|
1724006
1724148
|
const readTime = performance.now() - startTime;
|
|
1724007
1724149
|
if (readTime > 2e3) {
|
|
1724008
1724150
|
context2.logger.debug(`Slow file read: ${markdownPath} took ${readTime.toFixed(0)}ms`);
|
|
@@ -1724050,12 +1724192,12 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1724050
1724192
|
context2.logger.trace(`Starting changelog processing for directory: ${changelogDir}`);
|
|
1724051
1724193
|
if (await doesPathExist(changelogDir)) {
|
|
1724052
1724194
|
const startTime = performance.now();
|
|
1724053
|
-
const files = await (0,
|
|
1724195
|
+
const files = await (0, import_promises104.readdir)(changelogDir);
|
|
1724054
1724196
|
const markdownFiles = files.filter((file4) => file4.endsWith(".md") || file4.endsWith(".mdx"));
|
|
1724055
1724197
|
context2.logger.debug(`Processing ${markdownFiles.length} changelog files in ${changelogDir}`);
|
|
1724056
1724198
|
await asyncPool2(VALIDATION_CONCURRENCY, markdownFiles, async (file4) => {
|
|
1724057
1724199
|
const absoluteFilepath = resolve5(changelogDir, file4);
|
|
1724058
|
-
const content5 = (await (0,
|
|
1724200
|
+
const content5 = (await (0, import_promises104.readFile)(absoluteFilepath, "utf8")).toString();
|
|
1724059
1724201
|
context2.logger.trace(`Validating changelog file: ${file4}`);
|
|
1724060
1724202
|
await visitor.markdownPage?.({
|
|
1724061
1724203
|
title: file4,
|
|
@@ -1724290,7 +1724432,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
1724290
1724432
|
willBeUploaded: false
|
|
1724291
1724433
|
});
|
|
1724292
1724434
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), product.path);
|
|
1724293
|
-
const content5 = jsYaml.load((await (0,
|
|
1724435
|
+
const content5 = jsYaml.load((await (0, import_promises105.readFile)(absoluteFilepath)).toString());
|
|
1724294
1724436
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1724295
1724437
|
await visitor.productFile?.({
|
|
1724296
1724438
|
path: product.path,
|
|
@@ -1724368,7 +1724510,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
1724368
1724510
|
willBeUploaded: false
|
|
1724369
1724511
|
});
|
|
1724370
1724512
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), version7.path);
|
|
1724371
|
-
const content5 = jsYaml.load((await (0,
|
|
1724513
|
+
const content5 = jsYaml.load((await (0, import_promises105.readFile)(absoluteFilepath)).toString());
|
|
1724372
1724514
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1724373
1724515
|
await visitor.versionFile?.({
|
|
1724374
1724516
|
path: version7.path,
|
|
@@ -1724803,7 +1724945,7 @@ var import_web = require("stream/web");
|
|
|
1724803
1724945
|
var import_node_stream5 = require("stream");
|
|
1724804
1724946
|
|
|
1724805
1724947
|
// ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/index.js
|
|
1724806
|
-
var
|
|
1724948
|
+
var import_promises107 = require("fs/promises");
|
|
1724807
1724949
|
|
|
1724808
1724950
|
// ../../../node_modules/.pnpm/peek-readable@5.4.2/node_modules/peek-readable/lib/EndOfStreamError.js
|
|
1724809
1724951
|
var defaultMessages = "End-Of-Stream";
|
|
@@ -1725174,14 +1725316,14 @@ function fromBuffer(uint8Array, options2) {
|
|
|
1725174
1725316
|
}
|
|
1725175
1725317
|
|
|
1725176
1725318
|
// ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/FileTokenizer.js
|
|
1725177
|
-
var
|
|
1725319
|
+
var import_promises106 = require("fs/promises");
|
|
1725178
1725320
|
var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
|
|
1725179
1725321
|
/**
|
|
1725180
1725322
|
* Create tokenizer from provided file path
|
|
1725181
1725323
|
* @param sourceFilePath File path
|
|
1725182
1725324
|
*/
|
|
1725183
1725325
|
static async fromFile(sourceFilePath) {
|
|
1725184
|
-
const fileHandle = await (0,
|
|
1725326
|
+
const fileHandle = await (0, import_promises106.open)(sourceFilePath, "r");
|
|
1725185
1725327
|
const stat3 = await fileHandle.stat();
|
|
1725186
1725328
|
return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat3.size } });
|
|
1725187
1725329
|
}
|
|
@@ -1727189,7 +1727331,7 @@ var supportedExtensions = new Set(extensions);
|
|
|
1727189
1727331
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
1727190
1727332
|
|
|
1727191
1727333
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
1727192
|
-
var
|
|
1727334
|
+
var import_promises108 = require("fs/promises");
|
|
1727193
1727335
|
var import_path60 = __toESM(require("path"), 1);
|
|
1727194
1727336
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
1727195
1727337
|
// image files
|
|
@@ -1727310,7 +1727452,7 @@ var ValidFileTypes = {
|
|
|
1727310
1727452
|
}
|
|
1727311
1727453
|
};
|
|
1727312
1727454
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
1727313
|
-
const file4 = new Uint8Array(await (0,
|
|
1727455
|
+
const file4 = new Uint8Array(await (0, import_promises108.readFile)(absoluteFilepath));
|
|
1727314
1727456
|
const fileType = await fileTypeFromBuffer(file4);
|
|
1727315
1727457
|
if (fileType != null) {
|
|
1727316
1727458
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -1727349,7 +1727491,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
|
|
|
1727349
1727491
|
};
|
|
1727350
1727492
|
|
|
1727351
1727493
|
// ../yaml/docs-validator/lib/rules/valid-frontmatter/valid-frontmatter.js
|
|
1727352
|
-
var
|
|
1727494
|
+
var import_promises109 = require("fs/promises");
|
|
1727353
1727495
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
1727354
1727496
|
var ValidFrontmatter = {
|
|
1727355
1727497
|
name: "valid-frontmatter",
|
|
@@ -1727360,7 +1727502,7 @@ var ValidFrontmatter = {
|
|
|
1727360
1727502
|
return [];
|
|
1727361
1727503
|
}
|
|
1727362
1727504
|
try {
|
|
1727363
|
-
const fileContents = await (0,
|
|
1727505
|
+
const fileContents = await (0, import_promises109.readFile)(absoluteFilepath, "utf-8");
|
|
1727364
1727506
|
(0, import_gray_matter11.default)(fileContents);
|
|
1727365
1727507
|
return [];
|
|
1727366
1727508
|
} catch (error49) {
|
|
@@ -1732238,7 +1732380,7 @@ async function parseMarkdown({ markdown, absoluteFilepath, absolutePathToFernFol
|
|
|
1732238
1732380
|
}
|
|
1732239
1732381
|
|
|
1732240
1732382
|
// ../yaml/docs-validator/lib/rules/valid-markdown-file-reference/valid-markdown-file-reference.js
|
|
1732241
|
-
var
|
|
1732383
|
+
var import_promises110 = require("fs/promises");
|
|
1732242
1732384
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
1732243
1732385
|
var ValidMarkdownFileReferences = {
|
|
1732244
1732386
|
name: "valid-markdown-file-references",
|
|
@@ -1732249,7 +1732391,7 @@ var ValidMarkdownFileReferences = {
|
|
|
1732249
1732391
|
return [];
|
|
1732250
1732392
|
}
|
|
1732251
1732393
|
try {
|
|
1732252
|
-
const fileContents = await (0,
|
|
1732394
|
+
const fileContents = await (0, import_promises110.readFile)(absoluteFilepath, "utf-8");
|
|
1732253
1732395
|
const { content: content5 } = (0, import_gray_matter12.default)(fileContents, {});
|
|
1732254
1732396
|
const tree = parseMarkdownToTree(content5);
|
|
1732255
1732397
|
const errors4 = [];
|
|
@@ -1732927,7 +1733069,7 @@ var MDX_NODE_TYPES = [
|
|
|
1732927
1733069
|
"mdxTextExpression",
|
|
1732928
1733070
|
"mdxjsEsm"
|
|
1732929
1733071
|
];
|
|
1732930
|
-
function collectLinksAndSources({ readFile:
|
|
1733072
|
+
function collectLinksAndSources({ readFile: readFile93 = (path86) => (0, import_node_fs27.readFileSync)(path86, "utf-8"), ...opts }) {
|
|
1732931
1733073
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
1732932
1733074
|
const contentQueue = [opts];
|
|
1732933
1733075
|
const links = [];
|
|
@@ -1732965,7 +1733107,7 @@ function collectLinksAndSources({ readFile: readFile92 = (path86) => (0, import_
|
|
|
1732965
1733107
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), importPath);
|
|
1732966
1733108
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
1732967
1733109
|
contentQueue.push({
|
|
1732968
|
-
content:
|
|
1733110
|
+
content: readFile93(resolvedImportPath),
|
|
1732969
1733111
|
absoluteFilepath: resolvedImportPath
|
|
1732970
1733112
|
});
|
|
1732971
1733113
|
}
|
|
@@ -1733008,7 +1733150,7 @@ function collectLinksAndSources({ readFile: readFile92 = (path86) => (0, import_
|
|
|
1733008
1733150
|
if (absoluteFilepath && typeof src === "string") {
|
|
1733009
1733151
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), src);
|
|
1733010
1733152
|
contentQueue.push({
|
|
1733011
|
-
content:
|
|
1733153
|
+
content: readFile93(resolvedImportPath),
|
|
1733012
1733154
|
absoluteFilepath: resolvedImportPath
|
|
1733013
1733155
|
});
|
|
1733014
1733156
|
}
|
|
@@ -1733392,7 +1733534,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
|
|
|
1733392
1733534
|
}
|
|
1733393
1733535
|
|
|
1733394
1733536
|
// ../yaml/docs-validator/lib/rules/no-non-component-refs/no-non-component-refs.js
|
|
1733395
|
-
var
|
|
1733537
|
+
var import_promises111 = require("fs/promises");
|
|
1733396
1733538
|
var NoNonComponentRefsRule = {
|
|
1733397
1733539
|
name: "no-non-component-refs",
|
|
1733398
1733540
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1733406,7 +1733548,7 @@ var NoNonComponentRefsRule = {
|
|
|
1733406
1733548
|
if (!processedFiles.has(spec.absoluteFilepath)) {
|
|
1733407
1733549
|
processedFiles.add(spec.absoluteFilepath);
|
|
1733408
1733550
|
try {
|
|
1733409
|
-
const contents = (await (0,
|
|
1733551
|
+
const contents = (await (0, import_promises111.readFile)(spec.absoluteFilepath)).toString();
|
|
1733410
1733552
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1733411
1733553
|
const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
1733412
1733554
|
if (isOpenApiV2) {
|
|
@@ -1733446,7 +1733588,7 @@ var NoNonComponentRefsRule = {
|
|
|
1733446
1733588
|
};
|
|
1733447
1733589
|
|
|
1733448
1733590
|
// ../yaml/docs-validator/lib/rules/no-openapi-v2-in-docs/no-openapi-v2-in-docs.js
|
|
1733449
|
-
var
|
|
1733591
|
+
var import_promises112 = require("fs/promises");
|
|
1733450
1733592
|
var NoOpenApiV2InDocsRule = {
|
|
1733451
1733593
|
name: "no-openapi-v2-in-docs",
|
|
1733452
1733594
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1733459,7 +1733601,7 @@ var NoOpenApiV2InDocsRule = {
|
|
|
1733459
1733601
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
1733460
1733602
|
processedFiles.add(spec.absoluteFilepath);
|
|
1733461
1733603
|
try {
|
|
1733462
|
-
const contents = (await (0,
|
|
1733604
|
+
const contents = (await (0, import_promises112.readFile)(spec.absoluteFilepath)).toString();
|
|
1733463
1733605
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1733464
1733606
|
if (contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"))) {
|
|
1733465
1733607
|
violations.push({
|
|
@@ -1733582,7 +1733724,7 @@ var ValidInstanceUrlRule = {
|
|
|
1733582
1733724
|
};
|
|
1733583
1733725
|
|
|
1733584
1733726
|
// ../yaml/docs-validator/lib/rules/valid-local-references/valid-local-references.js
|
|
1733585
|
-
var
|
|
1733727
|
+
var import_promises113 = require("fs/promises");
|
|
1733586
1733728
|
function validateReference(ref2, spec) {
|
|
1733587
1733729
|
const pathParts = ref2.replace(/^#\//, "").split("/").map((part) => (
|
|
1733588
1733730
|
// Decode JSON Pointer escapes: ~1 -> /, ~0 -> ~
|
|
@@ -1733649,7 +1733791,7 @@ var ValidLocalReferencesRule = {
|
|
|
1733649
1733791
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
1733650
1733792
|
processedFiles.add(spec.absoluteFilepath);
|
|
1733651
1733793
|
try {
|
|
1733652
|
-
const contents = (await (0,
|
|
1733794
|
+
const contents = (await (0, import_promises113.readFile)(spec.absoluteFilepath)).toString();
|
|
1733653
1733795
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1733654
1733796
|
const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
1733655
1733797
|
if (isOpenApiV2) {
|
|
@@ -1733702,7 +1733844,7 @@ var ValidLocalReferencesRule = {
|
|
|
1733702
1733844
|
};
|
|
1733703
1733845
|
|
|
1733704
1733846
|
// ../yaml/docs-validator/lib/rules/valid-openapi-examples/valid-openapi-examples.js
|
|
1733705
|
-
var
|
|
1733847
|
+
var import_promises114 = require("fs/promises");
|
|
1733706
1733848
|
var ValidOpenApiExamples = {
|
|
1733707
1733849
|
name: "valid-openapi-examples",
|
|
1733708
1733850
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1733800,7 +1733942,7 @@ var ValidOpenApiExamples = {
|
|
|
1733800
1733942
|
};
|
|
1733801
1733943
|
async function validateOpenApiExamples({ specPath, logger }) {
|
|
1733802
1733944
|
try {
|
|
1733803
|
-
const specContent = await (0,
|
|
1733945
|
+
const specContent = await (0, import_promises114.readFile)(specPath, "utf-8");
|
|
1733804
1733946
|
let spec;
|
|
1733805
1733947
|
try {
|
|
1733806
1733948
|
spec = JSON.parse(specContent);
|
|
@@ -1734390,7 +1734532,7 @@ async function previewDocsWorkspace({
|
|
|
1734390
1734532
|
}
|
|
1734391
1734533
|
|
|
1734392
1734534
|
// src/commands/docs-diff/docsDiff.ts
|
|
1734393
|
-
var
|
|
1734535
|
+
var import_promises115 = require("fs/promises");
|
|
1734394
1734536
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
1734395
1734537
|
async function getSlugForFiles({
|
|
1734396
1734538
|
previewUrl,
|
|
@@ -1734610,8 +1734752,8 @@ async function generateComparisons({
|
|
|
1734610
1734752
|
afterPath,
|
|
1734611
1734753
|
comparisonBasePath
|
|
1734612
1734754
|
}) {
|
|
1734613
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
1734614
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
1734755
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises115.readFile)(beforePath));
|
|
1734756
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises115.readFile)(afterPath));
|
|
1734615
1734757
|
const beforeOriginalHeight = beforePng.height;
|
|
1734616
1734758
|
const afterOriginalHeight = afterPng.height;
|
|
1734617
1734759
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -1734649,7 +1734791,7 @@ async function generateComparisons({
|
|
|
1734649
1734791
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
1734650
1734792
|
const outPath = `${base4}-region-${i11 + 1}.png`;
|
|
1734651
1734793
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
1734652
|
-
await (0,
|
|
1734794
|
+
await (0, import_promises115.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
1734653
1734795
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
1734654
1734796
|
}
|
|
1734655
1734797
|
return results;
|
|
@@ -1734724,7 +1734866,7 @@ async function docsDiff({
|
|
|
1734724
1734866
|
outputDir.startsWith("/") ? outputDir : join4(cwd(), RelativeFilePath2.of(outputDir))
|
|
1734725
1734867
|
);
|
|
1734726
1734868
|
if (!await doesPathExist(outputPath)) {
|
|
1734727
|
-
await (0,
|
|
1734869
|
+
await (0, import_promises115.mkdir)(outputPath, { recursive: true });
|
|
1734728
1734870
|
}
|
|
1734729
1734871
|
const results = [];
|
|
1734730
1734872
|
await cliContext.runTask(async (context2) => {
|
|
@@ -1734917,7 +1735059,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
1734917
1735059
|
}
|
|
1734918
1735060
|
|
|
1734919
1735061
|
// src/commands/downgrade/downgrade.ts
|
|
1734920
|
-
var
|
|
1735062
|
+
var import_promises116 = require("fs/promises");
|
|
1734921
1735063
|
|
|
1734922
1735064
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
1734923
1735065
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -1735664,12 +1735806,12 @@ async function downgrade({
|
|
|
1735664
1735806
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
1735665
1735807
|
draft.version = targetVersion;
|
|
1735666
1735808
|
});
|
|
1735667
|
-
await (0,
|
|
1735809
|
+
await (0, import_promises116.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
1735668
1735810
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
1735669
1735811
|
}
|
|
1735670
1735812
|
|
|
1735671
1735813
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
1735672
|
-
var
|
|
1735814
|
+
var import_promises117 = require("fs/promises");
|
|
1735673
1735815
|
|
|
1735674
1735816
|
// src/commands/export/converters/servicesConverter.ts
|
|
1735675
1735817
|
var import_openapi_types3 = __toESM(require_dist9(), 1);
|
|
@@ -1736922,8 +1737064,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
1736922
1737064
|
ir: ir14,
|
|
1736923
1737065
|
mode: "openapi"
|
|
1736924
1737066
|
});
|
|
1736925
|
-
await (0,
|
|
1736926
|
-
await (0,
|
|
1737067
|
+
await (0, import_promises117.mkdir)(dirname4(outputPath), { recursive: true });
|
|
1737068
|
+
await (0, import_promises117.writeFile)(
|
|
1736927
1737069
|
outputPath,
|
|
1736928
1737070
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
1736929
1737071
|
);
|
|
@@ -1736962,10 +1737104,10 @@ var APPROVED_DIRECTORIES_FILENAME = "approved-output-directories";
|
|
|
1736962
1737104
|
var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
1736963
1737105
|
|
|
1736964
1737106
|
// src/commands/generate/checkOutputDirectory.ts
|
|
1736965
|
-
var
|
|
1737107
|
+
var import_promises120 = require("fs/promises");
|
|
1736966
1737108
|
|
|
1736967
1737109
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
1736968
|
-
var
|
|
1737110
|
+
var import_promises118 = require("fs/promises");
|
|
1736969
1737111
|
|
|
1736970
1737112
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
1736971
1737113
|
var import_os10 = require("os");
|
|
@@ -1736984,17 +1737126,17 @@ async function getOutputDirectories() {
|
|
|
1736984
1737126
|
if (!doesOutputDirectoriesFileExist) {
|
|
1736985
1737127
|
return [];
|
|
1736986
1737128
|
}
|
|
1736987
|
-
const outputDirectoriesFileContents = await (0,
|
|
1737129
|
+
const outputDirectoriesFileContents = await (0, import_promises118.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
1736988
1737130
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
1736989
1737131
|
return outputDirectories;
|
|
1736990
1737132
|
}
|
|
1736991
1737133
|
|
|
1736992
1737134
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
1736993
|
-
var
|
|
1737135
|
+
var import_promises119 = require("fs/promises");
|
|
1736994
1737136
|
var import_path62 = __toESM(require("path"), 1);
|
|
1736995
1737137
|
async function storeOutputDirectories(outputDirectories) {
|
|
1736996
|
-
await (0,
|
|
1736997
|
-
await (0,
|
|
1737138
|
+
await (0, import_promises119.mkdir)(import_path62.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
1737139
|
+
await (0, import_promises119.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
1736998
1737140
|
}
|
|
1736999
1737141
|
|
|
1737000
1737142
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -1737016,7 +1737158,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
1737016
1737158
|
shouldProceed: true
|
|
1737017
1737159
|
};
|
|
1737018
1737160
|
}
|
|
1737019
|
-
const files = await (0,
|
|
1737161
|
+
const files = await (0, import_promises120.readdir)(outputPath);
|
|
1737020
1737162
|
if (files.length === 0) {
|
|
1737021
1737163
|
return {
|
|
1737022
1737164
|
shouldProceed: true
|
|
@@ -1737355,7 +1737497,8 @@ async function generateWorkspace({
|
|
|
1737355
1737497
|
await validateAPIWorkspaceAndLogIssues({
|
|
1737356
1737498
|
workspace: await workspace.toFernWorkspace({ context: context2 }),
|
|
1737357
1737499
|
context: context2,
|
|
1737358
|
-
logWarnings: false
|
|
1737500
|
+
logWarnings: false,
|
|
1737501
|
+
ossWorkspace: workspace instanceof OSSWorkspace ? workspace : void 0
|
|
1737359
1737502
|
});
|
|
1737360
1737503
|
await Promise.all(
|
|
1737361
1737504
|
resolvedGroupNames.map(async (resolvedGroupName) => {
|
|
@@ -1738009,7 +1738152,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1738009
1738152
|
}
|
|
1738010
1738153
|
|
|
1738011
1738154
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
1738012
|
-
var
|
|
1738155
|
+
var import_promises121 = require("fs/promises");
|
|
1738013
1738156
|
async function compareOpenAPISpecs({
|
|
1738014
1738157
|
originalPath,
|
|
1738015
1738158
|
modifiedPath,
|
|
@@ -1738046,12 +1738189,12 @@ async function compareOpenAPISpecs({
|
|
|
1738046
1738189
|
}
|
|
1738047
1738190
|
outputPath = join4(dirname4(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
1738048
1738191
|
}
|
|
1738049
|
-
await (0,
|
|
1738192
|
+
await (0, import_promises121.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
1738050
1738193
|
context2.logger.info(`Overrides written to ${outputPath}`);
|
|
1738051
1738194
|
});
|
|
1738052
1738195
|
}
|
|
1738053
1738196
|
async function loadSpec(filepath, context2) {
|
|
1738054
|
-
const contents = await (0,
|
|
1738197
|
+
const contents = await (0, import_promises121.readFile)(filepath, "utf8");
|
|
1738055
1738198
|
try {
|
|
1738056
1738199
|
return JSON.parse(contents);
|
|
1738057
1738200
|
} catch {
|
|
@@ -1738152,7 +1738295,7 @@ function deepEqual(a10, b18) {
|
|
|
1738152
1738295
|
}
|
|
1738153
1738296
|
|
|
1738154
1738297
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
1738155
|
-
var
|
|
1738298
|
+
var import_promises122 = require("fs/promises");
|
|
1738156
1738299
|
async function writeOverridesForWorkspaces({
|
|
1738157
1738300
|
project,
|
|
1738158
1738301
|
includeModels,
|
|
@@ -1738177,7 +1738320,7 @@ async function writeOverridesForWorkspaces({
|
|
|
1738177
1738320
|
async function readExistingOverrides(overridesFilepath, context2) {
|
|
1738178
1738321
|
let parsedOverrides = null;
|
|
1738179
1738322
|
try {
|
|
1738180
|
-
const contents = (await (0,
|
|
1738323
|
+
const contents = (await (0, import_promises122.readFile)(overridesFilepath, "utf8")).toString();
|
|
1738181
1738324
|
try {
|
|
1738182
1738325
|
parsedOverrides = JSON.parse(contents);
|
|
1738183
1738326
|
} catch (err) {
|
|
@@ -1738241,7 +1738384,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
1738241
1738384
|
overridesFilename = `${nameWithoutExt}-overrides${extension3}`;
|
|
1738242
1738385
|
}
|
|
1738243
1738386
|
}
|
|
1738244
|
-
await (0,
|
|
1738387
|
+
await (0, import_promises122.writeFile)(
|
|
1738245
1738388
|
join4(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
1738246
1738389
|
jsYaml.dump({ paths, components })
|
|
1738247
1738390
|
);
|
|
@@ -1738606,7 +1738749,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
1738606
1738749
|
}
|
|
1738607
1738750
|
|
|
1738608
1738751
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
1738609
|
-
var
|
|
1738752
|
+
var import_promises123 = require("fs/promises");
|
|
1738610
1738753
|
async function generateJsonschemaForWorkspaces({
|
|
1738611
1738754
|
typeLocator,
|
|
1738612
1738755
|
project,
|
|
@@ -1738654,9 +1738797,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
1738654
1738797
|
context: context2
|
|
1738655
1738798
|
});
|
|
1738656
1738799
|
if (!await doesPathExist(dirname4(jsonschemaFilepath))) {
|
|
1738657
|
-
await (0,
|
|
1738800
|
+
await (0, import_promises123.mkdir)(dirname4(jsonschemaFilepath), { recursive: true });
|
|
1738658
1738801
|
}
|
|
1738659
|
-
await (0,
|
|
1738802
|
+
await (0, import_promises123.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
1738660
1738803
|
context2.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
1738661
1738804
|
});
|
|
1738662
1738805
|
})
|
|
@@ -1739013,7 +1739156,7 @@ async function mockServer({
|
|
|
1739013
1739156
|
|
|
1739014
1739157
|
// src/commands/register/registerWorkspacesV1.ts
|
|
1739015
1739158
|
var import_fiddle_sdk8 = __toESM(require_fiddle_sdk(), 1);
|
|
1739016
|
-
var
|
|
1739159
|
+
var import_promises124 = require("fs/promises");
|
|
1739017
1739160
|
var import_path68 = __toESM(require("path"), 1);
|
|
1739018
1739161
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
1739019
1739162
|
async function registerWorkspacesV1({
|
|
@@ -1739062,7 +1739205,7 @@ async function registerWorkspacesV1({
|
|
|
1739062
1739205
|
context2.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
1739063
1739206
|
await create2({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
1739064
1739207
|
context2.logger.info("Uploading definition...");
|
|
1739065
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
1739208
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises124.readFile)(tarPath));
|
|
1739066
1739209
|
context2.logger.info(
|
|
1739067
1739210
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
1739068
1739211
|
);
|
|
@@ -1739204,7 +1739347,7 @@ async function generateDiff({
|
|
|
1739204
1739347
|
}
|
|
1739205
1739348
|
|
|
1739206
1739349
|
// src/commands/self-update/selfUpdate.ts
|
|
1739207
|
-
var
|
|
1739350
|
+
var import_promises125 = require("fs/promises");
|
|
1739208
1739351
|
var import_path69 = require("path");
|
|
1739209
1739352
|
async function getPackageManagerBinDir(logger, pm) {
|
|
1739210
1739353
|
let command3;
|
|
@@ -1739250,7 +1739393,7 @@ async function detectInstallationMethod(logger) {
|
|
|
1739250
1739393
|
logger.debug(`Found fern at: ${fernPath}`);
|
|
1739251
1739394
|
let resolvedPath;
|
|
1739252
1739395
|
try {
|
|
1739253
|
-
resolvedPath = await (0,
|
|
1739396
|
+
resolvedPath = await (0, import_promises125.realpath)(fernPath);
|
|
1739254
1739397
|
logger.debug(`Resolved to: ${resolvedPath}`);
|
|
1739255
1739398
|
} catch (error49) {
|
|
1739256
1739399
|
logger.debug(`Failed to resolve symlink: ${error49}`);
|
|
@@ -1739531,21 +1739674,21 @@ async function generateToken({
|
|
|
1739531
1739674
|
|
|
1739532
1739675
|
// src/commands/upgrade/updateApiSpec.ts
|
|
1739533
1739676
|
var fs32 = __toESM(require("fs"), 1);
|
|
1739534
|
-
var
|
|
1739677
|
+
var import_promises126 = require("fs/promises");
|
|
1739535
1739678
|
init_graphql();
|
|
1739536
1739679
|
var import_stream9 = require("stream");
|
|
1739537
|
-
var
|
|
1739680
|
+
var import_promises127 = require("stream/promises");
|
|
1739538
1739681
|
async function fetchAndWriteFile(url3, path86, logger, indent4) {
|
|
1739539
1739682
|
const resp = await fetch(url3);
|
|
1739540
1739683
|
if (resp.ok && resp.body) {
|
|
1739541
1739684
|
logger.debug("Origin successfully fetched, writing to file");
|
|
1739542
1739685
|
const fileStream = fs32.createWriteStream(path86);
|
|
1739543
|
-
await (0,
|
|
1739544
|
-
const fileContents = await (0,
|
|
1739686
|
+
await (0, import_promises127.finished)(import_stream9.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
1739687
|
+
const fileContents = await (0, import_promises126.readFile)(path86, "utf8");
|
|
1739545
1739688
|
try {
|
|
1739546
|
-
await (0,
|
|
1739689
|
+
await (0, import_promises126.writeFile)(path86, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
1739547
1739690
|
} catch (e6) {
|
|
1739548
|
-
await (0,
|
|
1739691
|
+
await (0, import_promises126.writeFile)(path86, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
1739549
1739692
|
}
|
|
1739550
1739693
|
logger.debug("File written successfully");
|
|
1739551
1739694
|
}
|
|
@@ -1739590,7 +1739733,7 @@ async function fetchGraphQLSchemaFromIntrospection(url3, path86, logger) {
|
|
|
1739590
1739733
|
try {
|
|
1739591
1739734
|
const schema2 = buildClientSchema(result.data);
|
|
1739592
1739735
|
const sdl = printSchema(schema2);
|
|
1739593
|
-
await (0,
|
|
1739736
|
+
await (0, import_promises126.writeFile)(path86, sdl, "utf8");
|
|
1739594
1739737
|
} catch (error49) {
|
|
1739595
1739738
|
throw new Error(`Failed to convert introspection result to SDL: ${error49}`);
|
|
1739596
1739739
|
}
|
|
@@ -1739689,7 +1739832,7 @@ async function processDefinitions({
|
|
|
1739689
1739832
|
}
|
|
1739690
1739833
|
|
|
1739691
1739834
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
1739692
|
-
var
|
|
1739835
|
+
var import_promises128 = require("fs/promises");
|
|
1739693
1739836
|
|
|
1739694
1739837
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
1739695
1739838
|
var FERN_DIRECTORY2 = "fern";
|
|
@@ -1739723,7 +1739866,7 @@ var migration = {
|
|
|
1739723
1739866
|
try {
|
|
1739724
1739867
|
const fileContents = await getFileContents(yamlFilepath);
|
|
1739725
1739868
|
const newContents = addDiscriminantToFile(fileContents);
|
|
1739726
|
-
await (0,
|
|
1739869
|
+
await (0, import_promises128.writeFile)(yamlFilepath, newContents);
|
|
1739727
1739870
|
} catch (error49) {
|
|
1739728
1739871
|
context2.failAndThrow("Failed to migrate " + yamlFilepath, error49);
|
|
1739729
1739872
|
}
|
|
@@ -1739731,7 +1739874,7 @@ var migration = {
|
|
|
1739731
1739874
|
}
|
|
1739732
1739875
|
};
|
|
1739733
1739876
|
async function getFileContents(filepath) {
|
|
1739734
|
-
const buffer = await (0,
|
|
1739877
|
+
const buffer = await (0, import_promises128.readFile)(filepath);
|
|
1739735
1739878
|
return buffer.toString();
|
|
1739736
1739879
|
}
|
|
1739737
1739880
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -1739760,7 +1739903,7 @@ var versionMigrations = {
|
|
|
1739760
1739903
|
var __default = versionMigrations;
|
|
1739761
1739904
|
|
|
1739762
1739905
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
1739763
|
-
var
|
|
1739906
|
+
var import_promises129 = require("fs/promises");
|
|
1739764
1739907
|
var import_yaml6 = __toESM(require_dist2(), 1);
|
|
1739765
1739908
|
|
|
1739766
1739909
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -1739801,7 +1739944,7 @@ var migration2 = {
|
|
|
1739801
1739944
|
}
|
|
1739802
1739945
|
};
|
|
1739803
1739946
|
async function migrateFile(filepath, context2) {
|
|
1739804
|
-
const contents = await (0,
|
|
1739947
|
+
const contents = await (0, import_promises129.readFile)(filepath);
|
|
1739805
1739948
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
1739806
1739949
|
const types4 = parsedDocument.get("types");
|
|
1739807
1739950
|
if (types4 == null) {
|
|
@@ -1739833,7 +1739976,7 @@ async function migrateFile(filepath, context2) {
|
|
|
1739833
1739976
|
}
|
|
1739834
1739977
|
}
|
|
1739835
1739978
|
}
|
|
1739836
|
-
await (0,
|
|
1739979
|
+
await (0, import_promises129.writeFile)(filepath, parsedDocument.toString());
|
|
1739837
1739980
|
}
|
|
1739838
1739981
|
|
|
1739839
1739982
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -1739844,7 +1739987,7 @@ var versionMigrations2 = {
|
|
|
1739844
1739987
|
var __default2 = versionMigrations2;
|
|
1739845
1739988
|
|
|
1739846
1739989
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
1739847
|
-
var
|
|
1739990
|
+
var import_promises130 = require("fs/promises");
|
|
1739848
1739991
|
var import_yaml7 = __toESM(require_dist2(), 1);
|
|
1739849
1739992
|
|
|
1739850
1739993
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -1739885,7 +1740028,7 @@ var migration3 = {
|
|
|
1739885
1740028
|
}
|
|
1739886
1740029
|
};
|
|
1739887
1740030
|
async function migrateGeneratorsYml(filepath, context2) {
|
|
1739888
|
-
const contents = await (0,
|
|
1740031
|
+
const contents = await (0, import_promises130.readFile)(filepath);
|
|
1739889
1740032
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
1739890
1740033
|
const draftGenerators = parsedDocument.get("draft");
|
|
1739891
1740034
|
if (draftGenerators == null) {
|
|
@@ -1739912,7 +1740055,7 @@ async function migrateGeneratorsYml(filepath, context2) {
|
|
|
1739912
1740055
|
draftGenerator.set("output-path", name3.value.includes("openapi") ? "./generated-openapi" : name3.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
1739913
1740056
|
}
|
|
1739914
1740057
|
});
|
|
1739915
|
-
await (0,
|
|
1740058
|
+
await (0, import_promises130.writeFile)(filepath, parsedDocument.toString());
|
|
1739916
1740059
|
}
|
|
1739917
1740060
|
|
|
1739918
1740061
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -1739923,7 +1740066,7 @@ var versionMigrations3 = {
|
|
|
1739923
1740066
|
var __default3 = versionMigrations3;
|
|
1739924
1740067
|
|
|
1739925
1740068
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
1739926
|
-
var
|
|
1740069
|
+
var import_promises131 = require("fs/promises");
|
|
1739927
1740070
|
var import_yaml8 = __toESM(require_dist2(), 1);
|
|
1739928
1740071
|
|
|
1739929
1740072
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -1739964,7 +1740107,7 @@ var migration4 = {
|
|
|
1739964
1740107
|
}
|
|
1739965
1740108
|
};
|
|
1739966
1740109
|
async function migrateFile2(filepath, context2) {
|
|
1739967
|
-
const contents = await (0,
|
|
1740110
|
+
const contents = await (0, import_promises131.readFile)(filepath);
|
|
1739968
1740111
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
1739969
1740112
|
const addType = (typeName, typeDeclaration2) => {
|
|
1739970
1740113
|
const types4 = parsedDocument.get("types");
|
|
@@ -1740008,7 +1740151,7 @@ async function migrateFile2(filepath, context2) {
|
|
|
1740008
1740151
|
}
|
|
1740009
1740152
|
}
|
|
1740010
1740153
|
}
|
|
1740011
|
-
await (0,
|
|
1740154
|
+
await (0, import_promises131.writeFile)(filepath, parsedDocument.toString());
|
|
1740012
1740155
|
}
|
|
1740013
1740156
|
|
|
1740014
1740157
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -1740019,7 +1740162,7 @@ var versionMigrations4 = {
|
|
|
1740019
1740162
|
var __default4 = versionMigrations4;
|
|
1740020
1740163
|
|
|
1740021
1740164
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
1740022
|
-
var
|
|
1740165
|
+
var import_promises132 = require("fs/promises");
|
|
1740023
1740166
|
var import_yaml9 = __toESM(require_dist2(), 1);
|
|
1740024
1740167
|
|
|
1740025
1740168
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -1740060,7 +1740203,7 @@ var migration5 = {
|
|
|
1740060
1740203
|
}
|
|
1740061
1740204
|
};
|
|
1740062
1740205
|
async function migrateGeneratorsYml2(filepath, context2) {
|
|
1740063
|
-
const contents = await (0,
|
|
1740206
|
+
const contents = await (0, import_promises132.readFile)(filepath);
|
|
1740064
1740207
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
1740065
1740208
|
const releaseGenerators = parsedDocument.get("release");
|
|
1740066
1740209
|
if (releaseGenerators == null) {
|
|
@@ -1740098,7 +1740241,7 @@ async function migrateGeneratorsYml2(filepath, context2) {
|
|
|
1740098
1740241
|
}
|
|
1740099
1740242
|
releaseGenerator.delete("outputs");
|
|
1740100
1740243
|
});
|
|
1740101
|
-
await (0,
|
|
1740244
|
+
await (0, import_promises132.writeFile)(filepath, parsedDocument.toString());
|
|
1740102
1740245
|
}
|
|
1740103
1740246
|
|
|
1740104
1740247
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -1740109,7 +1740252,7 @@ var versionMigrations5 = {
|
|
|
1740109
1740252
|
var __default5 = versionMigrations5;
|
|
1740110
1740253
|
|
|
1740111
1740254
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
1740112
|
-
var
|
|
1740255
|
+
var import_promises133 = require("fs/promises");
|
|
1740113
1740256
|
|
|
1740114
1740257
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
1740115
1740258
|
var FERN_DIRECTORY7 = "fern";
|
|
@@ -1740140,9 +1740283,9 @@ var migration6 = {
|
|
|
1740140
1740283
|
run: async ({ context: context2 }) => {
|
|
1740141
1740284
|
const yamlFiles = await getAllYamlFiles4(context2);
|
|
1740142
1740285
|
for (const filepath of yamlFiles) {
|
|
1740143
|
-
const contents = await (0,
|
|
1740286
|
+
const contents = await (0, import_promises133.readFile)(filepath);
|
|
1740144
1740287
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
1740145
|
-
await (0,
|
|
1740288
|
+
await (0, import_promises133.writeFile)(filepath, newContents);
|
|
1740146
1740289
|
}
|
|
1740147
1740290
|
}
|
|
1740148
1740291
|
};
|
|
@@ -1740155,7 +1740298,7 @@ var versionMigrations6 = {
|
|
|
1740155
1740298
|
var __default6 = versionMigrations6;
|
|
1740156
1740299
|
|
|
1740157
1740300
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
1740158
|
-
var
|
|
1740301
|
+
var import_promises134 = require("fs/promises");
|
|
1740159
1740302
|
|
|
1740160
1740303
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
1740161
1740304
|
var FERN_DIRECTORY8 = "fern";
|
|
@@ -1740186,9 +1740329,9 @@ var migration7 = {
|
|
|
1740186
1740329
|
run: async ({ context: context2 }) => {
|
|
1740187
1740330
|
const yamlFiles = await getAllRootApiYamlFiles(context2);
|
|
1740188
1740331
|
for (const filepath of yamlFiles) {
|
|
1740189
|
-
const contents = await (0,
|
|
1740332
|
+
const contents = await (0, import_promises134.readFile)(filepath);
|
|
1740190
1740333
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
1740191
|
-
await (0,
|
|
1740334
|
+
await (0, import_promises134.writeFile)(filepath, newContents);
|
|
1740192
1740335
|
}
|
|
1740193
1740336
|
}
|
|
1740194
1740337
|
};
|
|
@@ -1740201,7 +1740344,7 @@ var versionMigrations7 = {
|
|
|
1740201
1740344
|
var __default7 = versionMigrations7;
|
|
1740202
1740345
|
|
|
1740203
1740346
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
1740204
|
-
var
|
|
1740347
|
+
var import_promises135 = require("fs/promises");
|
|
1740205
1740348
|
|
|
1740206
1740349
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
1740207
1740350
|
var FERN_DIRECTORY9 = "fern";
|
|
@@ -1740308,7 +1740451,7 @@ var migration8 = {
|
|
|
1740308
1740451
|
}
|
|
1740309
1740452
|
};
|
|
1740310
1740453
|
async function migrateGeneratorsYml3(filepath) {
|
|
1740311
|
-
const contentsStr = await (0,
|
|
1740454
|
+
const contentsStr = await (0, import_promises135.readFile)(filepath);
|
|
1740312
1740455
|
const contents = jsYaml.load(contentsStr.toString());
|
|
1740313
1740456
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
1740314
1740457
|
let newGeneratorsConfiguration = {};
|
|
@@ -1740326,7 +1740469,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
1740326
1740469
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
1740327
1740470
|
};
|
|
1740328
1740471
|
}
|
|
1740329
|
-
await (0,
|
|
1740472
|
+
await (0, import_promises135.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
1740330
1740473
|
}
|
|
1740331
1740474
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
1740332
1740475
|
const newSchema = {
|
|
@@ -1740401,7 +1740544,7 @@ var versionMigrations8 = {
|
|
|
1740401
1740544
|
var __default8 = versionMigrations8;
|
|
1740402
1740545
|
|
|
1740403
1740546
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
1740404
|
-
var
|
|
1740547
|
+
var import_promises136 = require("fs/promises");
|
|
1740405
1740548
|
var import_yaml10 = __toESM(require_dist2(), 1);
|
|
1740406
1740549
|
|
|
1740407
1740550
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -1740442,7 +1740585,7 @@ var migration9 = {
|
|
|
1740442
1740585
|
}
|
|
1740443
1740586
|
};
|
|
1740444
1740587
|
async function migrateRootApiFile(filepath) {
|
|
1740445
|
-
const contents = await (0,
|
|
1740588
|
+
const contents = await (0, import_promises136.readFile)(filepath);
|
|
1740446
1740589
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
1740447
1740590
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
1740448
1740591
|
if (errorDiscriminant == null || !import_yaml10.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -1740453,7 +1740596,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
1740453
1740596
|
"property-name": errorDiscriminant.value
|
|
1740454
1740597
|
});
|
|
1740455
1740598
|
parsedDocument.delete("error-discriminant");
|
|
1740456
|
-
await (0,
|
|
1740599
|
+
await (0, import_promises136.writeFile)(filepath, parsedDocument.toString());
|
|
1740457
1740600
|
}
|
|
1740458
1740601
|
|
|
1740459
1740602
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -1740464,7 +1740607,7 @@ var versionMigrations9 = {
|
|
|
1740464
1740607
|
var __default9 = versionMigrations9;
|
|
1740465
1740608
|
|
|
1740466
1740609
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
1740467
|
-
var
|
|
1740610
|
+
var import_promises137 = require("fs/promises");
|
|
1740468
1740611
|
var import_yaml11 = __toESM(require_dist2(), 1);
|
|
1740469
1740612
|
|
|
1740470
1740613
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -1740505,7 +1740648,7 @@ var migration10 = {
|
|
|
1740505
1740648
|
}
|
|
1740506
1740649
|
};
|
|
1740507
1740650
|
async function migrateYamlFile(filepath, context2) {
|
|
1740508
|
-
const contents = await (0,
|
|
1740651
|
+
const contents = await (0, import_promises137.readFile)(filepath);
|
|
1740509
1740652
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1740510
1740653
|
const services = parsedDocument.get("services");
|
|
1740511
1740654
|
if (services == null) {
|
|
@@ -1740545,7 +1740688,7 @@ async function migrateYamlFile(filepath, context2) {
|
|
|
1740545
1740688
|
context2.failWithoutThrowing("Failed to convert endpoint", e6);
|
|
1740546
1740689
|
}
|
|
1740547
1740690
|
}
|
|
1740548
|
-
await (0,
|
|
1740691
|
+
await (0, import_promises137.writeFile)(filepath, parsedDocument.toString());
|
|
1740549
1740692
|
}
|
|
1740550
1740693
|
}
|
|
1740551
1740694
|
function convertEndpoint21({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -1740624,7 +1740767,7 @@ var versionMigrations10 = {
|
|
|
1740624
1740767
|
var __default10 = versionMigrations10;
|
|
1740625
1740768
|
|
|
1740626
1740769
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
1740627
|
-
var
|
|
1740770
|
+
var import_promises138 = require("fs/promises");
|
|
1740628
1740771
|
var import_yaml12 = __toESM(require_dist2(), 1);
|
|
1740629
1740772
|
|
|
1740630
1740773
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -1740665,7 +1740808,7 @@ var migration11 = {
|
|
|
1740665
1740808
|
}
|
|
1740666
1740809
|
};
|
|
1740667
1740810
|
async function migrateYamlFile2(filepath, context2) {
|
|
1740668
|
-
const contents = await (0,
|
|
1740811
|
+
const contents = await (0, import_promises138.readFile)(filepath);
|
|
1740669
1740812
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
1740670
1740813
|
const types4 = parsedDocument.get("types");
|
|
1740671
1740814
|
if (types4 == null) {
|
|
@@ -1740691,7 +1740834,7 @@ async function migrateYamlFile2(filepath, context2) {
|
|
|
1740691
1740834
|
examples.set(i11, { value });
|
|
1740692
1740835
|
}
|
|
1740693
1740836
|
}
|
|
1740694
|
-
await (0,
|
|
1740837
|
+
await (0, import_promises138.writeFile)(filepath, parsedDocument.toString());
|
|
1740695
1740838
|
}
|
|
1740696
1740839
|
|
|
1740697
1740840
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -1740702,7 +1740845,7 @@ var versionMigrations11 = {
|
|
|
1740702
1740845
|
var __default11 = versionMigrations11;
|
|
1740703
1740846
|
|
|
1740704
1740847
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
1740705
|
-
var
|
|
1740848
|
+
var import_promises139 = require("fs/promises");
|
|
1740706
1740849
|
var import_yaml13 = __toESM(require_dist2(), 1);
|
|
1740707
1740850
|
|
|
1740708
1740851
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -1740743,7 +1740886,7 @@ var migration12 = {
|
|
|
1740743
1740886
|
}
|
|
1740744
1740887
|
};
|
|
1740745
1740888
|
async function migrateYamlFile3(filepath, context2) {
|
|
1740746
|
-
const contents = await (0,
|
|
1740889
|
+
const contents = await (0, import_promises139.readFile)(filepath);
|
|
1740747
1740890
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
1740748
1740891
|
if (!import_yaml13.default.isMap(parsedDocument.contents)) {
|
|
1740749
1740892
|
return context2.failAndThrow("File is not a map");
|
|
@@ -1740773,7 +1740916,7 @@ async function migrateYamlFile3(filepath, context2) {
|
|
|
1740773
1740916
|
pair.value = firstService.value;
|
|
1740774
1740917
|
}
|
|
1740775
1740918
|
}
|
|
1740776
|
-
await (0,
|
|
1740919
|
+
await (0, import_promises139.writeFile)(filepath, parsedDocument.toString());
|
|
1740777
1740920
|
}
|
|
1740778
1740921
|
|
|
1740779
1740922
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -1740784,7 +1740927,7 @@ var versionMigrations12 = {
|
|
|
1740784
1740927
|
var __default12 = versionMigrations12;
|
|
1740785
1740928
|
|
|
1740786
1740929
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
1740787
|
-
var
|
|
1740930
|
+
var import_promises140 = require("fs/promises");
|
|
1740788
1740931
|
var import_yaml14 = __toESM(require_dist2(), 1);
|
|
1740789
1740932
|
|
|
1740790
1740933
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -1740825,7 +1740968,7 @@ var migration13 = {
|
|
|
1740825
1740968
|
}
|
|
1740826
1740969
|
};
|
|
1740827
1740970
|
async function migrateYamlFile4(filepath, context2) {
|
|
1740828
|
-
const contents = await (0,
|
|
1740971
|
+
const contents = await (0, import_promises140.readFile)(filepath);
|
|
1740829
1740972
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
1740830
1740973
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
1740831
1740974
|
return context2.failAndThrow("File is not a map");
|
|
@@ -1740844,7 +1740987,7 @@ async function migrateYamlFile4(filepath, context2) {
|
|
|
1740844
1740987
|
}
|
|
1740845
1740988
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
1740846
1740989
|
parsedDocument.contents.items.unshift(docsPair);
|
|
1740847
|
-
await (0,
|
|
1740990
|
+
await (0, import_promises140.writeFile)(filepath, parsedDocument.toString());
|
|
1740848
1740991
|
}
|
|
1740849
1740992
|
|
|
1740850
1740993
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -1740855,7 +1740998,7 @@ var versionMigrations13 = {
|
|
|
1740855
1740998
|
var __default13 = versionMigrations13;
|
|
1740856
1740999
|
|
|
1740857
1741000
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
1740858
|
-
var
|
|
1741001
|
+
var import_promises141 = require("fs/promises");
|
|
1740859
1741002
|
|
|
1740860
1741003
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
1740861
1741004
|
var FERN_DIRECTORY15 = "fern";
|
|
@@ -1740895,14 +1741038,14 @@ var migration14 = {
|
|
|
1740895
1741038
|
}
|
|
1740896
1741039
|
};
|
|
1740897
1741040
|
async function migrateYamlFile5(filepath) {
|
|
1740898
|
-
const contents = await (0,
|
|
1741041
|
+
const contents = await (0, import_promises141.readFile)(filepath);
|
|
1740899
1741042
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
1740900
1741043
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
1740901
1741044
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
1740902
1741045
|
return `docs:
|
|
1740903
1741046
|
domain: "${domain3}.${domainSuffix}"`;
|
|
1740904
1741047
|
});
|
|
1740905
|
-
await (0,
|
|
1741048
|
+
await (0, import_promises141.writeFile)(filepath, updatedSnapshot.toString());
|
|
1740906
1741049
|
}
|
|
1740907
1741050
|
|
|
1740908
1741051
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -1740918,10 +1741061,10 @@ var import_legacy_docs_config = __toESM(require_legacy_docs_config(), 1);
|
|
|
1740918
1741061
|
var LegacyDocsSerializers = __toESM(require_serialization44(), 1);
|
|
1740919
1741062
|
|
|
1740920
1741063
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
1740921
|
-
var
|
|
1741064
|
+
var import_promises142 = require("fs/promises");
|
|
1740922
1741065
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
1740923
1741066
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1740924
|
-
const contentsStr = await (0,
|
|
1741067
|
+
const contentsStr = await (0, import_promises142.readFile)(filepath);
|
|
1740925
1741068
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1740926
1741069
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
1740927
1741070
|
if (result.ok) {
|
|
@@ -1740939,7 +1741082,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
1740939
1741082
|
}
|
|
1740940
1741083
|
|
|
1740941
1741084
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
1740942
|
-
var
|
|
1741085
|
+
var import_promises144 = require("fs/promises");
|
|
1740943
1741086
|
|
|
1740944
1741087
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
1740945
1741088
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -1741117,10 +1741260,10 @@ __export(legacy_exports, {
|
|
|
1741117
1741260
|
});
|
|
1741118
1741261
|
|
|
1741119
1741262
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
1741120
|
-
var
|
|
1741263
|
+
var import_promises143 = require("fs/promises");
|
|
1741121
1741264
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
1741122
1741265
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1741123
|
-
const contentsStr = await (0,
|
|
1741266
|
+
const contentsStr = await (0, import_promises143.readFile)(filepath);
|
|
1741124
1741267
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1741125
1741268
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
1741126
1741269
|
if (result.success) {
|
|
@@ -1741150,7 +1741293,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
1741150
1741293
|
var APIS_DIRECTORY2 = "apis";
|
|
1741151
1741294
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
1741152
1741295
|
const absolutePathToApisDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
1741153
|
-
await (0,
|
|
1741296
|
+
await (0, import_promises144.mkdir)(absolutePathToApisDirectory);
|
|
1741154
1741297
|
for (const workspace of workspaces) {
|
|
1741155
1741298
|
const absolutePathToWorkspace = join4(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
1741156
1741299
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -1741158,11 +1741301,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
1741158
1741301
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
1741159
1741302
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1741160
1741303
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1741161
|
-
await (0,
|
|
1741304
|
+
await (0, import_promises144.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1741162
1741305
|
}
|
|
1741163
1741306
|
const absolutePathToNestedWorkspace = join4(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
1741164
1741307
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1741165
|
-
await (0,
|
|
1741308
|
+
await (0, import_promises144.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1741166
1741309
|
}
|
|
1741167
1741310
|
}
|
|
1741168
1741311
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -1741175,7 +1741318,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
1741175
1741318
|
generatorsConfiguration,
|
|
1741176
1741319
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1741177
1741320
|
});
|
|
1741178
|
-
await (0,
|
|
1741321
|
+
await (0, import_promises144.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1741179
1741322
|
return convertedResponse.docsURLs;
|
|
1741180
1741323
|
}
|
|
1741181
1741324
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -1741189,19 +1741332,19 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
1741189
1741332
|
apiName
|
|
1741190
1741333
|
});
|
|
1741191
1741334
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1741192
|
-
await (0,
|
|
1741335
|
+
await (0, import_promises144.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
1741193
1741336
|
}
|
|
1741194
1741337
|
|
|
1741195
1741338
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
1741196
|
-
var
|
|
1741339
|
+
var import_promises145 = require("fs/promises");
|
|
1741197
1741340
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1741198
1741341
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
1741199
1741342
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
1741200
1741343
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1741201
1741344
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1741202
1741345
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1741203
|
-
await (0,
|
|
1741204
|
-
await (0,
|
|
1741346
|
+
await (0, import_promises145.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1741347
|
+
await (0, import_promises145.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1741205
1741348
|
}
|
|
1741206
1741349
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
1741207
1741350
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1741214,7 +1741357,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
1741214
1741357
|
apiName: void 0
|
|
1741215
1741358
|
});
|
|
1741216
1741359
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1741217
|
-
await (0,
|
|
1741360
|
+
await (0, import_promises145.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
1741218
1741361
|
}
|
|
1741219
1741362
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
1741220
1741363
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1741226,22 +1741369,22 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
1741226
1741369
|
generatorsConfiguration,
|
|
1741227
1741370
|
pathModificationStrategy: "MoveUp"
|
|
1741228
1741371
|
});
|
|
1741229
|
-
await (0,
|
|
1741372
|
+
await (0, import_promises145.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1741230
1741373
|
return convertedResponse.docsURLs;
|
|
1741231
1741374
|
}
|
|
1741232
1741375
|
|
|
1741233
1741376
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
1741234
|
-
var
|
|
1741377
|
+
var import_promises146 = require("fs/promises");
|
|
1741235
1741378
|
var APIS_DIRECTORY3 = "apis";
|
|
1741236
1741379
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
1741237
1741380
|
const absolutePathToApisDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
1741238
|
-
await (0,
|
|
1741381
|
+
await (0, import_promises146.mkdir)(absolutePathToApisDirectory);
|
|
1741239
1741382
|
for (const workspace of workspaces) {
|
|
1741240
1741383
|
const absolutePathToWorkspace = join4(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
1741241
1741384
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
1741242
1741385
|
const absolutePathToNestedWorkspace = join4(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
1741243
1741386
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1741244
|
-
await (0,
|
|
1741387
|
+
await (0, import_promises146.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1741245
1741388
|
}
|
|
1741246
1741389
|
}
|
|
1741247
1741390
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -1741254,15 +1741397,15 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
1741254
1741397
|
generatorsConfiguration,
|
|
1741255
1741398
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1741256
1741399
|
});
|
|
1741257
|
-
await (0,
|
|
1741400
|
+
await (0, import_promises146.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1741258
1741401
|
}
|
|
1741259
1741402
|
|
|
1741260
1741403
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
1741261
|
-
var
|
|
1741404
|
+
var import_promises147 = require("fs/promises");
|
|
1741262
1741405
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1741263
1741406
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
1741264
1741407
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1741265
|
-
await (0,
|
|
1741408
|
+
await (0, import_promises147.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1741266
1741409
|
}
|
|
1741267
1741410
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
1741268
1741411
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1741274,7 +1741417,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
1741274
1741417
|
generatorsConfiguration,
|
|
1741275
1741418
|
pathModificationStrategy: "MoveUp"
|
|
1741276
1741419
|
});
|
|
1741277
|
-
await (0,
|
|
1741420
|
+
await (0, import_promises147.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1741278
1741421
|
}
|
|
1741279
1741422
|
|
|
1741280
1741423
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -1741351,7 +1741494,7 @@ var versionMigrations15 = {
|
|
|
1741351
1741494
|
var __default15 = versionMigrations15;
|
|
1741352
1741495
|
|
|
1741353
1741496
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
1741354
|
-
var
|
|
1741497
|
+
var import_promises148 = require("fs/promises");
|
|
1741355
1741498
|
var import_yaml15 = __toESM(require_dist2(), 1);
|
|
1741356
1741499
|
var migration16 = {
|
|
1741357
1741500
|
name: "require-generators-yml",
|
|
@@ -1741394,7 +1741537,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
1741394
1741537
|
if (existingGeneratorsYml == null) {
|
|
1741395
1741538
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
1741396
1741539
|
const absolutePathToGeneratorsYml = join4(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
1741397
|
-
await (0,
|
|
1741540
|
+
await (0, import_promises148.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
1741398
1741541
|
api: {
|
|
1741399
1741542
|
path: join4(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
1741400
1741543
|
}
|
|
@@ -1741409,7 +1741552,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
1741409
1741552
|
parsedDocument.set("api", {
|
|
1741410
1741553
|
path: join4(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
1741411
1741554
|
});
|
|
1741412
|
-
await (0,
|
|
1741555
|
+
await (0, import_promises148.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
1741413
1741556
|
context2.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
1741414
1741557
|
}
|
|
1741415
1741558
|
}
|
|
@@ -1741436,7 +1741579,7 @@ var versionMigrations16 = {
|
|
|
1741436
1741579
|
var __default16 = versionMigrations16;
|
|
1741437
1741580
|
|
|
1741438
1741581
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
1741439
|
-
var
|
|
1741582
|
+
var import_promises149 = require("fs/promises");
|
|
1741440
1741583
|
var import_yaml16 = __toESM(require_dist2(), 1);
|
|
1741441
1741584
|
var migration17 = {
|
|
1741442
1741585
|
name: "generators-yml-use-api-specs",
|
|
@@ -1741616,7 +1741759,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
1741616
1741759
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
1741617
1741760
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
1741618
1741761
|
}
|
|
1741619
|
-
await (0,
|
|
1741762
|
+
await (0, import_promises149.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1741620
1741763
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1741621
1741764
|
}
|
|
1741622
1741765
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context2, namespace }) {
|
|
@@ -1741663,7 +1741806,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
1741663
1741806
|
}
|
|
1741664
1741807
|
let specContent;
|
|
1741665
1741808
|
try {
|
|
1741666
|
-
const fileContents = await (0,
|
|
1741809
|
+
const fileContents = await (0, import_promises149.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
1741667
1741810
|
specContent = jsYaml.load(fileContents);
|
|
1741668
1741811
|
} catch (e6) {
|
|
1741669
1741812
|
context2.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
|
|
@@ -1741766,7 +1741909,7 @@ var versionMigrations17 = {
|
|
|
1741766
1741909
|
var __default17 = versionMigrations17;
|
|
1741767
1741910
|
|
|
1741768
1741911
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
1741769
|
-
var
|
|
1741912
|
+
var import_promises150 = require("fs/promises");
|
|
1741770
1741913
|
var migration18 = {
|
|
1741771
1741914
|
name: "add-path-parameter-order-setting",
|
|
1741772
1741915
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -1741854,7 +1741997,7 @@ async function updateGeneratorsYml({ context: context2, files }) {
|
|
|
1741854
1741997
|
documentToWrite = `${schemaComment}
|
|
1741855
1741998
|
${documentToWrite}`;
|
|
1741856
1741999
|
}
|
|
1741857
|
-
await (0,
|
|
1742000
|
+
await (0, import_promises150.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1741858
1742001
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1741859
1742002
|
}
|
|
1741860
1742003
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -1741890,7 +1742033,7 @@ var versionMigrations18 = {
|
|
|
1741890
1742033
|
var __default18 = versionMigrations18;
|
|
1741891
1742034
|
|
|
1741892
1742035
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
1741893
|
-
var
|
|
1742036
|
+
var import_promises151 = require("fs/promises");
|
|
1741894
1742037
|
var migration19 = {
|
|
1741895
1742038
|
name: "update-1_0_0-defaults",
|
|
1741896
1742039
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -1742065,7 +1742208,7 @@ async function updateGeneratorsYml2({ context: context2, files }) {
|
|
|
1742065
1742208
|
documentToWrite = `${schemaComment}
|
|
1742066
1742209
|
${documentToWrite}`;
|
|
1742067
1742210
|
}
|
|
1742068
|
-
await (0,
|
|
1742211
|
+
await (0, import_promises151.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1742069
1742212
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1742070
1742213
|
}
|
|
1742071
1742214
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -1742134,7 +1742277,7 @@ var versionMigrations19 = {
|
|
|
1742134
1742277
|
var __default19 = versionMigrations19;
|
|
1742135
1742278
|
|
|
1742136
1742279
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
1742137
|
-
var
|
|
1742280
|
+
var import_promises152 = require("fs/promises");
|
|
1742138
1742281
|
var migration20 = {
|
|
1742139
1742282
|
name: "update-2_0_0-defaults",
|
|
1742140
1742283
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -1742309,7 +1742452,7 @@ async function updateGeneratorsYml3({ context: context2, files }) {
|
|
|
1742309
1742452
|
documentToWrite = `${schemaComment}
|
|
1742310
1742453
|
${documentToWrite}`;
|
|
1742311
1742454
|
}
|
|
1742312
|
-
await (0,
|
|
1742455
|
+
await (0, import_promises152.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1742313
1742456
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1742314
1742457
|
}
|
|
1742315
1742458
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -1742355,7 +1742498,7 @@ var versionMigrations20 = {
|
|
|
1742355
1742498
|
var __default20 = versionMigrations20;
|
|
1742356
1742499
|
|
|
1742357
1742500
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
1742358
|
-
var
|
|
1742501
|
+
var import_promises153 = require("fs/promises");
|
|
1742359
1742502
|
var migration21 = {
|
|
1742360
1742503
|
name: "migrate-deprecated-generator-api-settings",
|
|
1742361
1742504
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -1742446,7 +1742589,7 @@ async function updateGeneratorsYml4({ context: context2, files }) {
|
|
|
1742446
1742589
|
documentToWrite = `${schemaComment}
|
|
1742447
1742590
|
${documentToWrite}`;
|
|
1742448
1742591
|
}
|
|
1742449
|
-
await (0,
|
|
1742592
|
+
await (0, import_promises153.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1742450
1742593
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1742451
1742594
|
}
|
|
1742452
1742595
|
function migrateDeprecatedSettings(settings, context2) {
|
|
@@ -1742492,7 +1742635,7 @@ var versionMigrations21 = {
|
|
|
1742492
1742635
|
var __default21 = versionMigrations21;
|
|
1742493
1742636
|
|
|
1742494
1742637
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
1742495
|
-
var
|
|
1742638
|
+
var import_promises154 = require("fs/promises");
|
|
1742496
1742639
|
var migration22 = {
|
|
1742497
1742640
|
name: "enable-smart-casing",
|
|
1742498
1742641
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -1742576,7 +1742719,7 @@ async function updateGeneratorsYml5({ context: context2, files }) {
|
|
|
1742576
1742719
|
documentToWrite = `${schemaComment}
|
|
1742577
1742720
|
${documentToWrite}`;
|
|
1742578
1742721
|
}
|
|
1742579
|
-
await (0,
|
|
1742722
|
+
await (0, import_promises154.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1742580
1742723
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1742581
1742724
|
}
|
|
1742582
1742725
|
function setSmartCasingFalseIfNotConfigured(generator, context2) {
|
|
@@ -1742717,7 +1742860,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
1742717
1742860
|
}
|
|
1742718
1742861
|
|
|
1742719
1742862
|
// src/commands/upgrade/upgrade.ts
|
|
1742720
|
-
var
|
|
1742863
|
+
var import_promises155 = require("fs/promises");
|
|
1742721
1742864
|
|
|
1742722
1742865
|
// src/cwd.ts
|
|
1742723
1742866
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -1743034,7 +1743177,7 @@ async function upgrade({
|
|
|
1743034
1743177
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
1743035
1743178
|
draft.version = resolvedTargetVersion;
|
|
1743036
1743179
|
});
|
|
1743037
|
-
await (0,
|
|
1743180
|
+
await (0, import_promises155.writeFile)(
|
|
1743038
1743181
|
projectConfig2._absolutePath,
|
|
1743039
1743182
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
1743040
1743183
|
);
|
|
@@ -1743460,7 +1743603,7 @@ async function validateWorkspaces({
|
|
|
1743460
1743603
|
}
|
|
1743461
1743604
|
|
|
1743462
1743605
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
1743463
|
-
var
|
|
1743606
|
+
var import_promises156 = require("fs/promises");
|
|
1743464
1743607
|
var import_path70 = __toESM(require("path"), 1);
|
|
1743465
1743608
|
async function writeDefinitionForWorkspaces({
|
|
1743466
1743609
|
project,
|
|
@@ -1743541,27 +1743684,27 @@ async function writeFernDefinition({
|
|
|
1743541
1743684
|
return a10.localeCompare(b18);
|
|
1743542
1743685
|
};
|
|
1743543
1743686
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
1743544
|
-
await (0,
|
|
1743687
|
+
await (0, import_promises156.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
1743545
1743688
|
}
|
|
1743546
|
-
await (0,
|
|
1743547
|
-
await (0,
|
|
1743689
|
+
await (0, import_promises156.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
1743690
|
+
await (0, import_promises156.writeFile)(
|
|
1743548
1743691
|
join4(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
1743549
1743692
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
1743550
1743693
|
);
|
|
1743551
1743694
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
1743552
1743695
|
const absoluteFilepath = join4(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
1743553
|
-
await (0,
|
|
1743554
|
-
await (0,
|
|
1743696
|
+
await (0, import_promises156.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
1743697
|
+
await (0, import_promises156.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
1743555
1743698
|
}
|
|
1743556
1743699
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
1743557
1743700
|
const absoluteFilepath = join4(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
1743558
|
-
await (0,
|
|
1743559
|
-
await (0,
|
|
1743701
|
+
await (0, import_promises156.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
1743702
|
+
await (0, import_promises156.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
1743560
1743703
|
}
|
|
1743561
1743704
|
}
|
|
1743562
1743705
|
|
|
1743563
1743706
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
1743564
|
-
var
|
|
1743707
|
+
var import_promises157 = require("fs/promises");
|
|
1743565
1743708
|
async function writeDocsDefinitionForProject({
|
|
1743566
1743709
|
project,
|
|
1743567
1743710
|
outputPath,
|
|
@@ -1743593,7 +1743736,7 @@ async function writeDocsDefinitionForProject({
|
|
|
1743593
1743736
|
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
|
|
1743594
1743737
|
});
|
|
1743595
1743738
|
const docsDefinition = await docsResolver.resolve();
|
|
1743596
|
-
await (0,
|
|
1743739
|
+
await (0, import_promises157.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
1743597
1743740
|
context2.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
1743598
1743741
|
});
|
|
1743599
1743742
|
}
|
|
@@ -1743601,7 +1743744,7 @@ async function writeDocsDefinitionForProject({
|
|
|
1743601
1743744
|
// src/commands/write-translation/writeTranslationForProject.ts
|
|
1743602
1743745
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
1743603
1743746
|
var import_fs26 = require("fs");
|
|
1743604
|
-
var
|
|
1743747
|
+
var import_promises161 = require("fs/promises");
|
|
1743605
1743748
|
var import_is_ci2 = __toESM(require_is_ci(), 1);
|
|
1743606
1743749
|
var import_path73 = __toESM(require("path"), 1);
|
|
1743607
1743750
|
|
|
@@ -1744086,7 +1744229,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
1744086
1744229
|
}
|
|
1744087
1744230
|
|
|
1744088
1744231
|
// src/commands/write-translation/docs-config-utils.ts
|
|
1744089
|
-
var
|
|
1744232
|
+
var import_promises158 = require("fs/promises");
|
|
1744090
1744233
|
|
|
1744091
1744234
|
// src/commands/write-translation/url-utils.ts
|
|
1744092
1744235
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -1744243,7 +1744386,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1744243
1744386
|
stub = false
|
|
1744244
1744387
|
}) {
|
|
1744245
1744388
|
try {
|
|
1744246
|
-
const originalConfigContent = await (0,
|
|
1744389
|
+
const originalConfigContent = await (0, import_promises158.readFile)(originalDocsConfigPath, "utf-8");
|
|
1744247
1744390
|
const transformation = {
|
|
1744248
1744391
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
1744249
1744392
|
language,
|
|
@@ -1744257,7 +1744400,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1744257
1744400
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
1744258
1744401
|
sortKeys: false
|
|
1744259
1744402
|
});
|
|
1744260
|
-
await (0,
|
|
1744403
|
+
await (0, import_promises158.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
1744261
1744404
|
context2.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
1744262
1744405
|
} catch (error49) {
|
|
1744263
1744406
|
if (error49 instanceof Error && error49.message.includes("403")) {
|
|
@@ -1744269,11 +1744412,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1744269
1744412
|
|
|
1744270
1744413
|
// src/commands/write-translation/file-collection-utils.ts
|
|
1744271
1744414
|
var import_fs24 = require("fs");
|
|
1744272
|
-
var
|
|
1744415
|
+
var import_promises159 = require("fs/promises");
|
|
1744273
1744416
|
var import_path71 = __toESM(require("path"), 1);
|
|
1744274
1744417
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
1744275
1744418
|
const discoveredFiles = {};
|
|
1744276
|
-
const entries10 = await (0,
|
|
1744419
|
+
const entries10 = await (0, import_promises159.readdir)(baseDirectory);
|
|
1744277
1744420
|
for (const entry of entries10) {
|
|
1744278
1744421
|
if (entry === "translations") {
|
|
1744279
1744422
|
continue;
|
|
@@ -1744296,7 +1744439,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
1744296
1744439
|
// src/commands/write-translation/hash-utils.ts
|
|
1744297
1744440
|
var import_crypto10 = require("crypto");
|
|
1744298
1744441
|
var import_fs25 = require("fs");
|
|
1744299
|
-
var
|
|
1744442
|
+
var import_promises160 = require("fs/promises");
|
|
1744300
1744443
|
var import_path72 = __toESM(require("path"), 1);
|
|
1744301
1744444
|
function calculateContentHash(content5) {
|
|
1744302
1744445
|
return (0, import_crypto10.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -1744307,7 +1744450,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
1744307
1744450
|
return {};
|
|
1744308
1744451
|
}
|
|
1744309
1744452
|
try {
|
|
1744310
|
-
const hashesContent = await (0,
|
|
1744453
|
+
const hashesContent = await (0, import_promises160.readFile)(hashesFilePath, "utf-8");
|
|
1744311
1744454
|
const parsed = JSON.parse(hashesContent);
|
|
1744312
1744455
|
const { _comment, ...hashMappings } = parsed;
|
|
1744313
1744456
|
return hashMappings;
|
|
@@ -1744328,11 +1744471,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
1744328
1744471
|
_comment: "This file is auto-generated by Fern to track source file changes for translation purposes. Do not edit manually - it will be overwritten on the next translation update.",
|
|
1744329
1744472
|
...sortedMappings
|
|
1744330
1744473
|
};
|
|
1744331
|
-
await (0,
|
|
1744474
|
+
await (0, import_promises160.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
1744332
1744475
|
}
|
|
1744333
1744476
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
1744334
1744477
|
try {
|
|
1744335
|
-
const content5 = await (0,
|
|
1744478
|
+
const content5 = await (0, import_promises160.readFile)(filePath, "utf-8");
|
|
1744336
1744479
|
const currentHash = calculateContentHash(content5);
|
|
1744337
1744480
|
const previousHash = previousHashes[relativePath];
|
|
1744338
1744481
|
return currentHash !== previousHash;
|
|
@@ -1744385,7 +1744528,7 @@ async function writeTranslationForProject({
|
|
|
1744385
1744528
|
}
|
|
1744386
1744529
|
if (!(0, import_fs26.existsSync)(translationsDirectory)) {
|
|
1744387
1744530
|
context2.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
1744388
|
-
await (0,
|
|
1744531
|
+
await (0, import_promises161.mkdir)(translationsDirectory, { recursive: true });
|
|
1744389
1744532
|
}
|
|
1744390
1744533
|
const languageStats = {};
|
|
1744391
1744534
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -1744398,7 +1744541,7 @@ async function writeTranslationForProject({
|
|
|
1744398
1744541
|
RelativeFilePath2.of("fern")
|
|
1744399
1744542
|
);
|
|
1744400
1744543
|
if (!(0, import_fs26.existsSync)(languageDirectory)) {
|
|
1744401
|
-
await (0,
|
|
1744544
|
+
await (0, import_promises161.mkdir)(languageDirectory, { recursive: true });
|
|
1744402
1744545
|
}
|
|
1744403
1744546
|
languageStats[language] = {
|
|
1744404
1744547
|
filesProcessed: 0,
|
|
@@ -1744500,7 +1744643,7 @@ async function writeTranslationForProject({
|
|
|
1744500
1744643
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
1744501
1744644
|
);
|
|
1744502
1744645
|
}
|
|
1744503
|
-
const originalConfigContent = await (0,
|
|
1744646
|
+
const originalConfigContent = await (0, import_promises161.readFile)(originalDocsConfigPath, "utf-8");
|
|
1744504
1744647
|
await updateAndSaveHashForFile(
|
|
1744505
1744648
|
translationsDirectory,
|
|
1744506
1744649
|
hashMappings,
|
|
@@ -1744545,7 +1744688,7 @@ async function writeTranslationForProject({
|
|
|
1744545
1744688
|
continue;
|
|
1744546
1744689
|
}
|
|
1744547
1744690
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
1744548
|
-
const originalContent = await (0,
|
|
1744691
|
+
const originalContent = await (0, import_promises161.readFile)(filePath, "utf-8");
|
|
1744549
1744692
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
1744550
1744693
|
const sourceStats = languageStats[sourceLanguage];
|
|
1744551
1744694
|
if (sourceStats) {
|
|
@@ -1744570,7 +1744713,7 @@ async function writeTranslationForProject({
|
|
|
1744570
1744713
|
const destPath = join4(languageDirectory, relativePath);
|
|
1744571
1744714
|
const destDir = import_path73.default.dirname(destPath);
|
|
1744572
1744715
|
if (!(0, import_fs26.existsSync)(destDir)) {
|
|
1744573
|
-
await (0,
|
|
1744716
|
+
await (0, import_promises161.mkdir)(destDir, { recursive: true });
|
|
1744574
1744717
|
}
|
|
1744575
1744718
|
const transformation = {
|
|
1744576
1744719
|
filePath: relativePath,
|
|
@@ -1744583,7 +1744726,7 @@ async function writeTranslationForProject({
|
|
|
1744583
1744726
|
cliContext,
|
|
1744584
1744727
|
stub
|
|
1744585
1744728
|
});
|
|
1744586
|
-
await (0,
|
|
1744729
|
+
await (0, import_promises161.writeFile)(destPath, transformedContent, "utf-8");
|
|
1744587
1744730
|
const languageStatsForLang = languageStats[language];
|
|
1744588
1744731
|
if (languageStatsForLang) {
|
|
1744589
1744732
|
languageStatsForLang.filesProcessed++;
|
|
@@ -1744614,9 +1744757,9 @@ async function writeTranslationForProject({
|
|
|
1744614
1744757
|
const destPath = join4(languageDirectory, relativePath);
|
|
1744615
1744758
|
const destDir = import_path73.default.dirname(destPath);
|
|
1744616
1744759
|
if (!(0, import_fs26.existsSync)(destDir)) {
|
|
1744617
|
-
await (0,
|
|
1744760
|
+
await (0, import_promises161.mkdir)(destDir, { recursive: true });
|
|
1744618
1744761
|
}
|
|
1744619
|
-
await (0,
|
|
1744762
|
+
await (0, import_promises161.copyFile)(filePath, destPath);
|
|
1744620
1744763
|
assetsCopied++;
|
|
1744621
1744764
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
1744622
1744765
|
}
|