fern-api 0.40.4 → 0.41.0-rc1
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/bundle.cjs +377 -331
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -59771,8 +59771,8 @@ var require_graceful_fs = __commonJS({
|
|
|
59771
59771
|
}
|
|
59772
59772
|
}
|
|
59773
59773
|
var fs$writeFile = fs9.writeFile;
|
|
59774
|
-
fs9.writeFile =
|
|
59775
|
-
function
|
|
59774
|
+
fs9.writeFile = writeFile45;
|
|
59775
|
+
function writeFile45(path45, data2, options2, cb) {
|
|
59776
59776
|
if (typeof options2 === "function")
|
|
59777
59777
|
cb = options2, options2 = null;
|
|
59778
59778
|
return go$writeFile(path45, data2, options2, cb);
|
|
@@ -59826,9 +59826,9 @@ var require_graceful_fs = __commonJS({
|
|
|
59826
59826
|
}
|
|
59827
59827
|
}
|
|
59828
59828
|
var fs$readdir = fs9.readdir;
|
|
59829
|
-
fs9.readdir =
|
|
59829
|
+
fs9.readdir = readdir5;
|
|
59830
59830
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
59831
|
-
function
|
|
59831
|
+
function readdir5(path45, options2, cb) {
|
|
59832
59832
|
if (typeof options2 === "function")
|
|
59833
59833
|
cb = options2, options2 = null;
|
|
59834
59834
|
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path46, options3, cb2, startTime) {
|
|
@@ -61144,7 +61144,7 @@ var require_jsonfile = __commonJS({
|
|
|
61144
61144
|
const str3 = stringify5(obj, options2);
|
|
61145
61145
|
await universalify.fromCallback(fs8.writeFile)(file, str3, options2);
|
|
61146
61146
|
}
|
|
61147
|
-
var
|
|
61147
|
+
var writeFile45 = universalify.fromPromise(_writeFile);
|
|
61148
61148
|
function writeFileSync(file, obj, options2 = {}) {
|
|
61149
61149
|
const fs8 = options2.fs || _fs;
|
|
61150
61150
|
const str3 = stringify5(obj, options2);
|
|
@@ -61153,7 +61153,7 @@ var require_jsonfile = __commonJS({
|
|
|
61153
61153
|
var jsonfile = {
|
|
61154
61154
|
readFile: readFile48,
|
|
61155
61155
|
readFileSync: readFileSync4,
|
|
61156
|
-
writeFile:
|
|
61156
|
+
writeFile: writeFile45,
|
|
61157
61157
|
writeFileSync
|
|
61158
61158
|
};
|
|
61159
61159
|
module2.exports = jsonfile;
|
|
@@ -125731,7 +125731,7 @@ ${cbNode.commentBefore}` : cb;
|
|
|
125731
125731
|
doc.contents = value;
|
|
125732
125732
|
return String(doc);
|
|
125733
125733
|
}
|
|
125734
|
-
var
|
|
125734
|
+
var YAML12 = {
|
|
125735
125735
|
createNode,
|
|
125736
125736
|
defaultOptions: Document$1.defaultOptions,
|
|
125737
125737
|
Document,
|
|
@@ -125742,7 +125742,7 @@ ${cbNode.commentBefore}` : cb;
|
|
|
125742
125742
|
scalarOptions: Document$1.scalarOptions,
|
|
125743
125743
|
stringify: stringify5
|
|
125744
125744
|
};
|
|
125745
|
-
exports22.YAML =
|
|
125745
|
+
exports22.YAML = YAML12;
|
|
125746
125746
|
}
|
|
125747
125747
|
});
|
|
125748
125748
|
var require_yaml2 = __commonJS2({
|
|
@@ -322178,7 +322178,7 @@ ${fromBody}`;
|
|
|
322178
322178
|
readdirWithFileTypes(directory, settings, callback);
|
|
322179
322179
|
return;
|
|
322180
322180
|
}
|
|
322181
|
-
|
|
322181
|
+
readdir5(directory, settings, callback);
|
|
322182
322182
|
}
|
|
322183
322183
|
exports22.read = read2;
|
|
322184
322184
|
function readdirWithFileTypes(directory, settings, callback) {
|
|
@@ -322229,7 +322229,7 @@ ${fromBody}`;
|
|
|
322229
322229
|
});
|
|
322230
322230
|
};
|
|
322231
322231
|
}
|
|
322232
|
-
function
|
|
322232
|
+
function readdir5(directory, settings, callback) {
|
|
322233
322233
|
settings.fs.readdir(directory, (readdirError, names2) => {
|
|
322234
322234
|
if (readdirError !== null) {
|
|
322235
322235
|
callFailureCallback(callback, readdirError);
|
|
@@ -322264,7 +322264,7 @@ ${fromBody}`;
|
|
|
322264
322264
|
});
|
|
322265
322265
|
});
|
|
322266
322266
|
}
|
|
322267
|
-
exports22.readdir =
|
|
322267
|
+
exports22.readdir = readdir5;
|
|
322268
322268
|
function callFailureCallback(callback, error) {
|
|
322269
322269
|
callback(error);
|
|
322270
322270
|
}
|
|
@@ -322288,7 +322288,7 @@ ${fromBody}`;
|
|
|
322288
322288
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
322289
322289
|
return readdirWithFileTypes(directory, settings);
|
|
322290
322290
|
}
|
|
322291
|
-
return
|
|
322291
|
+
return readdir5(directory, settings);
|
|
322292
322292
|
}
|
|
322293
322293
|
exports22.read = read2;
|
|
322294
322294
|
function readdirWithFileTypes(directory, settings) {
|
|
@@ -322315,7 +322315,7 @@ ${fromBody}`;
|
|
|
322315
322315
|
});
|
|
322316
322316
|
}
|
|
322317
322317
|
exports22.readdirWithFileTypes = readdirWithFileTypes;
|
|
322318
|
-
function
|
|
322318
|
+
function readdir5(directory, settings) {
|
|
322319
322319
|
const names2 = settings.fs.readdirSync(directory);
|
|
322320
322320
|
return names2.map((name2) => {
|
|
322321
322321
|
const entryPath = common3.joinPathSegments(directory, name2, settings.pathSegmentSeparator);
|
|
@@ -322331,7 +322331,7 @@ ${fromBody}`;
|
|
|
322331
322331
|
return entry;
|
|
322332
322332
|
});
|
|
322333
322333
|
}
|
|
322334
|
-
exports22.readdir =
|
|
322334
|
+
exports22.readdir = readdir5;
|
|
322335
322335
|
}
|
|
322336
322336
|
});
|
|
322337
322337
|
var require_fs42 = __commonJS22({
|
|
@@ -345031,8 +345031,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
345031
345031
|
}
|
|
345032
345032
|
}
|
|
345033
345033
|
var fs$writeFile = fs9.writeFile;
|
|
345034
|
-
fs9.writeFile =
|
|
345035
|
-
function
|
|
345034
|
+
fs9.writeFile = writeFile45;
|
|
345035
|
+
function writeFile45(path45, data2, options2, cb) {
|
|
345036
345036
|
if (typeof options2 === "function")
|
|
345037
345037
|
cb = options2, options2 = null;
|
|
345038
345038
|
return go$writeFile(path45, data2, options2, cb);
|
|
@@ -345086,9 +345086,9 @@ var require_graceful_fs2 = __commonJS({
|
|
|
345086
345086
|
}
|
|
345087
345087
|
}
|
|
345088
345088
|
var fs$readdir = fs9.readdir;
|
|
345089
|
-
fs9.readdir =
|
|
345089
|
+
fs9.readdir = readdir5;
|
|
345090
345090
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
345091
|
-
function
|
|
345091
|
+
function readdir5(path45, options2, cb) {
|
|
345092
345092
|
if (typeof options2 === "function")
|
|
345093
345093
|
cb = options2, options2 = null;
|
|
345094
345094
|
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path46, options3, cb2, startTime) {
|
|
@@ -351375,10 +351375,10 @@ var require_chownr = __commonJS({
|
|
|
351375
351375
|
}
|
|
351376
351376
|
} : (path46, uid, gid) => lchownSync(path46, uid, gid);
|
|
351377
351377
|
var nodeVersion2 = process.version;
|
|
351378
|
-
var
|
|
351378
|
+
var readdir5 = (path46, options2, cb) => fs8.readdir(path46, options2, cb);
|
|
351379
351379
|
var readdirSync2 = (path46, options2) => fs8.readdirSync(path46, options2);
|
|
351380
351380
|
if (/^v4\./.test(nodeVersion2))
|
|
351381
|
-
|
|
351381
|
+
readdir5 = (path46, options2, cb) => fs8.readdir(path46, cb);
|
|
351382
351382
|
var chown = (cpath, uid, gid, cb) => {
|
|
351383
351383
|
fs8[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, (er) => {
|
|
351384
351384
|
cb(er && er.code !== "ENOENT" ? er : null);
|
|
@@ -351405,7 +351405,7 @@ var require_chownr = __commonJS({
|
|
|
351405
351405
|
}
|
|
351406
351406
|
};
|
|
351407
351407
|
var chownr = (p3, uid, gid, cb) => {
|
|
351408
|
-
|
|
351408
|
+
readdir5(p3, { withFileTypes: true }, (er, children2) => {
|
|
351409
351409
|
if (er) {
|
|
351410
351410
|
if (er.code === "ENOENT")
|
|
351411
351411
|
return cb();
|
|
@@ -1182437,10 +1182437,10 @@ var require_chownr2 = __commonJS({
|
|
|
1182437
1182437
|
}
|
|
1182438
1182438
|
} : (path46, uid, gid) => lchownSync(path46, uid, gid);
|
|
1182439
1182439
|
var nodeVersion2 = process.version;
|
|
1182440
|
-
var
|
|
1182440
|
+
var readdir5 = (path46, options2, cb) => fs8.readdir(path46, options2, cb);
|
|
1182441
1182441
|
var readdirSync2 = (path46, options2) => fs8.readdirSync(path46, options2);
|
|
1182442
1182442
|
if (/^v4\./.test(nodeVersion2))
|
|
1182443
|
-
|
|
1182443
|
+
readdir5 = (path46, options2, cb) => fs8.readdir(path46, cb);
|
|
1182444
1182444
|
var chown = (cpath, uid, gid, cb) => {
|
|
1182445
1182445
|
fs8[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, (er) => {
|
|
1182446
1182446
|
cb(er && er.code !== "ENOENT" ? er : null);
|
|
@@ -1182467,7 +1182467,7 @@ var require_chownr2 = __commonJS({
|
|
|
1182467
1182467
|
}
|
|
1182468
1182468
|
};
|
|
1182469
1182469
|
var chownr = (p3, uid, gid, cb) => {
|
|
1182470
|
-
|
|
1182470
|
+
readdir5(p3, { withFileTypes: true }, (er, children2) => {
|
|
1182471
1182471
|
if (er) {
|
|
1182472
1182472
|
if (er.code === "ENOENT")
|
|
1182473
1182473
|
return cb();
|
|
@@ -1192515,6 +1192515,7 @@ function joinZodPath(arr) {
|
|
|
1192515
1192515
|
var FERN_DIRECTORY = "fern";
|
|
1192516
1192516
|
var DEFINITION_DIRECTORY = "definition";
|
|
1192517
1192517
|
var OPENAPI_DIRECTORY = "openapi";
|
|
1192518
|
+
var CHANGELOG_DIRECTORY = "changelog";
|
|
1192518
1192519
|
var ASYNCAPI_DIRECTORY = "asyncapi";
|
|
1192519
1192520
|
var ROOT_API_FILENAME = "api.yml";
|
|
1192520
1192521
|
var FERN_PACKAGE_MARKER_FILENAME = "__package__.yml";
|
|
@@ -1192595,16 +1192596,19 @@ async function getDirectoryContents(absolutePath, options2 = {}) {
|
|
|
1192595
1192596
|
const contents = [];
|
|
1192596
1192597
|
const items = await (0, import_promises2.readdir)(absolutePath, { withFileTypes: true });
|
|
1192597
1192598
|
await Promise.all(items.map(async (item) => {
|
|
1192599
|
+
const absolutePathToItem = join(absolutePath, RelativeFilePath.of(item.name));
|
|
1192598
1192600
|
if (item.isDirectory()) {
|
|
1192599
1192601
|
contents.push({
|
|
1192600
1192602
|
type: "directory",
|
|
1192601
1192603
|
name: item.name,
|
|
1192602
|
-
|
|
1192604
|
+
absolutePath: absolutePathToItem,
|
|
1192605
|
+
contents: await getDirectoryContents(absolutePathToItem, options2)
|
|
1192603
1192606
|
});
|
|
1192604
1192607
|
} else if (fileExtensionsWithPeriods == null || fileExtensionsWithPeriods.has(import_path6.default.extname(item.name))) {
|
|
1192605
1192608
|
contents.push({
|
|
1192606
1192609
|
type: "file",
|
|
1192607
1192610
|
name: item.name,
|
|
1192611
|
+
absolutePath: absolutePathToItem,
|
|
1192608
1192612
|
contents: (await (0, import_promises2.readFile)(import_path6.default.join(absolutePath, item.name))).toString()
|
|
1192609
1192613
|
});
|
|
1192610
1192614
|
}
|
|
@@ -1208722,7 +1208726,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1208722
1208726
|
properties: {
|
|
1208723
1208727
|
...event,
|
|
1208724
1208728
|
...event.properties,
|
|
1208725
|
-
version: "0.
|
|
1208729
|
+
version: "0.41.0-rc1",
|
|
1208726
1208730
|
usingAccessToken: true
|
|
1208727
1208731
|
}
|
|
1208728
1208732
|
});
|
|
@@ -1208784,7 +1208788,7 @@ var UserPosthogManager = class {
|
|
|
1208784
1208788
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1208785
1208789
|
event: "CLI",
|
|
1208786
1208790
|
properties: {
|
|
1208787
|
-
version: "0.
|
|
1208791
|
+
version: "0.41.0-rc1",
|
|
1208788
1208792
|
...event,
|
|
1208789
1208793
|
...event.properties
|
|
1208790
1208794
|
}
|
|
@@ -1210170,18 +1210174,21 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
1210170
1210174
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
1210171
1210175
|
await (0, import_promises16.mkdir)(directoryOfWorkspace);
|
|
1210172
1210176
|
}
|
|
1210177
|
+
const openAPIfilename = import_path15.default.basename(openAPIFilePath);
|
|
1210173
1210178
|
await writeGeneratorsConfiguration({
|
|
1210174
1210179
|
filepath: join(directoryOfWorkspace, RelativeFilePath.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
1210175
1210180
|
cliVersion,
|
|
1210176
|
-
context
|
|
1210181
|
+
context,
|
|
1210182
|
+
apiConfiguration: {
|
|
1210183
|
+
path: join(RelativeFilePath.of(OPENAPI_DIRECTORY), RelativeFilePath.of(openAPIfilename))
|
|
1210184
|
+
}
|
|
1210177
1210185
|
});
|
|
1210178
1210186
|
const openapiDirectory = join(directoryOfWorkspace, RelativeFilePath.of(OPENAPI_DIRECTORY));
|
|
1210179
1210187
|
await (0, import_promises16.mkdir)(openapiDirectory);
|
|
1210180
1210188
|
const openAPIContents = await (0, import_promises16.readFile)(openAPIFilePath);
|
|
1210181
|
-
const openAPIfilename = import_path15.default.basename(openAPIFilePath);
|
|
1210182
1210189
|
await (0, import_promises16.writeFile)(join(openapiDirectory, RelativeFilePath.of(openAPIfilename)), openAPIContents);
|
|
1210183
1210190
|
}
|
|
1210184
|
-
async function getDefaultGeneratorsConfiguration(cliVersion, context) {
|
|
1210191
|
+
async function getDefaultGeneratorsConfiguration({ cliVersion, context, apiConfiguration }) {
|
|
1210185
1210192
|
const defaultGeneratorName = "fernapi/fern-typescript-node-sdk";
|
|
1210186
1210193
|
const fallbackInvocation = generators_yml_exports.GENERATOR_INVOCATIONS[defaultGeneratorName];
|
|
1210187
1210194
|
let version3 = fallbackInvocation.version;
|
|
@@ -1210195,7 +1210202,7 @@ async function getDefaultGeneratorsConfiguration(cliVersion, context) {
|
|
|
1210195
1210202
|
} else {
|
|
1210196
1210203
|
context.logger.debug(`Failed to get latest version for ${defaultGeneratorName} that is compatible with CLI ${cliVersion}, falling back to preset version ${version3}`);
|
|
1210197
1210204
|
}
|
|
1210198
|
-
|
|
1210205
|
+
const config = {
|
|
1210199
1210206
|
"default-group": DEFAULT_GROUP_NAME,
|
|
1210200
1210207
|
groups: {
|
|
1210201
1210208
|
[DEFAULT_GROUP_NAME]: {
|
|
@@ -1210209,9 +1210216,13 @@ async function getDefaultGeneratorsConfiguration(cliVersion, context) {
|
|
|
1210209
1210216
|
}
|
|
1210210
1210217
|
}
|
|
1210211
1210218
|
};
|
|
1210219
|
+
if (apiConfiguration != null) {
|
|
1210220
|
+
config.api = apiConfiguration;
|
|
1210221
|
+
}
|
|
1210222
|
+
return config;
|
|
1210212
1210223
|
}
|
|
1210213
|
-
async function writeGeneratorsConfiguration({ filepath, cliVersion, context }) {
|
|
1210214
|
-
await (0, import_promises16.writeFile)(filepath, js_yaml_default.dump(await getDefaultGeneratorsConfiguration(cliVersion, context)));
|
|
1210224
|
+
async function writeGeneratorsConfiguration({ filepath, cliVersion, context, apiConfiguration }) {
|
|
1210225
|
+
await (0, import_promises16.writeFile)(filepath, js_yaml_default.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context, apiConfiguration })));
|
|
1210215
1210226
|
}
|
|
1210216
1210227
|
var ROOT_API = {
|
|
1210217
1210228
|
name: "api",
|
|
@@ -1213867,10 +1213878,10 @@ var CliContext = class {
|
|
|
1213867
1213878
|
return "fern-api";
|
|
1213868
1213879
|
}
|
|
1213869
1213880
|
getPackageVersion() {
|
|
1213870
|
-
if ("0.
|
|
1213881
|
+
if ("0.41.0-rc1" == null) {
|
|
1213871
1213882
|
this.logger.error("CLI_VERSION is not defined");
|
|
1213872
1213883
|
}
|
|
1213873
|
-
return "0.
|
|
1213884
|
+
return "0.41.0-rc1";
|
|
1213874
1213885
|
}
|
|
1213875
1213886
|
getCliName() {
|
|
1213876
1213887
|
if ("fern" == null) {
|
|
@@ -1214155,33 +1214166,8 @@ function parseIssue(issue) {
|
|
|
1214155
1214166
|
}
|
|
1214156
1214167
|
}
|
|
1214157
1214168
|
|
|
1214158
|
-
// ../workspace-loader/lib/loadAsyncAPIFile.js
|
|
1214159
|
-
var import_promises20 = require("fs/promises");
|
|
1214160
|
-
async function getValidAbsolutePathToAsyncAPIFromFolder(context, absolutePathToAsyncAPIFolder) {
|
|
1214161
|
-
const files = await (0, import_promises20.readdir)(absolutePathToAsyncAPIFolder);
|
|
1214162
|
-
if (files.length < 1 || files[0] == null) {
|
|
1214163
|
-
context.failAndThrow(`No AsyncAPI found in directory ${absolutePathToAsyncAPIFolder}`);
|
|
1214164
|
-
}
|
|
1214165
|
-
const absolutePathToAsyncAPIFile = join(absolutePathToAsyncAPIFolder, RelativeFilePath.of(files[0]));
|
|
1214166
|
-
return absolutePathToAsyncAPIFile;
|
|
1214167
|
-
}
|
|
1214168
|
-
|
|
1214169
|
-
// ../workspace-loader/lib/loadOpenAPIFile.js
|
|
1214170
|
-
var import_promises21 = require("fs/promises");
|
|
1214171
|
-
async function getValidAbsolutePathToOpenAPIFromFolder(context, absolutePathToOpenAPIFolder) {
|
|
1214172
|
-
const files = await (0, import_promises21.readdir)(absolutePathToOpenAPIFolder);
|
|
1214173
|
-
if (files.length < 1 || files[0] == null) {
|
|
1214174
|
-
context.failAndThrow(`No OpenAPI found in directory ${absolutePathToOpenAPIFolder}`);
|
|
1214175
|
-
}
|
|
1214176
|
-
const absolutePathToOpenAPIFile = join(absolutePathToOpenAPIFolder, RelativeFilePath.of(files[0]));
|
|
1214177
|
-
return absolutePathToOpenAPIFile;
|
|
1214178
|
-
}
|
|
1214179
|
-
|
|
1214180
|
-
// ../workspace-loader/lib/workspaces/FernWorkspace.js
|
|
1214181
|
-
var import_object_hash = __toESM(require_object_hash(), 1);
|
|
1214182
|
-
|
|
1214183
1214169
|
// ../workspace-loader/lib/listFernFiles.js
|
|
1214184
|
-
var
|
|
1214170
|
+
var import_promises20 = require("fs/promises");
|
|
1214185
1214171
|
async function listFernFiles(root5, extensionGlob) {
|
|
1214186
1214172
|
const files = [];
|
|
1214187
1214173
|
for (const absoluteFilepath of await listFiles(root5, extensionGlob)) {
|
|
@@ -1214196,10 +1214182,31 @@ async function createFernFile({ relativeFilepath, absoluteFilepath }) {
|
|
|
1214196
1214182
|
return {
|
|
1214197
1214183
|
relativeFilepath,
|
|
1214198
1214184
|
absoluteFilepath,
|
|
1214199
|
-
fileContents: (await (0,
|
|
1214185
|
+
fileContents: (await (0, import_promises20.readFile)(absoluteFilepath)).toString()
|
|
1214200
1214186
|
};
|
|
1214201
1214187
|
}
|
|
1214202
1214188
|
|
|
1214189
|
+
// ../workspace-loader/lib/loadAPIChangelog.js
|
|
1214190
|
+
async function loadAPIChangelog({ absolutePathToWorkspace }) {
|
|
1214191
|
+
const absolutePathToChangelogDirectory = join(absolutePathToWorkspace, RelativeFilePath.of(CHANGELOG_DIRECTORY));
|
|
1214192
|
+
const changelogDirectoryExists = await doesPathExist(absolutePathToChangelogDirectory);
|
|
1214193
|
+
if (!changelogDirectoryExists) {
|
|
1214194
|
+
return void 0;
|
|
1214195
|
+
}
|
|
1214196
|
+
const mdFiles = await listFernFiles(absolutePathToChangelogDirectory, "{md,mdx}");
|
|
1214197
|
+
return {
|
|
1214198
|
+
files: await Promise.all(mdFiles.map((file) => {
|
|
1214199
|
+
return {
|
|
1214200
|
+
absoluteFilepath: file.absoluteFilepath,
|
|
1214201
|
+
contents: file.fileContents
|
|
1214202
|
+
};
|
|
1214203
|
+
}))
|
|
1214204
|
+
};
|
|
1214205
|
+
}
|
|
1214206
|
+
|
|
1214207
|
+
// ../workspace-loader/lib/workspaces/FernWorkspace.js
|
|
1214208
|
+
var import_object_hash = __toESM(require_object_hash(), 1);
|
|
1214209
|
+
|
|
1214203
1214210
|
// ../workspace-loader/lib/parseYamlFiles.js
|
|
1214204
1214211
|
async function parseYamlFiles(files) {
|
|
1214205
1214212
|
const parsedFiles = {};
|
|
@@ -1222197,10 +1222204,10 @@ function isRawEnumDefinition(rawTypeDeclaration) {
|
|
|
1222197
1222204
|
var import_fiddle_sdk3 = __toESM(require_fiddle_sdk(), 1);
|
|
1222198
1222205
|
var import_axios4 = __toESM(require_axios4(), 1);
|
|
1222199
1222206
|
var import_fs6 = require("fs");
|
|
1222200
|
-
var
|
|
1222207
|
+
var import_promises21 = require("fs/promises");
|
|
1222201
1222208
|
var import_os3 = require("os");
|
|
1222202
1222209
|
var import_path22 = __toESM(require("path"), 1);
|
|
1222203
|
-
var
|
|
1222210
|
+
var import_promises22 = require("stream/promises");
|
|
1222204
1222211
|
var import_tar = __toESM(require_tar(), 1);
|
|
1222205
1222212
|
var import_tmp_promise3 = __toESM(require_tmp_promise(), 1);
|
|
1222206
1222213
|
var FIDDLE = createFiddleService();
|
|
@@ -1222314,7 +1222321,7 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
1222314
1222321
|
}
|
|
1222315
1222322
|
context.logger.info("Downloading...");
|
|
1222316
1222323
|
context.logger.debug("Remote URL: " + response.body.definitionS3DownloadUrl);
|
|
1222317
|
-
await (0,
|
|
1222324
|
+
await (0, import_promises21.mkdir)(pathToDefinition, { recursive: true });
|
|
1222318
1222325
|
try {
|
|
1222319
1222326
|
await downloadDependency({
|
|
1222320
1222327
|
s3PreSignedReadUrl: response.body.definitionS3DownloadUrl,
|
|
@@ -1222325,9 +1222332,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
1222325
1222332
|
return void 0;
|
|
1222326
1222333
|
}
|
|
1222327
1222334
|
metadata = response.body;
|
|
1222328
|
-
await (0,
|
|
1222335
|
+
await (0, import_promises21.writeFile)(pathToMetadata, JSON.stringify(metadata));
|
|
1222329
1222336
|
} else {
|
|
1222330
|
-
metadata = JSON.parse((await (0,
|
|
1222337
|
+
metadata = JSON.parse((await (0, import_promises21.readFile)(pathToMetadata)).toString());
|
|
1222331
1222338
|
}
|
|
1222332
1222339
|
context.logger.info("Parsing...");
|
|
1222333
1222340
|
const loadDependencyWorkspaceResult = await loadAPIWorkspace({
|
|
@@ -1222353,7 +1222360,7 @@ async function downloadDependency({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1222353
1222360
|
});
|
|
1222354
1222361
|
const tmpDir = await import_tmp_promise3.default.dir();
|
|
1222355
1222362
|
const outputTarPath = import_path22.default.join(tmpDir.path, "api.tgz");
|
|
1222356
|
-
await (0,
|
|
1222363
|
+
await (0, import_promises22.pipeline)(request.data, (0, import_fs6.createWriteStream)(outputTarPath));
|
|
1222357
1222364
|
await import_tar.default.extract({ file: outputTarPath, cwd: absolutePathToLocalOutput });
|
|
1222358
1222365
|
}
|
|
1222359
1222366
|
function stringifyDependency(dependency) {
|
|
@@ -1228140,7 +1228147,7 @@ function buildPathParameter({ pathParameter, context, fileContainingReference })
|
|
|
1228140
1228147
|
}
|
|
1228141
1228148
|
|
|
1228142
1228149
|
// ../openapi-parser/lib/parse.js
|
|
1228143
|
-
var
|
|
1228150
|
+
var import_promises24 = require("fs/promises");
|
|
1228144
1228151
|
|
|
1228145
1228152
|
// ../openapi-parser/lib/asyncapi/options.js
|
|
1228146
1228153
|
var DEFAULT_PARSE_ASYNCAPI_SETTINGS = {
|
|
@@ -1232883,11 +1232890,11 @@ var import_swagger_parser = __toESM(require_lib13(), 1);
|
|
|
1232883
1232890
|
var import_openapi_core = __toESM(require_lib14(), 1);
|
|
1232884
1232891
|
|
|
1232885
1232892
|
// ../openapi-parser/lib/mergeWithOverrides.js
|
|
1232886
|
-
var
|
|
1232893
|
+
var import_promises23 = require("fs/promises");
|
|
1232887
1232894
|
async function mergeWithOverrides({ absoluteFilepathToOverrides, data: data2, context }) {
|
|
1232888
1232895
|
let parsedOverrides = null;
|
|
1232889
1232896
|
try {
|
|
1232890
|
-
const contents = (await (0,
|
|
1232897
|
+
const contents = (await (0, import_promises23.readFile)(absoluteFilepathToOverrides, "utf8")).toString();
|
|
1232891
1232898
|
try {
|
|
1232892
1232899
|
parsedOverrides = JSON.parse(contents);
|
|
1232893
1232900
|
} catch (err) {
|
|
@@ -1235308,7 +1235315,7 @@ async function parse3({ absoluteFilePathToWorkspace, specs, taskContext, optionO
|
|
|
1235308
1235315
|
groups: {}
|
|
1235309
1235316
|
};
|
|
1235310
1235317
|
for (const spec of specs) {
|
|
1235311
|
-
const contents = (await (0,
|
|
1235318
|
+
const contents = (await (0, import_promises24.readFile)(spec.absoluteFilepath)).toString();
|
|
1235312
1235319
|
let sourceRelativePath = relative(absoluteFilePathToWorkspace, spec.source.file);
|
|
1235313
1235320
|
if (spec.source.relativePathToDependency != null) {
|
|
1235314
1235321
|
sourceRelativePath = join(spec.source.relativePathToDependency, sourceRelativePath);
|
|
@@ -1235424,7 +1235431,7 @@ function merge2(ir1, ir2) {
|
|
|
1235424
1235431
|
};
|
|
1235425
1235432
|
}
|
|
1235426
1235433
|
async function loadAsyncAPI({ absoluteFilePathToAsyncAPI, absoluteFilePathToAsyncAPIOverrides, context }) {
|
|
1235427
|
-
const contents = (await (0,
|
|
1235434
|
+
const contents = (await (0, import_promises24.readFile)(absoluteFilePathToAsyncAPI)).toString();
|
|
1235428
1235435
|
const parsed = await js_yaml_default.load(contents);
|
|
1235429
1235436
|
if (absoluteFilePathToAsyncAPIOverrides != null) {
|
|
1235430
1235437
|
return await mergeWithOverrides({
|
|
@@ -1237623,7 +1237630,7 @@ function createLoggingExecutable(executable, { logger, ...loggingExecaOptions }
|
|
|
1237623
1237630
|
}
|
|
1237624
1237631
|
|
|
1237625
1237632
|
// ../workspace-loader/lib/protobuf/ProtobufOpenAPIGenerator.js
|
|
1237626
|
-
var
|
|
1237633
|
+
var import_promises25 = require("fs/promises");
|
|
1237627
1237634
|
var import_tmp_promise4 = __toESM(require_tmp_promise(), 1);
|
|
1237628
1237635
|
var PROTOBUF_GENERATOR_CONFIG_FILENAME = "buf.gen.yaml";
|
|
1237629
1237636
|
var PROTOBUF_GENERATOR_OUTPUT_PATH = "output";
|
|
@@ -1237661,8 +1237668,8 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
1237661
1237668
|
}
|
|
1237662
1237669
|
async setupProtobufGeneratorConfig({ absoluteFilepathToProtobufRoot }) {
|
|
1237663
1237670
|
const protobufGeneratorConfigPath = AbsoluteFilePath.of((await import_tmp_promise4.default.dir()).path);
|
|
1237664
|
-
await (0,
|
|
1237665
|
-
await (0,
|
|
1237671
|
+
await (0, import_promises25.cp)(absoluteFilepathToProtobufRoot, protobufGeneratorConfigPath, { recursive: true });
|
|
1237672
|
+
await (0, import_promises25.writeFile)(join(protobufGeneratorConfigPath, RelativeFilePath.of(PROTOBUF_GENERATOR_CONFIG_FILENAME)), PROTOBUF_GENERATOR_CONFIG);
|
|
1237666
1237673
|
return protobufGeneratorConfigPath;
|
|
1237667
1237674
|
}
|
|
1237668
1237675
|
async doGenerateLocal({ cwd: cwd2, target }) {
|
|
@@ -1237937,11 +1237944,11 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion,
|
|
|
1237937
1237944
|
absolutePathToWorkspace,
|
|
1237938
1237945
|
context
|
|
1237939
1237946
|
});
|
|
1237940
|
-
|
|
1237941
|
-
|
|
1237942
|
-
|
|
1237943
|
-
|
|
1237944
|
-
|
|
1237947
|
+
let changelog = void 0;
|
|
1237948
|
+
try {
|
|
1237949
|
+
changelog = await loadAPIChangelog({ absolutePathToWorkspace });
|
|
1237950
|
+
} catch (err) {
|
|
1237951
|
+
}
|
|
1237945
1237952
|
if ((generatorsConfiguration == null ? void 0 : generatorsConfiguration.api) != null && (generatorsConfiguration.api.type === "singleNamespace" && generatorsConfiguration.api.definitions.length > 0 || generatorsConfiguration.api.type === "multiNamespace")) {
|
|
1237946
1237953
|
const specs = [];
|
|
1237947
1237954
|
if (generatorsConfiguration.api.type === "singleNamespace") {
|
|
@@ -1237978,53 +1237985,6 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion,
|
|
|
1237978
1237985
|
})
|
|
1237979
1237986
|
};
|
|
1237980
1237987
|
}
|
|
1237981
|
-
if (openApiDirectoryExists) {
|
|
1237982
|
-
const absolutePathToAsyncAPI = asyncApiDirectoryExists ? await getValidAbsolutePathToAsyncAPIFromFolder(context, absolutePathToAsyncAPIFolder) : void 0;
|
|
1237983
|
-
const absolutePathToOpenAPI = await getValidAbsolutePathToOpenAPIFromFolder(context, absolutePathToOpenAPIFolder);
|
|
1237984
|
-
const specs = [];
|
|
1237985
|
-
if (absolutePathToOpenAPI != null) {
|
|
1237986
|
-
specs.push({
|
|
1237987
|
-
type: "openapi",
|
|
1237988
|
-
absoluteFilepath: absolutePathToOpenAPI,
|
|
1237989
|
-
absoluteFilepathToOverrides: void 0,
|
|
1237990
|
-
source: {
|
|
1237991
|
-
type: "openapi",
|
|
1237992
|
-
file: absolutePathToOpenAPI
|
|
1237993
|
-
}
|
|
1237994
|
-
});
|
|
1237995
|
-
}
|
|
1237996
|
-
if (absolutePathToAsyncAPI != null) {
|
|
1237997
|
-
specs.push({
|
|
1237998
|
-
type: "openapi",
|
|
1237999
|
-
absoluteFilepath: absolutePathToAsyncAPI,
|
|
1238000
|
-
absoluteFilepathToOverrides: void 0,
|
|
1238001
|
-
source: {
|
|
1238002
|
-
type: "asyncapi",
|
|
1238003
|
-
file: absolutePathToAsyncAPI
|
|
1238004
|
-
}
|
|
1238005
|
-
});
|
|
1238006
|
-
}
|
|
1238007
|
-
if (absolutePathToOpenAPI != null && absolutePathToAsyncAPI != null) {
|
|
1238008
|
-
return {
|
|
1238009
|
-
didSucceed: false,
|
|
1238010
|
-
failures: {
|
|
1238011
|
-
[RelativeFilePath.of("openapi/openapi.yml")]: {
|
|
1238012
|
-
type: WorkspaceLoaderFailureType.FILE_MISSING
|
|
1238013
|
-
}
|
|
1238014
|
-
}
|
|
1238015
|
-
};
|
|
1238016
|
-
}
|
|
1238017
|
-
return {
|
|
1238018
|
-
didSucceed: true,
|
|
1238019
|
-
workspace: new OSSWorkspace({
|
|
1238020
|
-
specs,
|
|
1238021
|
-
workspaceName,
|
|
1238022
|
-
absoluteFilepath: absolutePathToWorkspace,
|
|
1238023
|
-
generatorsConfiguration,
|
|
1238024
|
-
changelog
|
|
1238025
|
-
})
|
|
1238026
|
-
};
|
|
1238027
|
-
}
|
|
1238028
1237988
|
if (await doesPathExist(join(absolutePathToWorkspace, RelativeFilePath.of(DEFINITION_DIRECTORY)))) {
|
|
1238029
1237989
|
const fernWorkspace = new LazyFernWorkspace({
|
|
1238030
1237990
|
absoluteFilepath: absolutePathToWorkspace,
|
|
@@ -1238050,7 +1238010,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context, cliVersion,
|
|
|
1238050
1238010
|
}
|
|
1238051
1238011
|
|
|
1238052
1238012
|
// ../workspace-loader/lib/loadDocsWorkspace.js
|
|
1238053
|
-
var
|
|
1238013
|
+
var import_promises26 = require("fs/promises");
|
|
1238054
1238014
|
var import_path25 = __toESM(require("path"), 1);
|
|
1238055
1238015
|
async function loadDocsWorkspace({ fernDirectory, context }) {
|
|
1238056
1238016
|
const docsConfigurationFile = join(fernDirectory, RelativeFilePath.of(DOCS_CONFIGURATION_FILENAME));
|
|
@@ -1238083,7 +1238043,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context })
|
|
|
1238083
1238043
|
});
|
|
1238084
1238044
|
}
|
|
1238085
1238045
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context }) {
|
|
1238086
|
-
const contentsStr = await (0,
|
|
1238046
|
+
const contentsStr = await (0, import_promises26.readFile)(absolutePathOfConfiguration);
|
|
1238087
1238047
|
const contentsJson = js_yaml_default.load(contentsStr.toString());
|
|
1238088
1238048
|
return await validateSchema2({
|
|
1238089
1238049
|
value: contentsJson,
|
|
@@ -1238170,7 +1238130,7 @@ async function visitAllPackageMarkers(workspace, visitor) {
|
|
|
1238170
1238130
|
}
|
|
1238171
1238131
|
|
|
1238172
1238132
|
// ../project-loader/lib/loadProject.js
|
|
1238173
|
-
var
|
|
1238133
|
+
var import_promises27 = require("fs/promises");
|
|
1238174
1238134
|
async function loadProject({ context, nameOverride, ...args }) {
|
|
1238175
1238135
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
1238176
1238136
|
if (fernDirectory == null) {
|
|
@@ -1238211,7 +1238171,7 @@ async function loadApis({ cliName, fernDirectory, context, cliVersion, commandLi
|
|
|
1238211
1238171
|
const apisDirectory = join(fernDirectory, RelativeFilePath.of(APIS_DIRECTORY));
|
|
1238212
1238172
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
1238213
1238173
|
if (apisDirectoryExists) {
|
|
1238214
|
-
const apiDirectoryContents = await (0,
|
|
1238174
|
+
const apiDirectoryContents = await (0, import_promises27.readdir)(apisDirectory, { withFileTypes: true });
|
|
1238215
1238175
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all4, item) => {
|
|
1238216
1238176
|
if (item.isDirectory()) {
|
|
1238217
1238177
|
all4.push(item.name);
|
|
@@ -1238289,7 +1238249,7 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
1238289
1238249
|
var import_generators_sdk2 = __toESM(require_generators_sdk2(), 1);
|
|
1238290
1238250
|
|
|
1238291
1238251
|
// src/commands/generator-list/getGeneratorList.ts
|
|
1238292
|
-
var
|
|
1238252
|
+
var import_promises28 = require("fs/promises");
|
|
1238293
1238253
|
async function getGeneratorList({
|
|
1238294
1238254
|
cliContext,
|
|
1238295
1238255
|
generatorFilter,
|
|
@@ -1238330,7 +1238290,7 @@ async function getGeneratorList({
|
|
|
1238330
1238290
|
return;
|
|
1238331
1238291
|
}
|
|
1238332
1238292
|
try {
|
|
1238333
|
-
await (0,
|
|
1238293
|
+
await (0, import_promises28.writeFile)(outputLocation, generatorsListYaml);
|
|
1238334
1238294
|
} catch (error) {
|
|
1238335
1238295
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error);
|
|
1238336
1238296
|
}
|
|
@@ -1238375,7 +1238335,7 @@ async function getGeneratorMetadata({
|
|
|
1238375
1238335
|
}
|
|
1238376
1238336
|
|
|
1238377
1238337
|
// src/commands/organization/getOrganization.ts
|
|
1238378
|
-
var
|
|
1238338
|
+
var import_promises29 = require("fs/promises");
|
|
1238379
1238339
|
async function getOrganziation({
|
|
1238380
1238340
|
project,
|
|
1238381
1238341
|
outputLocation,
|
|
@@ -1238387,14 +1238347,14 @@ async function getOrganziation({
|
|
|
1238387
1238347
|
return;
|
|
1238388
1238348
|
}
|
|
1238389
1238349
|
try {
|
|
1238390
|
-
await (0,
|
|
1238350
|
+
await (0, import_promises29.writeFile)(outputLocation, org);
|
|
1238391
1238351
|
} catch (error) {
|
|
1238392
1238352
|
context.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error);
|
|
1238393
1238353
|
}
|
|
1238394
1238354
|
}
|
|
1238395
1238355
|
|
|
1238396
1238356
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
1238397
|
-
var
|
|
1238357
|
+
var import_promises30 = require("fs/promises");
|
|
1238398
1238358
|
var import_path27 = __toESM(require("path"), 1);
|
|
1238399
1238359
|
var import_yaml = __toESM(require_dist5(), 1);
|
|
1238400
1238360
|
async function loadAndUpdateGenerators({
|
|
@@ -1238411,7 +1238371,7 @@ async function loadAndUpdateGenerators({
|
|
|
1238411
1238371
|
context.failAndThrow("Generators configuration file was not found, no generators to upgrade.");
|
|
1238412
1238372
|
return void 0;
|
|
1238413
1238373
|
}
|
|
1238414
|
-
const contents = await (0,
|
|
1238374
|
+
const contents = await (0, import_promises30.readFile)(filepath);
|
|
1238415
1238375
|
context.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1238416
1238376
|
const parsedDocument = import_yaml.default.parseDocument(contents.toString());
|
|
1238417
1238377
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -1238512,7 +1238472,7 @@ async function upgradeGenerator({
|
|
|
1238512
1238472
|
cliVersion: cliContext.environment.packageVersion
|
|
1238513
1238473
|
});
|
|
1238514
1238474
|
if (updatedConfiguration != null) {
|
|
1238515
|
-
await (0,
|
|
1238475
|
+
await (0, import_promises30.writeFile)(
|
|
1238516
1238476
|
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1238517
1238477
|
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1238518
1238478
|
}),
|
|
@@ -1238696,7 +1238656,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
1238696
1238656
|
}
|
|
1238697
1238657
|
|
|
1238698
1238658
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
1238699
|
-
var
|
|
1238659
|
+
var import_promises31 = require("fs/promises");
|
|
1238700
1238660
|
async function addGeneratorToWorkspaces({
|
|
1238701
1238661
|
project: { apiWorkspaces },
|
|
1238702
1238662
|
generatorName,
|
|
@@ -1238718,7 +1238678,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1238718
1238678
|
context,
|
|
1238719
1238679
|
cliVersion: cliContext.environment.packageVersion
|
|
1238720
1238680
|
});
|
|
1238721
|
-
await (0,
|
|
1238681
|
+
await (0, import_promises31.writeFile)(
|
|
1238722
1238682
|
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1238723
1238683
|
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1238724
1238684
|
}),
|
|
@@ -1248140,10 +1248100,10 @@ function visitFrontmatterImages(data2, keys7, mapImage) {
|
|
|
1248140
1248100
|
}
|
|
1248141
1248101
|
|
|
1248142
1248102
|
// ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
1248143
|
-
var
|
|
1248103
|
+
var import_promises32 = require("fs/promises");
|
|
1248144
1248104
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
1248145
1248105
|
async function defaultMarkdownLoader(filepath) {
|
|
1248146
|
-
const { content: content3 } = (0, import_gray_matter2.default)(await (0,
|
|
1248106
|
+
const { content: content3 } = (0, import_gray_matter2.default)(await (0, import_promises32.readFile)(filepath));
|
|
1248147
1248107
|
return content3;
|
|
1248148
1248108
|
}
|
|
1248149
1248109
|
async function replaceReferencedMarkdown({
|
|
@@ -1248180,9 +1248140,9 @@ async function replaceReferencedMarkdown({
|
|
|
1248180
1248140
|
}
|
|
1248181
1248141
|
|
|
1248182
1248142
|
// ../docs-markdown-utils/lib/replaceReferencedCode.js
|
|
1248183
|
-
var
|
|
1248143
|
+
var import_promises33 = require("fs/promises");
|
|
1248184
1248144
|
async function defaultFileLoader(filepath) {
|
|
1248185
|
-
const file = await (0,
|
|
1248145
|
+
const file = await (0, import_promises33.readFile)(filepath);
|
|
1248186
1248146
|
return file.toString();
|
|
1248187
1248147
|
}
|
|
1248188
1248148
|
async function replaceReferencedCode({
|
|
@@ -1259843,10 +1259803,10 @@ var PropertyResolverImpl = class {
|
|
|
1259843
1259803
|
};
|
|
1259844
1259804
|
|
|
1259845
1259805
|
// ../generation/ir-generator/lib/parsers/ProtobufParser.js
|
|
1259846
|
-
var
|
|
1259806
|
+
var import_promises34 = require("fs/promises");
|
|
1259847
1259807
|
var ProtobufParser = class {
|
|
1259848
1259808
|
async parse({ absoluteFilePath }) {
|
|
1259849
|
-
const content3 = await (0,
|
|
1259809
|
+
const content3 = await (0, import_promises34.readFile)(absoluteFilePath, "utf-8");
|
|
1259850
1259810
|
const csharpNamespaceMatch = content3.match(/option\s+csharp_namespace\s*=\s*"([^"]+)";/);
|
|
1259851
1259811
|
const packageNameMatch = content3.match(/package\s+([a-zA-Z_][\w.]*);/);
|
|
1259852
1259812
|
const serviceNameMatch = content3.match(/service\s+([a-zA-Z_]\w*)\s*{/);
|
|
@@ -1260642,7 +1260602,7 @@ function filterServiceTypeReferenceInfoForAudiences(serviceTypeReferenceInfo, fi
|
|
|
1260642
1260602
|
// ../docs-resolver/lib/DocsDefinitionResolver.js
|
|
1260643
1260603
|
var import_dayjs3 = __toESM(require_dayjs_min(), 1);
|
|
1260644
1260604
|
var import_utc3 = __toESM(require_utc(), 1);
|
|
1260645
|
-
var
|
|
1260605
|
+
var import_promises35 = require("fs/promises");
|
|
1260646
1260606
|
var import_gray_matter3 = __toESM(require_gray_matter(), 1);
|
|
1260647
1260607
|
|
|
1260648
1260608
|
// ../docs-resolver/lib/utils/isSubpackage.js
|
|
@@ -1262849,7 +1262809,7 @@ var DocsDefinitionResolver = class {
|
|
|
1262849
1262809
|
const jsFilePaths = /* @__PURE__ */ new Set();
|
|
1262850
1262810
|
await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
|
|
1262851
1262811
|
const absoluteFilePath = resolve(this.docsWorkspace.absoluteFilepath, filepath);
|
|
1262852
|
-
const stats = await (0,
|
|
1262812
|
+
const stats = await (0, import_promises35.stat)(absoluteFilePath);
|
|
1262853
1262813
|
if (stats.isDirectory()) {
|
|
1262854
1262814
|
const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx}");
|
|
1262855
1262815
|
files.forEach((file) => {
|
|
@@ -1262861,7 +1262821,7 @@ var DocsDefinitionResolver = class {
|
|
|
1262861
1262821
|
}));
|
|
1262862
1262822
|
jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
|
|
1262863
1262823
|
const relativeFilePath = this.toRelativeFilepath(filePath);
|
|
1262864
|
-
const contents = (await (0,
|
|
1262824
|
+
const contents = (await (0, import_promises35.readFile)(filePath)).toString();
|
|
1262865
1262825
|
return [relativeFilePath, contents];
|
|
1262866
1262826
|
})));
|
|
1262867
1262827
|
}
|
|
@@ -1263692,7 +1263652,7 @@ var makeCounterPromise = () => {
|
|
|
1263692
1263652
|
};
|
|
1263693
1263653
|
|
|
1263694
1263654
|
// ../../../node_modules/.pnpm/tiny-readdir@2.7.2/node_modules/tiny-readdir/dist/index.js
|
|
1263695
|
-
var
|
|
1263655
|
+
var readdir3 = (rootPath, options2) => {
|
|
1263696
1263656
|
const followSymlinks = (options2 == null ? void 0 : options2.followSymlinks) ?? false;
|
|
1263697
1263657
|
const maxDepth = (options2 == null ? void 0 : options2.depth) ?? Infinity;
|
|
1263698
1263658
|
const maxPaths = (options2 == null ? void 0 : options2.limit) ?? Infinity;
|
|
@@ -1263858,7 +1263818,7 @@ var readdir5 = (rootPath, options2) => {
|
|
|
1263858
1263818
|
};
|
|
1263859
1263819
|
return getResult(rootPath);
|
|
1263860
1263820
|
};
|
|
1263861
|
-
var dist_default3 =
|
|
1263821
|
+
var dist_default3 = readdir3;
|
|
1263862
1263822
|
|
|
1263863
1263823
|
// ../../../node_modules/.pnpm/watcher@2.3.1/node_modules/watcher/dist/utils.js
|
|
1263864
1263824
|
var Utils = {
|
|
@@ -1264938,10 +1264898,10 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
1264938
1264898
|
// ../docs-preview/lib/downloadLocalDocsBundle.js
|
|
1264939
1264899
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
1264940
1264900
|
var import_fs7 = require("fs");
|
|
1264941
|
-
var
|
|
1264901
|
+
var import_promises36 = require("fs/promises");
|
|
1264942
1264902
|
var import_os4 = require("os");
|
|
1264943
1264903
|
var import_path29 = __toESM(require("path"), 1);
|
|
1264944
|
-
var
|
|
1264904
|
+
var import_promises37 = require("stream/promises");
|
|
1264945
1264905
|
var import_tmp_promise5 = __toESM(require_tmp_promise(), 1);
|
|
1264946
1264906
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
1264947
1264907
|
var ETAG_FILENAME = "etag";
|
|
@@ -1264972,7 +1264932,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1264972
1264932
|
let currentETag = void 0;
|
|
1264973
1264933
|
if (currentETagExists) {
|
|
1264974
1264934
|
logger.debug("Reading existing ETag");
|
|
1264975
|
-
currentETag = (await (0,
|
|
1264935
|
+
currentETag = (await (0, import_promises36.readFile)(eTagFilepath)).toString();
|
|
1264976
1264936
|
}
|
|
1264977
1264937
|
if (currentETag != null && currentETag === eTag) {
|
|
1264978
1264938
|
logger.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -1264994,18 +1264954,18 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1264994
1264954
|
type: "failure"
|
|
1264995
1264955
|
};
|
|
1264996
1264956
|
}
|
|
1264997
|
-
await (0,
|
|
1264957
|
+
await (0, import_promises37.pipeline)(contents, (0, import_fs7.createWriteStream)(outputZipPath));
|
|
1264998
1264958
|
logger.debug(`Wrote output.zip to ${outputZipPath}`);
|
|
1264999
1264959
|
const absolutePathToPreviewFolder = getPathToPreviewFolder();
|
|
1265000
1264960
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1265001
|
-
await (0,
|
|
1264961
|
+
await (0, import_promises36.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1265002
1264962
|
}
|
|
1265003
|
-
await (0,
|
|
1264963
|
+
await (0, import_promises36.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
1265004
1264964
|
logger.debug(`rm -rf ${absolutePathToPreviewFolder}`);
|
|
1265005
1264965
|
const absolutePathToBundleFolder = getPathToBundleFolder();
|
|
1265006
|
-
await (0,
|
|
1264966
|
+
await (0, import_promises36.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
1265007
1264967
|
await (0, import_decompress.default)(outputZipPath, absolutePathToBundleFolder);
|
|
1265008
|
-
await (0,
|
|
1264968
|
+
await (0, import_promises36.writeFile)(eTagFilepath, eTag);
|
|
1265009
1264969
|
logger.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
1265010
1264970
|
return {
|
|
1265011
1264971
|
type: "success"
|
|
@@ -1308607,7 +1308567,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
|
|
|
1308607
1308567
|
}
|
|
1308608
1308568
|
|
|
1308609
1308569
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileAst.js
|
|
1308610
|
-
var
|
|
1308570
|
+
var import_promises38 = require("fs/promises");
|
|
1308611
1308571
|
var import_path33 = __toESM(require("path"), 1);
|
|
1308612
1308572
|
async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToConfiguration, absolutePathToFernFolder, context, loadAPIWorkspace2) {
|
|
1308613
1308573
|
var _a6, _b4, _c4, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
@@ -1308808,7 +1308768,7 @@ async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToC
|
|
|
1308808
1308768
|
willBeUploaded: false
|
|
1308809
1308769
|
});
|
|
1308810
1308770
|
const absoluteFilepath = resolve(dirname(absoluteFilepathToConfiguration), version3.path);
|
|
1308811
|
-
const content3 = js_yaml_default.load((await (0,
|
|
1308771
|
+
const content3 = js_yaml_default.load((await (0, import_promises38.readFile)(absoluteFilepath)).toString());
|
|
1308812
1308772
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1308813
1308773
|
await ((_a7 = visitor.versionFile) == null ? void 0 : _a7.call(visitor, {
|
|
1308814
1308774
|
path: version3.path,
|
|
@@ -1308879,7 +1308839,7 @@ async function visitNavigationItem({ navigationItem, visitor, nodePath, absolute
|
|
|
1308879
1308839
|
});
|
|
1308880
1308840
|
const absoluteFilepath = resolve(dirname(absoluteFilepathToConfiguration), navigationItem.path);
|
|
1308881
1308841
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1308882
|
-
const content3 = (await (0,
|
|
1308842
|
+
const content3 = (await (0, import_promises38.readFile)(absoluteFilepath)).toString();
|
|
1308883
1308843
|
await ((_a6 = visitor.markdownPage) == null ? void 0 : _a6.call(visitor, {
|
|
1308884
1308844
|
title: navigationItem.page,
|
|
1308885
1308845
|
content: content3,
|
|
@@ -1311308,7 +1311268,7 @@ var supportedExtensions = new Set(extensions);
|
|
|
1311308
1311268
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
1311309
1311269
|
|
|
1311310
1311270
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
1311311
|
-
var
|
|
1311271
|
+
var import_promises39 = require("fs/promises");
|
|
1311312
1311272
|
var import_path34 = __toESM(require("path"), 1);
|
|
1311313
1311273
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
1311314
1311274
|
"image/jpeg",
|
|
@@ -1311385,7 +1311345,7 @@ var ValidFileTypes = {
|
|
|
1311385
1311345
|
}
|
|
1311386
1311346
|
};
|
|
1311387
1311347
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
1311388
|
-
const file = await (0,
|
|
1311348
|
+
const file = await (0, import_promises39.readFile)(absoluteFilepath);
|
|
1311389
1311349
|
const fileType = await fileTypeFromBuffer(file);
|
|
1311390
1311350
|
if (fileType != null) {
|
|
1311391
1311351
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -1311586,7 +1311546,7 @@ async function formatWorkspaces({
|
|
|
1311586
1311546
|
}
|
|
1311587
1311547
|
|
|
1311588
1311548
|
// src/commands/generate-fdr/generateFdrApiDefinitionForWorkspaces.ts
|
|
1311589
|
-
var
|
|
1311549
|
+
var import_promises40 = require("fs/promises");
|
|
1311590
1311550
|
var import_path35 = __toESM(require("path"), 1);
|
|
1311591
1311551
|
|
|
1311592
1311552
|
// src/commands/generate-ir/generateIrForFernWorkspace.ts
|
|
@@ -1311641,7 +1311601,7 @@ async function generateFdrApiDefinitionForWorkspaces({
|
|
|
1311641
1311601
|
snippetsConfig: {}
|
|
1311642
1311602
|
});
|
|
1311643
1311603
|
const resolvedOutputFilePath = import_path35.default.resolve(outputFilepath);
|
|
1311644
|
-
await (0,
|
|
1311604
|
+
await (0, import_promises40.writeFile)(resolvedOutputFilePath, await stringifyLargeObject(apiDefinition, { pretty: true }));
|
|
1311645
1311605
|
context.logger.info(`Wrote FDR API definition to ${resolvedOutputFilePath}`);
|
|
1311646
1311606
|
});
|
|
1311647
1311607
|
})
|
|
@@ -1322024,10 +1321984,10 @@ var IntermediateRepresentationMigratorBuilderImpl = class {
|
|
|
1322024
1321984
|
constructor(migrations) {
|
|
1322025
1321985
|
this.migrations = migrations;
|
|
1322026
1321986
|
}
|
|
1322027
|
-
withMigration(
|
|
1321987
|
+
withMigration(migration17) {
|
|
1322028
1321988
|
return new BuildaleIntermediateRepresentationMigratorBuilderImpl([
|
|
1322029
1321989
|
...this.migrations,
|
|
1322030
|
-
|
|
1321990
|
+
migration17
|
|
1322031
1321991
|
]);
|
|
1322032
1321992
|
}
|
|
1322033
1321993
|
};
|
|
@@ -1322044,14 +1322004,14 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
1322044
1322004
|
migrateForGenerator({ intermediateRepresentation, context, targetGenerator }) {
|
|
1322045
1322005
|
return this.migrate({
|
|
1322046
1322006
|
intermediateRepresentation,
|
|
1322047
|
-
shouldMigrate: (
|
|
1322007
|
+
shouldMigrate: (migration17) => this.shouldRunMigration({ migration: migration17, targetGenerator }),
|
|
1322048
1322008
|
context,
|
|
1322049
1322009
|
targetGenerator
|
|
1322050
1322010
|
});
|
|
1322051
1322011
|
}
|
|
1322052
|
-
migrateThroughMigration({ migration:
|
|
1322012
|
+
migrateThroughMigration({ migration: migration17, intermediateRepresentation, context, targetGenerator }) {
|
|
1322053
1322013
|
return this.migrateThroughVersion({
|
|
1322054
|
-
version:
|
|
1322014
|
+
version: migration17.earlierVersion,
|
|
1322055
1322015
|
intermediateRepresentation,
|
|
1322056
1322016
|
context,
|
|
1322057
1322017
|
targetGenerator
|
|
@@ -1322091,24 +1322051,24 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
1322091
1322051
|
unrecognizedObjectKeys: "strip"
|
|
1322092
1322052
|
});
|
|
1322093
1322053
|
};
|
|
1322094
|
-
for (const
|
|
1322095
|
-
if (!shouldMigrate(
|
|
1322054
|
+
for (const migration17 of this.migrations) {
|
|
1322055
|
+
if (!shouldMigrate(migration17)) {
|
|
1322096
1322056
|
break;
|
|
1322097
1322057
|
}
|
|
1322098
|
-
context.logger.debug(`Migrating IR from ${
|
|
1322099
|
-
migrated =
|
|
1322058
|
+
context.logger.debug(`Migrating IR from ${migration17.laterVersion} to ${migration17.earlierVersion}`);
|
|
1322059
|
+
migrated = migration17.migrateBackwards(migrated, {
|
|
1322100
1322060
|
taskContext: context,
|
|
1322101
1322061
|
targetGenerator
|
|
1322102
1322062
|
});
|
|
1322103
|
-
jsonify = () => Promise.resolve().then(() =>
|
|
1322063
|
+
jsonify = () => Promise.resolve().then(() => migration17.jsonifyEarlierVersion(migrated));
|
|
1322104
1322064
|
}
|
|
1322105
1322065
|
return {
|
|
1322106
1322066
|
ir: migrated,
|
|
1322107
1322067
|
jsonify
|
|
1322108
1322068
|
};
|
|
1322109
1322069
|
}
|
|
1322110
|
-
shouldRunMigration({ migration:
|
|
1322111
|
-
const minVersionToExclude =
|
|
1322070
|
+
shouldRunMigration({ migration: migration17, targetGenerator }) {
|
|
1322071
|
+
const minVersionToExclude = migration17.firstGeneratorVersionToConsumeNewIR[targetGenerator.name];
|
|
1322112
1322072
|
if (minVersionToExclude == null) {
|
|
1322113
1322073
|
throw new Error(`Cannot migrate intermediate representation. Unrecognized generator: ${targetGenerator.name}. If leveraging a custom generator, ensure you are specifying "ir-version" within the generator configuration.`);
|
|
1322114
1322074
|
}
|
|
@@ -1322116,7 +1322076,7 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
1322116
1322076
|
case GeneratorWasNeverUpdatedToConsumeNewIR:
|
|
1322117
1322077
|
return true;
|
|
1322118
1322078
|
case GeneratorWasNotCreatedYet:
|
|
1322119
|
-
throw new Error(`Cannot migrate intermediate representation. Generator was created after intermediate representation ${
|
|
1322079
|
+
throw new Error(`Cannot migrate intermediate representation. Generator was created after intermediate representation ${migration17.laterVersion}.`);
|
|
1322120
1322080
|
}
|
|
1322121
1322081
|
return isVersionAhead(minVersionToExclude, targetGenerator.version);
|
|
1322122
1322082
|
}
|
|
@@ -1322156,7 +1322116,7 @@ function migrateIntermediateRepresentationThroughVersion({ intermediateRepresent
|
|
|
1322156
1322116
|
}
|
|
1322157
1322117
|
|
|
1322158
1322118
|
// src/commands/generate-ir/generateIrForWorkspaces.ts
|
|
1322159
|
-
var
|
|
1322119
|
+
var import_promises41 = require("fs/promises");
|
|
1322160
1322120
|
var import_path36 = __toESM(require("path"), 1);
|
|
1322161
1322121
|
async function generateIrForWorkspaces({
|
|
1322162
1322122
|
project,
|
|
@@ -1322186,7 +1322146,7 @@ async function generateIrForWorkspaces({
|
|
|
1322186
1322146
|
readme
|
|
1322187
1322147
|
});
|
|
1322188
1322148
|
const irOutputFilePath = import_path36.default.resolve(irFilepath);
|
|
1322189
|
-
await (0,
|
|
1322149
|
+
await (0, import_promises41.writeFile)(
|
|
1322190
1322150
|
irOutputFilePath,
|
|
1322191
1322151
|
await stringifyLargeObject(intermediateRepresentation, { pretty: true })
|
|
1322192
1322152
|
);
|
|
@@ -1322229,7 +1322189,7 @@ async function getIntermediateRepresentation({
|
|
|
1322229
1322189
|
}
|
|
1322230
1322190
|
|
|
1322231
1322191
|
// src/commands/generate-openapi-ir/generateOpenAPIIrForWorkspaces.ts
|
|
1322232
|
-
var
|
|
1322192
|
+
var import_promises42 = require("fs/promises");
|
|
1322233
1322193
|
var import_path37 = __toESM(require("path"), 1);
|
|
1322234
1322194
|
async function generateOpenAPIIrForWorkspaces({
|
|
1322235
1322195
|
project,
|
|
@@ -1322254,7 +1322214,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1322254
1322214
|
const openApiIrJson = await serialization_exports3.OpenApiIntermediateRepresentation.jsonOrThrow(openAPIIr, {
|
|
1322255
1322215
|
skipValidation: true
|
|
1322256
1322216
|
});
|
|
1322257
|
-
await (0,
|
|
1322217
|
+
await (0, import_promises42.writeFile)(irOutputFilePath, await stringifyLargeObject(openApiIrJson, { pretty: true }));
|
|
1322258
1322218
|
context.logger.info(`Wrote IR to ${irOutputFilePath}`);
|
|
1322259
1322219
|
});
|
|
1322260
1322220
|
})
|
|
@@ -1322262,7 +1322222,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1322262
1322222
|
}
|
|
1322263
1322223
|
|
|
1322264
1322224
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
1322265
|
-
var
|
|
1322225
|
+
var import_promises43 = require("fs/promises");
|
|
1322266
1322226
|
async function writeOverridesForWorkspaces({
|
|
1322267
1322227
|
project,
|
|
1322268
1322228
|
includeModels,
|
|
@@ -1322287,7 +1322247,7 @@ async function writeOverridesForWorkspaces({
|
|
|
1322287
1322247
|
async function readExistingOverrides(overridesFilepath, context) {
|
|
1322288
1322248
|
let parsedOverrides = null;
|
|
1322289
1322249
|
try {
|
|
1322290
|
-
const contents = (await (0,
|
|
1322250
|
+
const contents = (await (0, import_promises43.readFile)(overridesFilepath, "utf8")).toString();
|
|
1322291
1322251
|
try {
|
|
1322292
1322252
|
parsedOverrides = JSON.parse(contents);
|
|
1322293
1322253
|
} catch (err) {
|
|
@@ -1322345,7 +1322305,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
1322345
1322305
|
}
|
|
1322346
1322306
|
}
|
|
1322347
1322307
|
const components = { schemas };
|
|
1322348
|
-
await (0,
|
|
1322308
|
+
await (0, import_promises43.writeFile)(
|
|
1322349
1322309
|
join(dirname(spec.absoluteFilepath), RelativeFilePath.of("openapi-overrides.yml")),
|
|
1322350
1322310
|
js_yaml_default.dump({ paths, components })
|
|
1322351
1322311
|
);
|
|
@@ -1322618,7 +1322578,7 @@ async function getIntermediateRepresentation2({ workspace, audiences, generatorI
|
|
|
1322618
1322578
|
|
|
1322619
1322579
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
1322620
1322580
|
var import_dockerode = __toESM(require_docker(), 1);
|
|
1322621
|
-
var
|
|
1322581
|
+
var import_promises44 = require("fs/promises");
|
|
1322622
1322582
|
var import_stream3 = require("stream");
|
|
1322623
1322583
|
var import_tmp_promise6 = __toESM(require_tmp_promise(), 1);
|
|
1322624
1322584
|
async function runDocker({ imageName, args, binds, writeLogsToFile = true, removeAfterCompletion = false }) {
|
|
@@ -1322657,7 +1322617,7 @@ async function tryRunDocker({ docker, imageName, args, binds, removeAfterComplet
|
|
|
1322657
1322617
|
if (status.StatusCode !== 0) {
|
|
1322658
1322618
|
if (writeLogsToFile) {
|
|
1322659
1322619
|
const tmpFile = await import_tmp_promise6.default.file();
|
|
1322660
|
-
await (0,
|
|
1322620
|
+
await (0, import_promises44.writeFile)(tmpFile.path, logs);
|
|
1322661
1322621
|
throw new Error(`Docker exited with a non-zero exit code. Logs here: ${tmpFile.path}`);
|
|
1322662
1322622
|
} else {
|
|
1322663
1322623
|
throw new Error("Docker exited with a non-zero exit code.");
|
|
@@ -1322679,12 +1322639,12 @@ async function pullImage(docker, imageName) {
|
|
|
1322679
1322639
|
|
|
1322680
1322640
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
1322681
1322641
|
var FernGeneratorExecParsing = __toESM(require_serialization35(), 1);
|
|
1322682
|
-
var
|
|
1322642
|
+
var import_promises46 = require("fs/promises");
|
|
1322683
1322643
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
1322684
1322644
|
|
|
1322685
1322645
|
// ../generation/local-generation/local-workspace-runner/lib/LocalTaskHandler.js
|
|
1322686
1322646
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
1322687
|
-
var
|
|
1322647
|
+
var import_promises45 = require("fs/promises");
|
|
1322688
1322648
|
var import_tmp_promise7 = __toESM(require_tmp_promise(), 1);
|
|
1322689
1322649
|
var LocalTaskHandler = class {
|
|
1322690
1322650
|
context;
|
|
@@ -1322730,7 +1322690,7 @@ var LocalTaskHandler = class {
|
|
|
1322730
1322690
|
const tmpOutputResolutionDir = AbsoluteFilePath.of((await import_tmp_promise7.default.dir({})).path);
|
|
1322731
1322691
|
const absolutePathToFernignore = AbsoluteFilePath.of(join(this.absolutePathToLocalOutput, RelativeFilePath.of(FERNIGNORE_FILENAME)));
|
|
1322732
1322692
|
const fernIngnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
1322733
|
-
await (0,
|
|
1322693
|
+
await (0, import_promises45.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
1322734
1322694
|
await this.runGitCommand(["init"], tmpOutputResolutionDir);
|
|
1322735
1322695
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
1322736
1322696
|
const response = await this.runGitCommand(["config", "--list"], tmpOutputResolutionDir);
|
|
@@ -1322743,16 +1322703,16 @@ var LocalTaskHandler = class {
|
|
|
1322743
1322703
|
await this.copyGeneratedFilesToDirectory(tmpOutputResolutionDir);
|
|
1322744
1322704
|
await this.runGitCommand(["reset", "--", ...fernIngnorePaths], tmpOutputResolutionDir);
|
|
1322745
1322705
|
await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
1322746
|
-
await (0,
|
|
1322747
|
-
await (0,
|
|
1322706
|
+
await (0, import_promises45.rmdir)(this.absolutePathToLocalOutput, { recursive: true });
|
|
1322707
|
+
await (0, import_promises45.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
1322748
1322708
|
}
|
|
1322749
1322709
|
async copyGeneratedFilesNoFernIgnore() {
|
|
1322750
1322710
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
1322751
|
-
await (0,
|
|
1322711
|
+
await (0, import_promises45.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
1322752
1322712
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
1322753
1322713
|
}
|
|
1322754
1322714
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
1322755
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
1322715
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises45.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
1322756
1322716
|
if (firstLocalOutputItem == null) {
|
|
1322757
1322717
|
return;
|
|
1322758
1322718
|
}
|
|
@@ -1322760,15 +1322720,15 @@ var LocalTaskHandler = class {
|
|
|
1322760
1322720
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
1322761
1322721
|
await (0, import_decompress2.default)(join(this.absolutePathToTmpOutputDirectory, RelativeFilePath.of(firstLocalOutputItem)), outputPath);
|
|
1322762
1322722
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
1322763
|
-
await (0,
|
|
1322723
|
+
await (0, import_promises45.cp)(join(this.absolutePathToTmpOutputDirectory, RelativeFilePath.of(localOutputItem)), join(outputPath, RelativeFilePath.of(localOutputItem)), { recursive: true });
|
|
1322764
1322724
|
}
|
|
1322765
1322725
|
} else {
|
|
1322766
|
-
await (0,
|
|
1322726
|
+
await (0, import_promises45.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
1322767
1322727
|
}
|
|
1322768
1322728
|
}
|
|
1322769
1322729
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
1322770
1322730
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
1322771
|
-
await (0,
|
|
1322731
|
+
await (0, import_promises45.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
1322772
1322732
|
}
|
|
1322773
1322733
|
async runGitCommand(options2, cwd2) {
|
|
1322774
1322734
|
const response = await loggingExeca(this.context.logger, "git", options2, {
|
|
@@ -1322780,7 +1322740,7 @@ var LocalTaskHandler = class {
|
|
|
1322780
1322740
|
};
|
|
1322781
1322741
|
var NEW_LINE_REGEX = /\r?\n/;
|
|
1322782
1322742
|
async function getFernIgnorePaths({ absolutePathToFernignore }) {
|
|
1322783
|
-
const fernIgnoreFileContents = (await (0,
|
|
1322743
|
+
const fernIgnoreFileContents = (await (0, import_promises45.readFile)(absolutePathToFernignore)).toString();
|
|
1322784
1322744
|
return [
|
|
1322785
1322745
|
FERNIGNORE_FILENAME,
|
|
1322786
1322746
|
...fernIgnoreFileContents.trim().split(NEW_LINE_REGEX).filter((line) => !line.startsWith("#") && line.length > 0)
|
|
@@ -1322873,7 +1322833,7 @@ async function writeIrToFile({ workspace, audiences, generatorInvocation, worksp
|
|
|
1322873
1322833
|
tmpdir: workspaceTempDir.path
|
|
1322874
1322834
|
});
|
|
1322875
1322835
|
const absolutePathToIr = AbsoluteFilePath.of(irFile.path);
|
|
1322876
|
-
await (0,
|
|
1322836
|
+
await (0, import_promises46.writeFile)(absolutePathToIr, JSON.stringify(intermediateRepresentation, void 0, 4));
|
|
1322877
1322837
|
context.logger.debug(`Wrote IR to ${absolutePathToIr}`);
|
|
1322878
1322838
|
return absolutePathToIr;
|
|
1322879
1322839
|
}
|
|
@@ -1322905,7 +1322865,7 @@ async function runGenerator({ workspaceName, organization, outputVersion, absolu
|
|
|
1322905
1322865
|
if (!parsedConfig.ok) {
|
|
1322906
1322866
|
throw new Error(`Failed to parse config.json into ${absolutePathToWriteConfigJson}`);
|
|
1322907
1322867
|
}
|
|
1322908
|
-
await (0,
|
|
1322868
|
+
await (0, import_promises46.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(parsedConfig.value, void 0, 4));
|
|
1322909
1322869
|
const doesConfigJsonExist = await waitUntilPathExists(absolutePathToWriteConfigJson, 5e3);
|
|
1322910
1322870
|
if (!doesConfigJsonExist) {
|
|
1322911
1322871
|
throw new Error(`Failed to create ${absolutePathToWriteConfigJson}`);
|
|
@@ -1322990,8 +1322950,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
|
|
|
1322990
1322950
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
1322991
1322951
|
var import_axios5 = __toESM(require_axios4(), 1);
|
|
1322992
1322952
|
var import_fs8 = require("fs");
|
|
1322993
|
-
var
|
|
1322994
|
-
var
|
|
1322953
|
+
var import_promises47 = require("fs/promises");
|
|
1322954
|
+
var import_promises48 = require("stream/promises");
|
|
1322995
1322955
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context }) {
|
|
1322996
1322956
|
try {
|
|
1322997
1322957
|
await downloadFileForTask({
|
|
@@ -1323008,17 +1322968,17 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
1323008
1322968
|
responseType: "stream"
|
|
1323009
1322969
|
});
|
|
1323010
1322970
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1323011
|
-
await (0,
|
|
1322971
|
+
await (0, import_promises47.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1323012
1322972
|
}
|
|
1323013
|
-
await (0,
|
|
1323014
|
-
await (0,
|
|
1322973
|
+
await (0, import_promises47.mkdir)(dirname(absolutePathToLocalOutput), { recursive: true });
|
|
1322974
|
+
await (0, import_promises48.pipeline)(request.data, (0, import_fs8.createWriteStream)(absolutePathToLocalOutput));
|
|
1323015
1322975
|
}
|
|
1323016
1322976
|
|
|
1323017
1322977
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
1323018
1322978
|
var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
1323019
1322979
|
var import_axios6 = __toESM(require_axios4(), 1);
|
|
1323020
1322980
|
var import_form_data2 = __toESM(require_form_data(), 1);
|
|
1323021
|
-
var
|
|
1322981
|
+
var import_promises49 = require("fs/promises");
|
|
1323022
1322982
|
var import_path40 = require("path");
|
|
1323023
1322983
|
var import_tar2 = __toESM(require_tar(), 1);
|
|
1323024
1322984
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
@@ -1323039,7 +1322999,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
1323039
1322999
|
return job;
|
|
1323040
1323000
|
}
|
|
1323041
1323001
|
async function createJob({ projectConfig, workspace, organization, generatorInvocation, version: version3, context, shouldLogS3Url, token, whitelabel, absolutePathToPreview }) {
|
|
1323042
|
-
const
|
|
1323002
|
+
const remoteGenerationService = createFiddleService({ token: token.value });
|
|
1323043
1323003
|
const generatorConfig = {
|
|
1323044
1323004
|
id: generatorInvocation.name,
|
|
1323045
1323005
|
version: generatorInvocation.version,
|
|
@@ -1323047,10 +1323007,6 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1323047
1323007
|
customConfig: generatorInvocation.config,
|
|
1323048
1323008
|
publishMetadata: generatorInvocation.publishMetadata
|
|
1323049
1323009
|
};
|
|
1323050
|
-
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, { onError: (e) => context.failAndThrow(e) }, { substituteAsEmpty: isPreview });
|
|
1323051
|
-
const generatorConfigsWithEnvVarSubstitutions = substituteEnvVars(generatorConfig);
|
|
1323052
|
-
const whitelabelWithEnvVarSubstiutions = whitelabel != null ? substituteEnvVars(whitelabel) : void 0;
|
|
1323053
|
-
const remoteGenerationService = createFiddleService({ token: token.value });
|
|
1323054
1323010
|
let fernDefinitionMetadata;
|
|
1323055
1323011
|
if (generatorInvocation.outputMode.type.startsWith("github")) {
|
|
1323056
1323012
|
try {
|
|
@@ -1323059,23 +1323015,23 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1323059
1323015
|
context.logger.debug(`Writing mock fern definition to ${absolutePathToTmpDir}`);
|
|
1323060
1323016
|
const absolutePathToTmpFernDirectory = join(absolutePathToTmpDir, RelativeFilePath.of(FERN_DIRECTORY));
|
|
1323061
1323017
|
const absolutePathToTmpDefinitionDirectory = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(DEFINITION_DIRECTORY));
|
|
1323062
|
-
await (0,
|
|
1323018
|
+
await (0, import_promises49.mkdir)(absolutePathToTmpDefinitionDirectory, { recursive: true });
|
|
1323063
1323019
|
const absolutePathToApiYml = join(absolutePathToTmpDefinitionDirectory, RelativeFilePath.of(ROOT_API_FILENAME));
|
|
1323064
|
-
await (0,
|
|
1323020
|
+
await (0, import_promises49.writeFile)(absolutePathToApiYml, js_yaml_default.dump(workspace.definition.rootApiFile.contents));
|
|
1323065
1323021
|
await writeFernDefinition({
|
|
1323066
1323022
|
absolutePathToDefinitionDirectory: absolutePathToTmpDefinitionDirectory,
|
|
1323067
1323023
|
definition: workspace.definition
|
|
1323068
1323024
|
});
|
|
1323069
1323025
|
const absolutePathToFernConfigJson = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(PROJECT_CONFIG_FILENAME));
|
|
1323070
|
-
await (0,
|
|
1323026
|
+
await (0, import_promises49.writeFile)(absolutePathToFernConfigJson, JSON.stringify(projectConfig.rawConfig, void 0, 2));
|
|
1323071
1323027
|
try {
|
|
1323072
1323028
|
const sources = workspace.getSources();
|
|
1323073
1323029
|
for (const source of sources) {
|
|
1323074
|
-
const sourceContents = await (0,
|
|
1323030
|
+
const sourceContents = await (0, import_promises49.readFile)(source.absoluteFilePath);
|
|
1323075
1323031
|
const relativeLocation = (0, import_path40.relative)(workspace.absoluteFilepath, source.absoluteFilePath);
|
|
1323076
1323032
|
const absolutePathToSourceFile = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(relativeLocation));
|
|
1323077
|
-
await (0,
|
|
1323078
|
-
await (0,
|
|
1323033
|
+
await (0, import_promises49.mkdir)(dirname(absolutePathToSourceFile), { recursive: true });
|
|
1323034
|
+
await (0, import_promises49.writeFile)(absolutePathToSourceFile, sourceContents);
|
|
1323079
1323035
|
}
|
|
1323080
1323036
|
} catch (error) {
|
|
1323081
1323037
|
context.logger.debug(`Failed to write source files to disk, continuing: ${error}`);
|
|
@@ -1323098,7 +1323054,7 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1323098
1323054
|
}
|
|
1323099
1323055
|
} else {
|
|
1323100
1323056
|
context.logger.debug("Uploading definition...");
|
|
1323101
|
-
await import_axios6.default.put(definitionUploadUrlRequest.body.s3Url, await (0,
|
|
1323057
|
+
await import_axios6.default.put(definitionUploadUrlRequest.body.s3Url, await (0, import_promises49.readFile)(tarPath));
|
|
1323102
1323058
|
fernDefinitionMetadata = {
|
|
1323103
1323059
|
definitionS3DownloadUrl: definitionUploadUrlRequest.body.s3Url,
|
|
1323104
1323060
|
outputPath: ".mock",
|
|
@@ -1323113,14 +1323069,14 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1323113
1323069
|
apiName: workspace.definition.rootApiFile.contents.name,
|
|
1323114
1323070
|
version: version3,
|
|
1323115
1323071
|
organizationName: organization,
|
|
1323116
|
-
generators: [
|
|
1323072
|
+
generators: [generatorConfig],
|
|
1323117
1323073
|
uploadToS3: shouldUploadToS3({
|
|
1323118
1323074
|
outputMode: generatorInvocation.outputMode,
|
|
1323119
1323075
|
generatorInvocation,
|
|
1323120
1323076
|
absolutePathToPreview,
|
|
1323121
1323077
|
shouldLogS3Url
|
|
1323122
1323078
|
}),
|
|
1323123
|
-
whitelabel
|
|
1323079
|
+
whitelabel,
|
|
1323124
1323080
|
fernDefinitionMetadata,
|
|
1323125
1323081
|
preview: absolutePathToPreview != null
|
|
1323126
1323082
|
});
|
|
@@ -1323160,14 +1323116,14 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1323160
1323116
|
async function writeFernDefinition({ absolutePathToDefinitionDirectory, definition: definition3 }) {
|
|
1323161
1323117
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
1323162
1323118
|
const absolutePathToDefinitionFile = join(absolutePathToDefinitionDirectory, RelativeFilePath.of(relativePath));
|
|
1323163
|
-
await (0,
|
|
1323164
|
-
await (0,
|
|
1323119
|
+
await (0, import_promises49.mkdir)(dirname(absolutePathToDefinitionFile), { recursive: true });
|
|
1323120
|
+
await (0, import_promises49.writeFile)(absolutePathToDefinitionFile, js_yaml_default.dump(definitionFile.contents));
|
|
1323165
1323121
|
}
|
|
1323166
1323122
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
1323167
1323123
|
if (packageMarker.contents.export == null) {
|
|
1323168
1323124
|
const absolutePathToPackageMarker = join(absolutePathToDefinitionDirectory, RelativeFilePath.of(relativePath));
|
|
1323169
|
-
await (0,
|
|
1323170
|
-
await (0,
|
|
1323125
|
+
await (0, import_promises49.mkdir)(dirname(absolutePathToPackageMarker), { recursive: true });
|
|
1323126
|
+
await (0, import_promises49.writeFile)(absolutePathToPackageMarker, js_yaml_default.dump(packageMarker.contents));
|
|
1323171
1323127
|
}
|
|
1323172
1323128
|
}
|
|
1323173
1323129
|
for (const [relativePath, importedDefinition] of Object.entries(definition3.importedDefinitions)) {
|
|
@@ -1323283,9 +1323239,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context }) {
|
|
|
1323283
1323239
|
var import_axios7 = __toESM(require_axios4(), 1);
|
|
1323284
1323240
|
var import_decompress3 = __toESM(require_decompress(), 1);
|
|
1323285
1323241
|
var import_fs9 = require("fs");
|
|
1323286
|
-
var
|
|
1323242
|
+
var import_promises50 = require("fs/promises");
|
|
1323287
1323243
|
var import_path41 = __toESM(require("path"), 1);
|
|
1323288
|
-
var
|
|
1323244
|
+
var import_promises51 = require("stream/promises");
|
|
1323289
1323245
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
1323290
1323246
|
var _isFinished, _createdSnippets, _snippetsS3PreSignedReadUrl;
|
|
1323291
1323247
|
var RemoteTaskHandler = class {
|
|
@@ -1323401,11 +1323357,11 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1323401
1323357
|
});
|
|
1323402
1323358
|
const tmpDir = await import_tmp_promise11.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1323403
1323359
|
const outputZipPath = import_path41.default.join(tmpDir.path, "output.zip");
|
|
1323404
|
-
await (0,
|
|
1323360
|
+
await (0, import_promises51.pipeline)(request.data, (0, import_fs9.createWriteStream)(outputZipPath));
|
|
1323405
1323361
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1323406
|
-
await (0,
|
|
1323362
|
+
await (0, import_promises50.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1323407
1323363
|
}
|
|
1323408
|
-
await (0,
|
|
1323364
|
+
await (0, import_promises50.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
1323409
1323365
|
await (0, import_decompress3.default)(outputZipPath, absolutePathToLocalOutput);
|
|
1323410
1323366
|
}
|
|
1323411
1323367
|
function convertLogLevel(logLevel) {
|
|
@@ -1323424,7 +1323380,7 @@ function convertLogLevel(logLevel) {
|
|
|
1323424
1323380
|
}
|
|
1323425
1323381
|
|
|
1323426
1323382
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
1323427
|
-
var
|
|
1323383
|
+
var import_promises52 = require("fs/promises");
|
|
1323428
1323384
|
var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
|
|
1323429
1323385
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
1323430
1323386
|
var SourceUploader = class {
|
|
@@ -1323445,7 +1323401,7 @@ var SourceUploader = class {
|
|
|
1323445
1323401
|
}
|
|
1323446
1323402
|
async uploadSource(source, uploadURL) {
|
|
1323447
1323403
|
const uploadCommand = await this.getUploadCommand(source);
|
|
1323448
|
-
const fileData = await (0,
|
|
1323404
|
+
const fileData = await (0, import_promises52.readFile)(uploadCommand.absoluteFilePath);
|
|
1323449
1323405
|
const response = await fetch(uploadURL, {
|
|
1323450
1323406
|
method: "PUT",
|
|
1323451
1323407
|
body: fileData,
|
|
@@ -1323465,7 +1323421,7 @@ var SourceUploader = class {
|
|
|
1323465
1323421
|
absoluteFilePath,
|
|
1323466
1323422
|
cleanup: async () => {
|
|
1323467
1323423
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
1323468
|
-
await (0,
|
|
1323424
|
+
await (0, import_promises52.unlink)(absoluteFilePath);
|
|
1323469
1323425
|
}
|
|
1323470
1323426
|
};
|
|
1323471
1323427
|
}
|
|
@@ -1323556,20 +1323512,23 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
1323556
1323512
|
interactiveTaskContext.logger.debug("Setting IR source configuration ...");
|
|
1323557
1323513
|
ir.sourceConfig = sourceConfig;
|
|
1323558
1323514
|
}
|
|
1323515
|
+
const isPreview = absolutePathToPreview != null;
|
|
1323516
|
+
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, { onError: (e) => interactiveTaskContext.failAndThrow(e) }, { substituteAsEmpty: isPreview });
|
|
1323517
|
+
const generatorInvocationWithEnvVarSubstitutions = substituteEnvVars(generatorInvocation);
|
|
1323559
1323518
|
const job = await createAndStartJob({
|
|
1323560
1323519
|
projectConfig,
|
|
1323561
1323520
|
workspace,
|
|
1323562
1323521
|
organization,
|
|
1323563
|
-
generatorInvocation,
|
|
1323522
|
+
generatorInvocation: generatorInvocationWithEnvVarSubstitutions,
|
|
1323564
1323523
|
context: interactiveTaskContext,
|
|
1323565
1323524
|
version: version3,
|
|
1323566
1323525
|
intermediateRepresentation: {
|
|
1323567
1323526
|
...ir,
|
|
1323568
|
-
publishConfig: getPublishConfig({ generatorInvocation })
|
|
1323527
|
+
publishConfig: getPublishConfig({ generatorInvocation: generatorInvocationWithEnvVarSubstitutions })
|
|
1323569
1323528
|
},
|
|
1323570
1323529
|
shouldLogS3Url,
|
|
1323571
1323530
|
token,
|
|
1323572
|
-
whitelabel,
|
|
1323531
|
+
whitelabel: whitelabel != null ? substituteEnvVars(whitelabel) : void 0,
|
|
1323573
1323532
|
irVersionOverride,
|
|
1323574
1323533
|
absolutePathToPreview
|
|
1323575
1323534
|
});
|
|
@@ -1323741,7 +1323700,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
1323741
1323700
|
|
|
1323742
1323701
|
// ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
|
|
1323743
1323702
|
var import_axios8 = __toESM(require_axios4(), 1);
|
|
1323744
|
-
var
|
|
1323703
|
+
var import_promises53 = require("fs/promises");
|
|
1323745
1323704
|
var mime = __toESM(require_mime_types(), 1);
|
|
1323746
1323705
|
|
|
1323747
1323706
|
// ../generation/remote-generation/remote-workspace-runner/lib/measureImageSizes.js
|
|
@@ -1323896,7 +1323855,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context, batchSize)
|
|
|
1323896
1323855
|
const absoluteFilePath = resolve(docsWorkspacePath, relativeFilePath);
|
|
1323897
1323856
|
try {
|
|
1323898
1323857
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
1323899
|
-
await import_axios8.default.put(uploadUrl, await (0,
|
|
1323858
|
+
await import_axios8.default.put(uploadUrl, await (0, import_promises53.readFile)(absoluteFilePath), {
|
|
1323900
1323859
|
headers: {
|
|
1323901
1323860
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType
|
|
1323902
1323861
|
}
|
|
@@ -1324516,7 +1324475,7 @@ async function mockServer({
|
|
|
1324516
1324475
|
// src/commands/register/registerWorkspacesV1.ts
|
|
1324517
1324476
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
1324518
1324477
|
var import_axios9 = __toESM(require_axios4(), 1);
|
|
1324519
|
-
var
|
|
1324478
|
+
var import_promises54 = require("fs/promises");
|
|
1324520
1324479
|
var import_path42 = __toESM(require("path"), 1);
|
|
1324521
1324480
|
var import_tar3 = __toESM(require_tar(), 1);
|
|
1324522
1324481
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
@@ -1324566,7 +1324525,7 @@ async function registerWorkspacesV1({
|
|
|
1324566
1324525
|
context.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
1324567
1324526
|
await import_tar3.default.create({ file: tarPath, cwd: resolvedWorkspace.absoluteFilepath }, ["."]);
|
|
1324568
1324527
|
context.logger.info("Uploading definition...");
|
|
1324569
|
-
await import_axios9.default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
1324528
|
+
await import_axios9.default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises54.readFile)(tarPath));
|
|
1324570
1324529
|
context.logger.info(
|
|
1324571
1324530
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
1324572
1324531
|
);
|
|
@@ -1324693,20 +1324652,20 @@ async function generateToken({
|
|
|
1324693
1324652
|
|
|
1324694
1324653
|
// src/commands/upgrade/updateApiSpec.ts
|
|
1324695
1324654
|
var fs7 = __toESM(require("fs"), 1);
|
|
1324696
|
-
var
|
|
1324655
|
+
var import_promises55 = require("fs/promises");
|
|
1324697
1324656
|
var import_stream4 = require("stream");
|
|
1324698
|
-
var
|
|
1324657
|
+
var import_promises56 = require("stream/promises");
|
|
1324699
1324658
|
async function fetchAndWriteFile(url, path45, logger) {
|
|
1324700
1324659
|
const resp = await fetch(url);
|
|
1324701
1324660
|
if (resp.ok && resp.body) {
|
|
1324702
1324661
|
logger.debug("Origin successfully fetched, writing to file");
|
|
1324703
1324662
|
const fileStream = fs7.createWriteStream(path45);
|
|
1324704
|
-
await (0,
|
|
1324705
|
-
const fileContents = await (0,
|
|
1324663
|
+
await (0, import_promises56.finished)(import_stream4.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
1324664
|
+
const fileContents = await (0, import_promises55.readFile)(path45, "utf8");
|
|
1324706
1324665
|
try {
|
|
1324707
|
-
await (0,
|
|
1324666
|
+
await (0, import_promises55.writeFile)(path45, JSON.stringify(JSON.parse(fileContents), void 0, 2), "utf8");
|
|
1324708
1324667
|
} catch (e) {
|
|
1324709
|
-
await (0,
|
|
1324668
|
+
await (0, import_promises55.writeFile)(path45, js_yaml_default.dump(js_yaml_default.load(fileContents)), "utf8");
|
|
1324710
1324669
|
}
|
|
1324711
1324670
|
logger.debug("File written successfully");
|
|
1324712
1324671
|
}
|
|
@@ -1324794,7 +1324753,7 @@ async function updateApiSpec({
|
|
|
1324794
1324753
|
}
|
|
1324795
1324754
|
|
|
1324796
1324755
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
1324797
|
-
var
|
|
1324756
|
+
var import_promises57 = require("fs/promises");
|
|
1324798
1324757
|
|
|
1324799
1324758
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
1324800
1324759
|
var import_glob_promise2 = __toESM(require_lib(), 1);
|
|
@@ -1324828,7 +1324787,7 @@ var migration = {
|
|
|
1324828
1324787
|
try {
|
|
1324829
1324788
|
const fileContents = await getFileContents(yamlFilepath);
|
|
1324830
1324789
|
const newContents = addDiscriminantToFile(fileContents);
|
|
1324831
|
-
await (0,
|
|
1324790
|
+
await (0, import_promises57.writeFile)(yamlFilepath, newContents);
|
|
1324832
1324791
|
} catch (error) {
|
|
1324833
1324792
|
context.failAndThrow("Failed to migrate " + yamlFilepath, error);
|
|
1324834
1324793
|
}
|
|
@@ -1324836,7 +1324795,7 @@ var migration = {
|
|
|
1324836
1324795
|
}
|
|
1324837
1324796
|
};
|
|
1324838
1324797
|
async function getFileContents(filepath) {
|
|
1324839
|
-
const buffer = await (0,
|
|
1324798
|
+
const buffer = await (0, import_promises57.readFile)(filepath);
|
|
1324840
1324799
|
return buffer.toString();
|
|
1324841
1324800
|
}
|
|
1324842
1324801
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -1324865,7 +1324824,7 @@ var versionMigrations = {
|
|
|
1324865
1324824
|
var __default = versionMigrations;
|
|
1324866
1324825
|
|
|
1324867
1324826
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
1324868
|
-
var
|
|
1324827
|
+
var import_promises58 = require("fs/promises");
|
|
1324869
1324828
|
var import_yaml3 = __toESM(require_dist5(), 1);
|
|
1324870
1324829
|
|
|
1324871
1324830
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -1324906,7 +1324865,7 @@ var migration2 = {
|
|
|
1324906
1324865
|
}
|
|
1324907
1324866
|
};
|
|
1324908
1324867
|
async function migrateFile(filepath, context) {
|
|
1324909
|
-
const contents = await (0,
|
|
1324868
|
+
const contents = await (0, import_promises58.readFile)(filepath);
|
|
1324910
1324869
|
const parsedDocument = import_yaml3.default.parseDocument(contents.toString());
|
|
1324911
1324870
|
const types3 = parsedDocument.get("types");
|
|
1324912
1324871
|
if (types3 == null) {
|
|
@@ -1324938,7 +1324897,7 @@ async function migrateFile(filepath, context) {
|
|
|
1324938
1324897
|
}
|
|
1324939
1324898
|
}
|
|
1324940
1324899
|
}
|
|
1324941
|
-
await (0,
|
|
1324900
|
+
await (0, import_promises58.writeFile)(filepath, parsedDocument.toString());
|
|
1324942
1324901
|
}
|
|
1324943
1324902
|
|
|
1324944
1324903
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -1324949,7 +1324908,7 @@ var versionMigrations2 = {
|
|
|
1324949
1324908
|
var __default2 = versionMigrations2;
|
|
1324950
1324909
|
|
|
1324951
1324910
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
1324952
|
-
var
|
|
1324911
|
+
var import_promises59 = require("fs/promises");
|
|
1324953
1324912
|
var import_yaml4 = __toESM(require_dist5(), 1);
|
|
1324954
1324913
|
|
|
1324955
1324914
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -1324990,7 +1324949,7 @@ var migration3 = {
|
|
|
1324990
1324949
|
}
|
|
1324991
1324950
|
};
|
|
1324992
1324951
|
async function migrateGeneratorsYml(filepath, context) {
|
|
1324993
|
-
const contents = await (0,
|
|
1324952
|
+
const contents = await (0, import_promises59.readFile)(filepath);
|
|
1324994
1324953
|
const parsedDocument = import_yaml4.default.parseDocument(contents.toString());
|
|
1324995
1324954
|
const draftGenerators = parsedDocument.get("draft");
|
|
1324996
1324955
|
if (draftGenerators == null) {
|
|
@@ -1325017,7 +1324976,7 @@ async function migrateGeneratorsYml(filepath, context) {
|
|
|
1325017
1324976
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
1325018
1324977
|
}
|
|
1325019
1324978
|
});
|
|
1325020
|
-
await (0,
|
|
1324979
|
+
await (0, import_promises59.writeFile)(filepath, parsedDocument.toString());
|
|
1325021
1324980
|
}
|
|
1325022
1324981
|
|
|
1325023
1324982
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -1325028,7 +1324987,7 @@ var versionMigrations3 = {
|
|
|
1325028
1324987
|
var __default3 = versionMigrations3;
|
|
1325029
1324988
|
|
|
1325030
1324989
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
1325031
|
-
var
|
|
1324990
|
+
var import_promises60 = require("fs/promises");
|
|
1325032
1324991
|
var import_yaml5 = __toESM(require_dist5(), 1);
|
|
1325033
1324992
|
|
|
1325034
1324993
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -1325069,7 +1325028,7 @@ var migration4 = {
|
|
|
1325069
1325028
|
}
|
|
1325070
1325029
|
};
|
|
1325071
1325030
|
async function migrateFile2(filepath, context) {
|
|
1325072
|
-
const contents = await (0,
|
|
1325031
|
+
const contents = await (0, import_promises60.readFile)(filepath);
|
|
1325073
1325032
|
const parsedDocument = import_yaml5.default.parseDocument(contents.toString());
|
|
1325074
1325033
|
const addType = (typeName, typeDeclaration) => {
|
|
1325075
1325034
|
const types3 = parsedDocument.get("types");
|
|
@@ -1325113,7 +1325072,7 @@ async function migrateFile2(filepath, context) {
|
|
|
1325113
1325072
|
}
|
|
1325114
1325073
|
}
|
|
1325115
1325074
|
}
|
|
1325116
|
-
await (0,
|
|
1325075
|
+
await (0, import_promises60.writeFile)(filepath, parsedDocument.toString());
|
|
1325117
1325076
|
}
|
|
1325118
1325077
|
|
|
1325119
1325078
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -1325124,7 +1325083,7 @@ var versionMigrations4 = {
|
|
|
1325124
1325083
|
var __default4 = versionMigrations4;
|
|
1325125
1325084
|
|
|
1325126
1325085
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
1325127
|
-
var
|
|
1325086
|
+
var import_promises61 = require("fs/promises");
|
|
1325128
1325087
|
var import_yaml6 = __toESM(require_dist5(), 1);
|
|
1325129
1325088
|
|
|
1325130
1325089
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -1325165,7 +1325124,7 @@ var migration5 = {
|
|
|
1325165
1325124
|
}
|
|
1325166
1325125
|
};
|
|
1325167
1325126
|
async function migrateGeneratorsYml2(filepath, context) {
|
|
1325168
|
-
const contents = await (0,
|
|
1325127
|
+
const contents = await (0, import_promises61.readFile)(filepath);
|
|
1325169
1325128
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
1325170
1325129
|
const releaseGenerators = parsedDocument.get("release");
|
|
1325171
1325130
|
if (releaseGenerators == null) {
|
|
@@ -1325203,7 +1325162,7 @@ async function migrateGeneratorsYml2(filepath, context) {
|
|
|
1325203
1325162
|
}
|
|
1325204
1325163
|
releaseGenerator.delete("outputs");
|
|
1325205
1325164
|
});
|
|
1325206
|
-
await (0,
|
|
1325165
|
+
await (0, import_promises61.writeFile)(filepath, parsedDocument.toString());
|
|
1325207
1325166
|
}
|
|
1325208
1325167
|
|
|
1325209
1325168
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -1325214,7 +1325173,7 @@ var versionMigrations5 = {
|
|
|
1325214
1325173
|
var __default5 = versionMigrations5;
|
|
1325215
1325174
|
|
|
1325216
1325175
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
1325217
|
-
var
|
|
1325176
|
+
var import_promises62 = require("fs/promises");
|
|
1325218
1325177
|
|
|
1325219
1325178
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
1325220
1325179
|
var import_glob_promise7 = __toESM(require_lib(), 1);
|
|
@@ -1325245,9 +1325204,9 @@ var migration6 = {
|
|
|
1325245
1325204
|
run: async ({ context }) => {
|
|
1325246
1325205
|
const yamlFiles = await getAllYamlFiles4(context);
|
|
1325247
1325206
|
for (const filepath of yamlFiles) {
|
|
1325248
|
-
const contents = await (0,
|
|
1325207
|
+
const contents = await (0, import_promises62.readFile)(filepath);
|
|
1325249
1325208
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
1325250
|
-
await (0,
|
|
1325209
|
+
await (0, import_promises62.writeFile)(filepath, newContents);
|
|
1325251
1325210
|
}
|
|
1325252
1325211
|
}
|
|
1325253
1325212
|
};
|
|
@@ -1325260,7 +1325219,7 @@ var versionMigrations6 = {
|
|
|
1325260
1325219
|
var __default6 = versionMigrations6;
|
|
1325261
1325220
|
|
|
1325262
1325221
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
1325263
|
-
var
|
|
1325222
|
+
var import_promises63 = require("fs/promises");
|
|
1325264
1325223
|
|
|
1325265
1325224
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
1325266
1325225
|
var import_glob_promise8 = __toESM(require_lib(), 1);
|
|
@@ -1325291,9 +1325250,9 @@ var migration7 = {
|
|
|
1325291
1325250
|
run: async ({ context }) => {
|
|
1325292
1325251
|
const yamlFiles = await getAllRootApiYamlFiles(context);
|
|
1325293
1325252
|
for (const filepath of yamlFiles) {
|
|
1325294
|
-
const contents = await (0,
|
|
1325253
|
+
const contents = await (0, import_promises63.readFile)(filepath);
|
|
1325295
1325254
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
1325296
|
-
await (0,
|
|
1325255
|
+
await (0, import_promises63.writeFile)(filepath, newContents);
|
|
1325297
1325256
|
}
|
|
1325298
1325257
|
}
|
|
1325299
1325258
|
};
|
|
@@ -1325306,7 +1325265,7 @@ var versionMigrations7 = {
|
|
|
1325306
1325265
|
var __default7 = versionMigrations7;
|
|
1325307
1325266
|
|
|
1325308
1325267
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
1325309
|
-
var
|
|
1325268
|
+
var import_promises64 = require("fs/promises");
|
|
1325310
1325269
|
|
|
1325311
1325270
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
1325312
1325271
|
var import_glob_promise9 = __toESM(require_lib(), 1);
|
|
@@ -1325413,7 +1325372,7 @@ var migration8 = {
|
|
|
1325413
1325372
|
}
|
|
1325414
1325373
|
};
|
|
1325415
1325374
|
async function migrateGeneratorsYml3(filepath) {
|
|
1325416
|
-
const contentsStr = await (0,
|
|
1325375
|
+
const contentsStr = await (0, import_promises64.readFile)(filepath);
|
|
1325417
1325376
|
const contents = js_yaml_default.load(contentsStr.toString());
|
|
1325418
1325377
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
1325419
1325378
|
let newGeneratorsConfiguration = {};
|
|
@@ -1325431,7 +1325390,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
1325431
1325390
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
1325432
1325391
|
};
|
|
1325433
1325392
|
}
|
|
1325434
|
-
await (0,
|
|
1325393
|
+
await (0, import_promises64.writeFile)(filepath, js_yaml_default.dump(newGeneratorsConfiguration));
|
|
1325435
1325394
|
}
|
|
1325436
1325395
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
1325437
1325396
|
const newSchema = {
|
|
@@ -1325506,7 +1325465,7 @@ var versionMigrations8 = {
|
|
|
1325506
1325465
|
var __default8 = versionMigrations8;
|
|
1325507
1325466
|
|
|
1325508
1325467
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
1325509
|
-
var
|
|
1325468
|
+
var import_promises65 = require("fs/promises");
|
|
1325510
1325469
|
var import_yaml7 = __toESM(require_dist5(), 1);
|
|
1325511
1325470
|
|
|
1325512
1325471
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -1325547,7 +1325506,7 @@ var migration9 = {
|
|
|
1325547
1325506
|
}
|
|
1325548
1325507
|
};
|
|
1325549
1325508
|
async function migrateRootApiFile(filepath) {
|
|
1325550
|
-
const contents = await (0,
|
|
1325509
|
+
const contents = await (0, import_promises65.readFile)(filepath);
|
|
1325551
1325510
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
1325552
1325511
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
1325553
1325512
|
if (errorDiscriminant == null || !import_yaml7.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -1325558,7 +1325517,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
1325558
1325517
|
"property-name": errorDiscriminant.value
|
|
1325559
1325518
|
});
|
|
1325560
1325519
|
parsedDocument.delete("error-discriminant");
|
|
1325561
|
-
await (0,
|
|
1325520
|
+
await (0, import_promises65.writeFile)(filepath, parsedDocument.toString());
|
|
1325562
1325521
|
}
|
|
1325563
1325522
|
|
|
1325564
1325523
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -1325569,7 +1325528,7 @@ var versionMigrations9 = {
|
|
|
1325569
1325528
|
var __default9 = versionMigrations9;
|
|
1325570
1325529
|
|
|
1325571
1325530
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
1325572
|
-
var
|
|
1325531
|
+
var import_promises66 = require("fs/promises");
|
|
1325573
1325532
|
var import_yaml8 = __toESM(require_dist5(), 1);
|
|
1325574
1325533
|
|
|
1325575
1325534
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -1325610,7 +1325569,7 @@ var migration10 = {
|
|
|
1325610
1325569
|
}
|
|
1325611
1325570
|
};
|
|
1325612
1325571
|
async function migrateYamlFile(filepath, context) {
|
|
1325613
|
-
const contents = await (0,
|
|
1325572
|
+
const contents = await (0, import_promises66.readFile)(filepath);
|
|
1325614
1325573
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
1325615
1325574
|
const services = parsedDocument.get("services");
|
|
1325616
1325575
|
if (services == null) {
|
|
@@ -1325650,7 +1325609,7 @@ async function migrateYamlFile(filepath, context) {
|
|
|
1325650
1325609
|
context.failWithoutThrowing("Failed to convert endpoint", e);
|
|
1325651
1325610
|
}
|
|
1325652
1325611
|
}
|
|
1325653
|
-
await (0,
|
|
1325612
|
+
await (0, import_promises66.writeFile)(filepath, parsedDocument.toString());
|
|
1325654
1325613
|
}
|
|
1325655
1325614
|
}
|
|
1325656
1325615
|
function convertEndpoint18({ document: document4, endpoint }) {
|
|
@@ -1325734,10 +1325693,10 @@ var import_legacy_docs_config = __toESM(require_legacy_docs_config(), 1);
|
|
|
1325734
1325693
|
var LegacyDocsSerializers = __toESM(require_serialization36(), 1);
|
|
1325735
1325694
|
|
|
1325736
1325695
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
1325737
|
-
var
|
|
1325696
|
+
var import_promises67 = require("fs/promises");
|
|
1325738
1325697
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
1325739
1325698
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1325740
|
-
const contentsStr = await (0,
|
|
1325699
|
+
const contentsStr = await (0, import_promises67.readFile)(filepath);
|
|
1325741
1325700
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
1325742
1325701
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
1325743
1325702
|
if (result.ok) {
|
|
@@ -1325755,7 +1325714,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
1325755
1325714
|
}
|
|
1325756
1325715
|
|
|
1325757
1325716
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
1325758
|
-
var
|
|
1325717
|
+
var import_promises69 = require("fs/promises");
|
|
1325759
1325718
|
|
|
1325760
1325719
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
1325761
1325720
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -1325936,10 +1325895,10 @@ __export(legacy_exports, {
|
|
|
1325936
1325895
|
});
|
|
1325937
1325896
|
|
|
1325938
1325897
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
1325939
|
-
var
|
|
1325898
|
+
var import_promises68 = require("fs/promises");
|
|
1325940
1325899
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
1325941
1325900
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1325942
|
-
const contentsStr = await (0,
|
|
1325901
|
+
const contentsStr = await (0, import_promises68.readFile)(filepath);
|
|
1325943
1325902
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
1325944
1325903
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
1325945
1325904
|
if (result.success) {
|
|
@@ -1325969,7 +1325928,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
1325969
1325928
|
var APIS_DIRECTORY2 = "apis";
|
|
1325970
1325929
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
1325971
1325930
|
const absolutePathToApisDirectory = join(absolutePathToFernDirectory, RelativeFilePath.of(APIS_DIRECTORY2));
|
|
1325972
|
-
await (0,
|
|
1325931
|
+
await (0, import_promises69.mkdir)(absolutePathToApisDirectory);
|
|
1325973
1325932
|
for (const workspace of workspaces) {
|
|
1325974
1325933
|
const absolutePathToWorkspace = join(absolutePathToFernDirectory, RelativeFilePath.of(workspace));
|
|
1325975
1325934
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -1325977,11 +1325936,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
1325977
1325936
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
1325978
1325937
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1325979
1325938
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1325980
|
-
await (0,
|
|
1325939
|
+
await (0, import_promises69.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1325981
1325940
|
}
|
|
1325982
1325941
|
const absolutePathToNestedWorkspace = join(absolutePathToApisDirectory, RelativeFilePath.of(workspace));
|
|
1325983
1325942
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1325984
|
-
await (0,
|
|
1325943
|
+
await (0, import_promises69.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1325985
1325944
|
}
|
|
1325986
1325945
|
}
|
|
1325987
1325946
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -1325994,7 +1325953,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
1325994
1325953
|
generatorsConfiguration,
|
|
1325995
1325954
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1325996
1325955
|
});
|
|
1325997
|
-
await (0,
|
|
1325956
|
+
await (0, import_promises69.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1325998
1325957
|
return convertedResponse.docsURLs;
|
|
1325999
1325958
|
}
|
|
1326000
1325959
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -1326008,19 +1325967,19 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
1326008
1325967
|
apiName
|
|
1326009
1325968
|
});
|
|
1326010
1325969
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1326011
|
-
await (0,
|
|
1325970
|
+
await (0, import_promises69.writeFile)(absolutePathToDocsConfig, js_yaml_default.dump(convertedDocsConfig));
|
|
1326012
1325971
|
}
|
|
1326013
1325972
|
|
|
1326014
1325973
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
1326015
|
-
var
|
|
1325974
|
+
var import_promises70 = require("fs/promises");
|
|
1326016
1325975
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1326017
1325976
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
1326018
1325977
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
1326019
1325978
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1326020
1325979
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1326021
1325980
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1326022
|
-
await (0,
|
|
1326023
|
-
await (0,
|
|
1325981
|
+
await (0, import_promises70.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1325982
|
+
await (0, import_promises70.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1326024
1325983
|
}
|
|
1326025
1325984
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
1326026
1325985
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1326033,7 +1325992,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
1326033
1325992
|
apiName: void 0
|
|
1326034
1325993
|
});
|
|
1326035
1325994
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1326036
|
-
await (0,
|
|
1325995
|
+
await (0, import_promises70.writeFile)(absolutePathToDocsConfig, js_yaml_default.dump(convertedDocsConfig));
|
|
1326037
1325996
|
}
|
|
1326038
1325997
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
1326039
1325998
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1326045,22 +1326004,22 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
1326045
1326004
|
generatorsConfiguration,
|
|
1326046
1326005
|
pathModificationStrategy: "MoveUp"
|
|
1326047
1326006
|
});
|
|
1326048
|
-
await (0,
|
|
1326007
|
+
await (0, import_promises70.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1326049
1326008
|
return convertedResponse.docsURLs;
|
|
1326050
1326009
|
}
|
|
1326051
1326010
|
|
|
1326052
1326011
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
1326053
|
-
var
|
|
1326012
|
+
var import_promises71 = require("fs/promises");
|
|
1326054
1326013
|
var APIS_DIRECTORY3 = "apis";
|
|
1326055
1326014
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
1326056
1326015
|
const absolutePathToApisDirectory = join(absolutePathToFernDirectory, RelativeFilePath.of(APIS_DIRECTORY3));
|
|
1326057
|
-
await (0,
|
|
1326016
|
+
await (0, import_promises71.mkdir)(absolutePathToApisDirectory);
|
|
1326058
1326017
|
for (const workspace of workspaces) {
|
|
1326059
1326018
|
const absolutePathToWorkspace = join(absolutePathToFernDirectory, RelativeFilePath.of(workspace));
|
|
1326060
1326019
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
1326061
1326020
|
const absolutePathToNestedWorkspace = join(absolutePathToApisDirectory, RelativeFilePath.of(workspace));
|
|
1326062
1326021
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1326063
|
-
await (0,
|
|
1326022
|
+
await (0, import_promises71.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1326064
1326023
|
}
|
|
1326065
1326024
|
}
|
|
1326066
1326025
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -1326073,15 +1326032,15 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
1326073
1326032
|
generatorsConfiguration,
|
|
1326074
1326033
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1326075
1326034
|
});
|
|
1326076
|
-
await (0,
|
|
1326035
|
+
await (0, import_promises71.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1326077
1326036
|
}
|
|
1326078
1326037
|
|
|
1326079
1326038
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
1326080
|
-
var
|
|
1326039
|
+
var import_promises72 = require("fs/promises");
|
|
1326081
1326040
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1326082
1326041
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
1326083
1326042
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1326084
|
-
await (0,
|
|
1326043
|
+
await (0, import_promises72.rmdir)(absolutePathToWorkspace, { recursive: true });
|
|
1326085
1326044
|
}
|
|
1326086
1326045
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
1326087
1326046
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1326093,7 +1326052,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
1326093
1326052
|
generatorsConfiguration,
|
|
1326094
1326053
|
pathModificationStrategy: "MoveUp"
|
|
1326095
1326054
|
});
|
|
1326096
|
-
await (0,
|
|
1326055
|
+
await (0, import_promises72.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1326097
1326056
|
}
|
|
1326098
1326057
|
|
|
1326099
1326058
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -1326170,7 +1326129,7 @@ var versionMigrations11 = {
|
|
|
1326170
1326129
|
var __default11 = versionMigrations11;
|
|
1326171
1326130
|
|
|
1326172
1326131
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
1326173
|
-
var
|
|
1326132
|
+
var import_promises73 = require("fs/promises");
|
|
1326174
1326133
|
var import_yaml9 = __toESM(require_dist5(), 1);
|
|
1326175
1326134
|
|
|
1326176
1326135
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -1326211,7 +1326170,7 @@ var migration12 = {
|
|
|
1326211
1326170
|
}
|
|
1326212
1326171
|
};
|
|
1326213
1326172
|
async function migrateYamlFile2(filepath, context) {
|
|
1326214
|
-
const contents = await (0,
|
|
1326173
|
+
const contents = await (0, import_promises73.readFile)(filepath);
|
|
1326215
1326174
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
1326216
1326175
|
const types3 = parsedDocument.get("types");
|
|
1326217
1326176
|
if (types3 == null) {
|
|
@@ -1326237,7 +1326196,7 @@ async function migrateYamlFile2(filepath, context) {
|
|
|
1326237
1326196
|
examples.set(i2, { value });
|
|
1326238
1326197
|
}
|
|
1326239
1326198
|
}
|
|
1326240
|
-
await (0,
|
|
1326199
|
+
await (0, import_promises73.writeFile)(filepath, parsedDocument.toString());
|
|
1326241
1326200
|
}
|
|
1326242
1326201
|
|
|
1326243
1326202
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -1326248,7 +1326207,7 @@ var versionMigrations12 = {
|
|
|
1326248
1326207
|
var __default12 = versionMigrations12;
|
|
1326249
1326208
|
|
|
1326250
1326209
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
1326251
|
-
var
|
|
1326210
|
+
var import_promises74 = require("fs/promises");
|
|
1326252
1326211
|
var import_yaml10 = __toESM(require_dist5(), 1);
|
|
1326253
1326212
|
|
|
1326254
1326213
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -1326289,7 +1326248,7 @@ var migration13 = {
|
|
|
1326289
1326248
|
}
|
|
1326290
1326249
|
};
|
|
1326291
1326250
|
async function migrateYamlFile3(filepath, context) {
|
|
1326292
|
-
const contents = await (0,
|
|
1326251
|
+
const contents = await (0, import_promises74.readFile)(filepath);
|
|
1326293
1326252
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
1326294
1326253
|
if (!import_yaml10.default.isMap(parsedDocument.contents)) {
|
|
1326295
1326254
|
return context.failAndThrow("File is not a map");
|
|
@@ -1326319,7 +1326278,7 @@ async function migrateYamlFile3(filepath, context) {
|
|
|
1326319
1326278
|
pair.value = firstService.value;
|
|
1326320
1326279
|
}
|
|
1326321
1326280
|
}
|
|
1326322
|
-
await (0,
|
|
1326281
|
+
await (0, import_promises74.writeFile)(filepath, parsedDocument.toString());
|
|
1326323
1326282
|
}
|
|
1326324
1326283
|
|
|
1326325
1326284
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -1326330,7 +1326289,7 @@ var versionMigrations13 = {
|
|
|
1326330
1326289
|
var __default13 = versionMigrations13;
|
|
1326331
1326290
|
|
|
1326332
1326291
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
1326333
|
-
var
|
|
1326292
|
+
var import_promises75 = require("fs/promises");
|
|
1326334
1326293
|
var import_yaml11 = __toESM(require_dist5(), 1);
|
|
1326335
1326294
|
|
|
1326336
1326295
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -1326371,7 +1326330,7 @@ var migration14 = {
|
|
|
1326371
1326330
|
}
|
|
1326372
1326331
|
};
|
|
1326373
1326332
|
async function migrateYamlFile4(filepath, context) {
|
|
1326374
|
-
const contents = await (0,
|
|
1326333
|
+
const contents = await (0, import_promises75.readFile)(filepath);
|
|
1326375
1326334
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1326376
1326335
|
if (!import_yaml11.default.isMap(parsedDocument.contents)) {
|
|
1326377
1326336
|
return context.failAndThrow("File is not a map");
|
|
@@ -1326390,7 +1326349,7 @@ async function migrateYamlFile4(filepath, context) {
|
|
|
1326390
1326349
|
}
|
|
1326391
1326350
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
1326392
1326351
|
parsedDocument.contents.items.unshift(docsPair);
|
|
1326393
|
-
await (0,
|
|
1326352
|
+
await (0, import_promises75.writeFile)(filepath, parsedDocument.toString());
|
|
1326394
1326353
|
}
|
|
1326395
1326354
|
|
|
1326396
1326355
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -1326401,7 +1326360,7 @@ var versionMigrations14 = {
|
|
|
1326401
1326360
|
var __default14 = versionMigrations14;
|
|
1326402
1326361
|
|
|
1326403
1326362
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
1326404
|
-
var
|
|
1326363
|
+
var import_promises76 = require("fs/promises");
|
|
1326405
1326364
|
|
|
1326406
1326365
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
1326407
1326366
|
var import_glob_promise15 = __toESM(require_lib(), 1);
|
|
@@ -1326441,14 +1326400,14 @@ var migration15 = {
|
|
|
1326441
1326400
|
}
|
|
1326442
1326401
|
};
|
|
1326443
1326402
|
async function migrateYamlFile5(filepath) {
|
|
1326444
|
-
const contents = await (0,
|
|
1326403
|
+
const contents = await (0, import_promises76.readFile)(filepath);
|
|
1326445
1326404
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
1326446
1326405
|
const regex4 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
1326447
1326406
|
const updatedSnapshot = contents.toString().replace(regex4, (_match, _prefix, domain2) => {
|
|
1326448
1326407
|
return `docs:
|
|
1326449
1326408
|
domain: "${domain2}.${domainSuffix}"`;
|
|
1326450
1326409
|
});
|
|
1326451
|
-
await (0,
|
|
1326410
|
+
await (0, import_promises76.writeFile)(filepath, updatedSnapshot.toString());
|
|
1326452
1326411
|
}
|
|
1326453
1326412
|
|
|
1326454
1326413
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -1326458,6 +1326417,92 @@ var versionMigrations15 = {
|
|
|
1326458
1326417
|
};
|
|
1326459
1326418
|
var __default15 = versionMigrations15;
|
|
1326460
1326419
|
|
|
1326420
|
+
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
1326421
|
+
var import_yaml12 = __toESM(require_dist5(), 1);
|
|
1326422
|
+
var import_promises77 = require("fs/promises");
|
|
1326423
|
+
var migration16 = {
|
|
1326424
|
+
name: "require-generators-yml",
|
|
1326425
|
+
summary: "A generators.yml file is now required if you are using OpenAPI, AsyncAPI, or gRPC.",
|
|
1326426
|
+
run: async ({ context }) => {
|
|
1326427
|
+
const absolutePathToFernDirectory = await getFernDirectory();
|
|
1326428
|
+
if (absolutePathToFernDirectory == null) {
|
|
1326429
|
+
context.failAndThrow("Fern directory not found. Failed to run migration");
|
|
1326430
|
+
return;
|
|
1326431
|
+
}
|
|
1326432
|
+
const { files, directories } = await getFilesAndDirectories(absolutePathToFernDirectory);
|
|
1326433
|
+
const apisDirectory = directories.find((dir) => dir.name === "apis");
|
|
1326434
|
+
if (apisDirectory == null) {
|
|
1326435
|
+
await addApiConfigurationToSingleWorkspace({
|
|
1326436
|
+
context,
|
|
1326437
|
+
files,
|
|
1326438
|
+
directories,
|
|
1326439
|
+
absolutePathToFernDirectory,
|
|
1326440
|
+
absoluteFilepathToWorkspace: absolutePathToFernDirectory
|
|
1326441
|
+
});
|
|
1326442
|
+
} else {
|
|
1326443
|
+
for (const workspace of apisDirectory.contents) {
|
|
1326444
|
+
if (workspace.type !== "directory") {
|
|
1326445
|
+
continue;
|
|
1326446
|
+
}
|
|
1326447
|
+
const absoluteFilepathToWorkspace = join(absolutePathToFernDirectory, RelativeFilePath.of("apis"), RelativeFilePath.of(workspace.name));
|
|
1326448
|
+
await addApiConfigurationToSingleWorkspace({
|
|
1326449
|
+
context,
|
|
1326450
|
+
...await getFilesAndDirectories(join(absoluteFilepathToWorkspace)),
|
|
1326451
|
+
absolutePathToFernDirectory,
|
|
1326452
|
+
absoluteFilepathToWorkspace
|
|
1326453
|
+
});
|
|
1326454
|
+
}
|
|
1326455
|
+
}
|
|
1326456
|
+
}
|
|
1326457
|
+
};
|
|
1326458
|
+
async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirectory, absoluteFilepathToWorkspace, context, files, directories }) {
|
|
1326459
|
+
var _a6, _b4;
|
|
1326460
|
+
const existingGeneratorsYml = files.find((file) => file.name === "generators.yml" || file.name === "generators.yaml");
|
|
1326461
|
+
const openapiDirectory = directories.find((dir) => dir.name === "openapi");
|
|
1326462
|
+
if (existingGeneratorsYml == null) {
|
|
1326463
|
+
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
1326464
|
+
const absolutePathToGeneratorsYml = join(absoluteFilepathToWorkspace, RelativeFilePath.of("generators.yml"));
|
|
1326465
|
+
await (0, import_promises77.writeFile)(absolutePathToGeneratorsYml, js_yaml_default.dump({
|
|
1326466
|
+
api: {
|
|
1326467
|
+
path: join(await relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath.of(openapiDirectory.name), RelativeFilePath.of((_a6 = openapiDirectory.contents[0]) == null ? void 0 : _a6.name))
|
|
1326468
|
+
}
|
|
1326469
|
+
}));
|
|
1326470
|
+
context.logger.info(source_default.green(`Wrote ${absolutePathToGeneratorsYml}`));
|
|
1326471
|
+
}
|
|
1326472
|
+
} else {
|
|
1326473
|
+
const generatorsYmlContents = js_yaml_default.load(existingGeneratorsYml.contents);
|
|
1326474
|
+
if ((generatorsYmlContents == null ? void 0 : generatorsYmlContents.api) != null) {
|
|
1326475
|
+
} else if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
1326476
|
+
const parsedDocument = import_yaml12.default.parseDocument(existingGeneratorsYml.contents);
|
|
1326477
|
+
parsedDocument.set("api", {
|
|
1326478
|
+
path: join(await relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath.of(openapiDirectory.name), RelativeFilePath.of((_b4 = openapiDirectory.contents[0]) == null ? void 0 : _b4.name))
|
|
1326479
|
+
});
|
|
1326480
|
+
await (0, import_promises77.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
1326481
|
+
context.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
1326482
|
+
}
|
|
1326483
|
+
}
|
|
1326484
|
+
}
|
|
1326485
|
+
async function getFilesAndDirectories(absoluteFilepath) {
|
|
1326486
|
+
const contents = await getDirectoryContents(absoluteFilepath);
|
|
1326487
|
+
const files = [];
|
|
1326488
|
+
const directories = [];
|
|
1326489
|
+
for (const fileOrFolder of contents) {
|
|
1326490
|
+
if (fileOrFolder.type === "directory") {
|
|
1326491
|
+
directories.push(fileOrFolder);
|
|
1326492
|
+
} else {
|
|
1326493
|
+
files.push(fileOrFolder);
|
|
1326494
|
+
}
|
|
1326495
|
+
}
|
|
1326496
|
+
return { files, directories };
|
|
1326497
|
+
}
|
|
1326498
|
+
|
|
1326499
|
+
// ../cli-migrations/lib/migrations/0.41.0-rc0/index.js
|
|
1326500
|
+
var versionMigrations16 = {
|
|
1326501
|
+
version: "0.41.0-rc0",
|
|
1326502
|
+
migrations: [migration16]
|
|
1326503
|
+
};
|
|
1326504
|
+
var __default16 = versionMigrations16;
|
|
1326505
|
+
|
|
1326461
1326506
|
// ../cli-migrations/lib/migrations/all.js
|
|
1326462
1326507
|
var ALL_MIGRATIONS = [
|
|
1326463
1326508
|
__default,
|
|
@@ -1326474,7 +1326519,8 @@ var ALL_MIGRATIONS = [
|
|
|
1326474
1326519
|
__default13,
|
|
1326475
1326520
|
__default14,
|
|
1326476
1326521
|
__default15,
|
|
1326477
|
-
__default11
|
|
1326522
|
+
__default11,
|
|
1326523
|
+
__default16
|
|
1326478
1326524
|
];
|
|
1326479
1326525
|
|
|
1326480
1326526
|
// ../cli-migrations/lib/migrations/getMigrationsToRun.js
|
|
@@ -1326500,7 +1326546,7 @@ async function runMigrations({ fromVersion, toVersion, context }) {
|
|
|
1326500
1326546
|
context.logger.debug("No migrations needed.");
|
|
1326501
1326547
|
return;
|
|
1326502
1326548
|
} else {
|
|
1326503
|
-
context.logger.debug("Migrations need to be run:\n" + migrationsToRun.flatMap(({ migrations }) => migrations.map((
|
|
1326549
|
+
context.logger.debug("Migrations need to be run:\n" + migrationsToRun.flatMap(({ migrations }) => migrations.map((migration17) => ` - ${migration17.name}`)).join("\n"));
|
|
1326504
1326550
|
}
|
|
1326505
1326551
|
await context.takeOverTerminal(async () => {
|
|
1326506
1326552
|
const wantsToContinue = await askForConfirmation2(migrationsToRun);
|
|
@@ -1326511,13 +1326557,13 @@ async function runMigrations({ fromVersion, toVersion, context }) {
|
|
|
1326511
1326557
|
if (context.getResult() === TaskResult.Failure) {
|
|
1326512
1326558
|
return;
|
|
1326513
1326559
|
}
|
|
1326514
|
-
const migrationsWithTasks = migrationsToRun.flatMap(({ migrations, version: version3 }) => migrations.map((
|
|
1326515
|
-
migration:
|
|
1326516
|
-
context: context.addInteractiveTask({ name: `${version3} ${
|
|
1326560
|
+
const migrationsWithTasks = migrationsToRun.flatMap(({ migrations, version: version3 }) => migrations.map((migration17) => ({
|
|
1326561
|
+
migration: migration17,
|
|
1326562
|
+
context: context.addInteractiveTask({ name: `${version3} ${migration17.name}` })
|
|
1326517
1326563
|
})));
|
|
1326518
|
-
for (const { migration:
|
|
1326564
|
+
for (const { migration: migration17, context: contextForMigration } of migrationsWithTasks) {
|
|
1326519
1326565
|
const finishableContext = contextForMigration.start();
|
|
1326520
|
-
await
|
|
1326566
|
+
await migration17.run({
|
|
1326521
1326567
|
context: finishableContext
|
|
1326522
1326568
|
});
|
|
1326523
1326569
|
finishableContext.finish();
|
|
@@ -1326531,11 +1326577,11 @@ async function askForConfirmation2(migrationsToRun) {
|
|
|
1326531
1326577
|
const QUESTION_KEY = "wantsToContinue";
|
|
1326532
1326578
|
const lines = ["Some migrations need to be run:"];
|
|
1326533
1326579
|
for (const { migrations } of migrationsToRun) {
|
|
1326534
|
-
for (const
|
|
1326580
|
+
for (const migration17 of migrations) {
|
|
1326535
1326581
|
lines.push(addPrefixToString({
|
|
1326536
1326582
|
prefix: " \u25E6 ",
|
|
1326537
|
-
content: `${
|
|
1326538
|
-
${source_default.dim(
|
|
1326583
|
+
content: `${migration17.name}
|
|
1326584
|
+
${source_default.dim(migration17.summary)}`
|
|
1326539
1326585
|
}));
|
|
1326540
1326586
|
}
|
|
1326541
1326587
|
}
|
|
@@ -1326549,7 +1326595,7 @@ ${source_default.dim(migration16.summary)}`
|
|
|
1326549
1326595
|
}
|
|
1326550
1326596
|
|
|
1326551
1326597
|
// src/commands/upgrade/upgrade.ts
|
|
1326552
|
-
var
|
|
1326598
|
+
var import_promises78 = require("fs/promises");
|
|
1326553
1326599
|
|
|
1326554
1326600
|
// ../../../node_modules/.pnpm/immer@9.0.15/node_modules/immer/dist/immer.esm.mjs
|
|
1326555
1326601
|
function n(n2) {
|
|
@@ -1327038,7 +1327084,7 @@ async function upgrade({
|
|
|
1327038
1327084
|
const newProjectConfig = immer_esm_default(projectConfig.rawConfig, (draft) => {
|
|
1327039
1327085
|
draft.version = fernCliUpgradeInfo.latestVersion;
|
|
1327040
1327086
|
});
|
|
1327041
|
-
await (0,
|
|
1327087
|
+
await (0, import_promises78.writeFile)(projectConfig._absolutePath, JSON.stringify(newProjectConfig, void 0, 2));
|
|
1327042
1327088
|
cliContext.logger.info(
|
|
1327043
1327089
|
`Upgrading from ${source_default.dim(cliContext.environment.packageVersion)} \u2192 ${source_default.green(
|
|
1327044
1327090
|
fernCliUpgradeInfo.latestVersion
|
|
@@ -1327087,7 +1327133,7 @@ async function validateWorkspaces({
|
|
|
1327087
1327133
|
}
|
|
1327088
1327134
|
|
|
1327089
1327135
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
1327090
|
-
var
|
|
1327136
|
+
var import_promises79 = require("fs/promises");
|
|
1327091
1327137
|
var import_path43 = __toESM(require("path"), 1);
|
|
1327092
1327138
|
async function writeDefinitionForWorkspaces({
|
|
1327093
1327139
|
project,
|
|
@@ -1327149,22 +1327195,22 @@ async function writeFernDefinition2({
|
|
|
1327149
1327195
|
absolutePathToOutputDirectory
|
|
1327150
1327196
|
}) {
|
|
1327151
1327197
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
1327152
|
-
await (0,
|
|
1327198
|
+
await (0, import_promises79.rmdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
1327153
1327199
|
}
|
|
1327154
|
-
await (0,
|
|
1327155
|
-
await (0,
|
|
1327200
|
+
await (0, import_promises79.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
1327201
|
+
await (0, import_promises79.writeFile)(
|
|
1327156
1327202
|
join(absolutePathToOutputDirectory, RelativeFilePath.of(ROOT_API_FILENAME)),
|
|
1327157
1327203
|
js_yaml_default.dump(definition3.rootApiFile.contents)
|
|
1327158
1327204
|
);
|
|
1327159
1327205
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
1327160
1327206
|
const absoluteFilepath = join(absolutePathToOutputDirectory, RelativeFilePath.of(relativePath));
|
|
1327161
|
-
await (0,
|
|
1327162
|
-
await (0,
|
|
1327207
|
+
await (0, import_promises79.mkdir)(dirname(absoluteFilepath), { recursive: true });
|
|
1327208
|
+
await (0, import_promises79.writeFile)(absoluteFilepath, js_yaml_default.dump(packageMarker.contents));
|
|
1327163
1327209
|
}
|
|
1327164
1327210
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
1327165
1327211
|
const absoluteFilepath = join(absolutePathToOutputDirectory, RelativeFilePath.of(relativePath));
|
|
1327166
|
-
await (0,
|
|
1327167
|
-
await (0,
|
|
1327212
|
+
await (0, import_promises79.mkdir)(dirname(absoluteFilepath), { recursive: true });
|
|
1327213
|
+
await (0, import_promises79.writeFile)(absoluteFilepath, js_yaml_default.dump(definitionFile.contents));
|
|
1327168
1327214
|
}
|
|
1327169
1327215
|
}
|
|
1327170
1327216
|
|