fern-api 0.39.15 → 0.39.17
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 +483 -482
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1192625,7 +1192625,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1192625
1192625
|
properties: {
|
|
1192626
1192626
|
...event,
|
|
1192627
1192627
|
...event.properties,
|
|
1192628
|
-
version: "0.39.
|
|
1192628
|
+
version: "0.39.17",
|
|
1192629
1192629
|
usingAccessToken: true
|
|
1192630
1192630
|
}
|
|
1192631
1192631
|
});
|
|
@@ -1192687,7 +1192687,7 @@ var UserPosthogManager = class {
|
|
|
1192687
1192687
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1192688
1192688
|
event: "CLI",
|
|
1192689
1192689
|
properties: {
|
|
1192690
|
-
version: "0.39.
|
|
1192690
|
+
version: "0.39.17",
|
|
1192691
1192691
|
...event,
|
|
1192692
1192692
|
...event.properties
|
|
1192693
1192693
|
}
|
|
@@ -1197750,10 +1197750,10 @@ var CliContext = class {
|
|
|
1197750
1197750
|
return "fern-api";
|
|
1197751
1197751
|
}
|
|
1197752
1197752
|
getPackageVersion() {
|
|
1197753
|
-
if ("0.39.
|
|
1197753
|
+
if ("0.39.17" == null) {
|
|
1197754
1197754
|
this.logger.error("CLI_VERSION is not defined");
|
|
1197755
1197755
|
}
|
|
1197756
|
-
return "0.39.
|
|
1197756
|
+
return "0.39.17";
|
|
1197757
1197757
|
}
|
|
1197758
1197758
|
getCliName() {
|
|
1197759
1197759
|
if ("fern" == null) {
|
|
@@ -1223078,6 +1223078,125 @@ async function getOrganziation({
|
|
|
1223078
1223078
|
}
|
|
1223079
1223079
|
}
|
|
1223080
1223080
|
|
|
1223081
|
+
// src/commands/upgrade/upgradeGenerator.ts
|
|
1223082
|
+
var import_promises32 = require("fs/promises");
|
|
1223083
|
+
var import_path27 = __toESM(require("path"), 1);
|
|
1223084
|
+
var semver3 = __toESM(require_semver2(), 1);
|
|
1223085
|
+
var import_yaml = __toESM(require_dist5(), 1);
|
|
1223086
|
+
async function loadAndUpdateGenerators({
|
|
1223087
|
+
absolutePathToWorkspace,
|
|
1223088
|
+
context,
|
|
1223089
|
+
generatorFilter,
|
|
1223090
|
+
groupFilter,
|
|
1223091
|
+
includeMajor
|
|
1223092
|
+
}) {
|
|
1223093
|
+
const filepath = generators_yml_exports.getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1223094
|
+
if (!await doesPathExist(filepath)) {
|
|
1223095
|
+
context.failAndThrow("Generators configuration file was not found, no generators to upgrade.");
|
|
1223096
|
+
return void 0;
|
|
1223097
|
+
}
|
|
1223098
|
+
const contents = await (0, import_promises32.readFile)(filepath);
|
|
1223099
|
+
context.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1223100
|
+
const parsedDocument = import_yaml.default.parseDocument(contents.toString());
|
|
1223101
|
+
const generatorGroups = parsedDocument.get("groups");
|
|
1223102
|
+
if (generatorGroups == null) {
|
|
1223103
|
+
context.failAndThrow("No groups were found within the generators configuration, no generators to upgrade.");
|
|
1223104
|
+
return void 0;
|
|
1223105
|
+
}
|
|
1223106
|
+
if (!import_yaml.default.isMap(generatorGroups)) {
|
|
1223107
|
+
context.failAndThrow(`Expected 'groups' to be a map in ${import_path27.default.relative(process.cwd(), filepath)}`);
|
|
1223108
|
+
return void 0;
|
|
1223109
|
+
}
|
|
1223110
|
+
context.logger.debug(`Groups found: ${generatorGroups.toString()}`);
|
|
1223111
|
+
for (const groupBlock of generatorGroups.items) {
|
|
1223112
|
+
const groupName = groupBlock.key;
|
|
1223113
|
+
const group = groupBlock.value;
|
|
1223114
|
+
if (!import_yaml.default.isMap(group)) {
|
|
1223115
|
+
context.failAndThrow(
|
|
1223116
|
+
`Expected group ${groupName} to be a map in ${import_path27.default.relative(process.cwd(), filepath)}`
|
|
1223117
|
+
);
|
|
1223118
|
+
continue;
|
|
1223119
|
+
}
|
|
1223120
|
+
if (groupFilter != null && group.get("name") !== groupName) {
|
|
1223121
|
+
continue;
|
|
1223122
|
+
}
|
|
1223123
|
+
const generators = group.get("generators");
|
|
1223124
|
+
if (!import_yaml.default.isSeq(generators)) {
|
|
1223125
|
+
context.failAndThrow(
|
|
1223126
|
+
`Expected group ${groupName} to have a 'generators' key in ${import_path27.default.relative(process.cwd(), filepath)}`
|
|
1223127
|
+
);
|
|
1223128
|
+
continue;
|
|
1223129
|
+
}
|
|
1223130
|
+
context.logger.debug(`Generators found: ${generators.toString()}`);
|
|
1223131
|
+
for (const generator of generators.items) {
|
|
1223132
|
+
if (!import_yaml.default.isMap(generator)) {
|
|
1223133
|
+
context.failAndThrow(
|
|
1223134
|
+
`Expected generator in group ${groupName} to be a map in ${import_path27.default.relative(process.cwd(), filepath)}`
|
|
1223135
|
+
);
|
|
1223136
|
+
}
|
|
1223137
|
+
if (generatorFilter != null && generator.get("name") !== generatorFilter) {
|
|
1223138
|
+
continue;
|
|
1223139
|
+
}
|
|
1223140
|
+
const generatorName = generator.get("name");
|
|
1223141
|
+
const normalizedGeneratorName = generators_yml_exports.getGeneratorNameOrThrow(generatorName, context);
|
|
1223142
|
+
const currentVersion = generator.get("version");
|
|
1223143
|
+
const latestVersion2 = await generators_yml_exports.getLatestGeneratorVersion(normalizedGeneratorName, context);
|
|
1223144
|
+
context.logger.debug(`${generatorName}, ${currentVersion}, ${latestVersion2}`);
|
|
1223145
|
+
if (latestVersion2 == null) {
|
|
1223146
|
+
continue;
|
|
1223147
|
+
}
|
|
1223148
|
+
const currentMajor = semver3.major(currentVersion);
|
|
1223149
|
+
const latestMajor = semver3.major(latestVersion2);
|
|
1223150
|
+
if (currentMajor === latestMajor || includeMajor) {
|
|
1223151
|
+
generator.set("version", latestVersion2);
|
|
1223152
|
+
context.logger.info(source_default.green(`${generatorName} has been upgraded to latest in group: ${groupName}`));
|
|
1223153
|
+
}
|
|
1223154
|
+
}
|
|
1223155
|
+
}
|
|
1223156
|
+
return parsedDocument.toString();
|
|
1223157
|
+
}
|
|
1223158
|
+
async function upgradeGenerator2({
|
|
1223159
|
+
cliContext,
|
|
1223160
|
+
generator,
|
|
1223161
|
+
group,
|
|
1223162
|
+
project: { apiWorkspaces },
|
|
1223163
|
+
includeMajor
|
|
1223164
|
+
}) {
|
|
1223165
|
+
await Promise.all(
|
|
1223166
|
+
apiWorkspaces.map(async (workspace) => {
|
|
1223167
|
+
await cliContext.runTaskForWorkspace(workspace, async (context) => {
|
|
1223168
|
+
var _a6;
|
|
1223169
|
+
const generatorsConfiguration = await generators_yml_exports.loadRawGeneratorsConfiguration({
|
|
1223170
|
+
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1223171
|
+
context
|
|
1223172
|
+
}) ?? {};
|
|
1223173
|
+
if (generatorsConfiguration == null || generatorsConfiguration.groups == null) {
|
|
1223174
|
+
context.failAndThrow(
|
|
1223175
|
+
"No groups were found within the generators configuration, no generators to upgrade."
|
|
1223176
|
+
);
|
|
1223177
|
+
return;
|
|
1223178
|
+
}
|
|
1223179
|
+
context.logger.info(`Upgrading generators in workspace: ${workspace.workspaceName}`);
|
|
1223180
|
+
const updatedConfiguration = await loadAndUpdateGenerators({
|
|
1223181
|
+
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1223182
|
+
context,
|
|
1223183
|
+
generatorFilter: generator,
|
|
1223184
|
+
groupFilter: group,
|
|
1223185
|
+
includeMajor
|
|
1223186
|
+
});
|
|
1223187
|
+
if (updatedConfiguration != null) {
|
|
1223188
|
+
await (0, import_promises32.writeFile)(
|
|
1223189
|
+
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1223190
|
+
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1223191
|
+
}),
|
|
1223192
|
+
updatedConfiguration
|
|
1223193
|
+
);
|
|
1223194
|
+
}
|
|
1223195
|
+
});
|
|
1223196
|
+
})
|
|
1223197
|
+
);
|
|
1223198
|
+
}
|
|
1223199
|
+
|
|
1223081
1223200
|
// src/cliV2.ts
|
|
1223082
1223201
|
function addGetOrganizationCommand(cli, cliContext) {
|
|
1223083
1223202
|
cli.command(
|
|
@@ -1223106,55 +1223225,96 @@ function addGetOrganizationCommand(cli, cliContext) {
|
|
|
1223106
1223225
|
}
|
|
1223107
1223226
|
);
|
|
1223108
1223227
|
}
|
|
1223109
|
-
function
|
|
1223110
|
-
cli.command(
|
|
1223111
|
-
|
|
1223112
|
-
|
|
1223113
|
-
|
|
1223114
|
-
|
|
1223115
|
-
|
|
1223116
|
-
|
|
1223117
|
-
|
|
1223118
|
-
|
|
1223119
|
-
|
|
1223120
|
-
|
|
1223121
|
-
|
|
1223122
|
-
|
|
1223123
|
-
|
|
1223124
|
-
|
|
1223125
|
-
|
|
1223126
|
-
|
|
1223127
|
-
|
|
1223128
|
-
|
|
1223129
|
-
|
|
1223130
|
-
|
|
1223131
|
-
|
|
1223132
|
-
|
|
1223133
|
-
|
|
1223134
|
-
|
|
1223135
|
-
|
|
1223136
|
-
|
|
1223228
|
+
function addGeneratorCommands(cli, cliContext) {
|
|
1223229
|
+
cli.command("generator", "Operate on the generators within your Fern configuration", (yargs) => {
|
|
1223230
|
+
yargs.command(
|
|
1223231
|
+
"list",
|
|
1223232
|
+
false,
|
|
1223233
|
+
(yargs2) => yargs2.option("output", {
|
|
1223234
|
+
string: true,
|
|
1223235
|
+
alias: "o",
|
|
1223236
|
+
description: "The location to output the list as a text file, defaults to standard out."
|
|
1223237
|
+
}).option("generators", {
|
|
1223238
|
+
string: true,
|
|
1223239
|
+
type: "array",
|
|
1223240
|
+
description: "The type of generator to include in the list, ex: `fern-typescript-node-sdk`. If omitted, all generators will be listed."
|
|
1223241
|
+
}).option("groups", {
|
|
1223242
|
+
type: "array",
|
|
1223243
|
+
string: true,
|
|
1223244
|
+
description: "The groups to include generators from, if group is not specified, the all generators of the specified type will be listed."
|
|
1223245
|
+
}).option("apis", {
|
|
1223246
|
+
type: "array",
|
|
1223247
|
+
string: true,
|
|
1223248
|
+
description: "The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."
|
|
1223249
|
+
}).option("api-fallback", {
|
|
1223250
|
+
string: true,
|
|
1223251
|
+
description: "The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."
|
|
1223252
|
+
}),
|
|
1223253
|
+
async (argv) => {
|
|
1223254
|
+
cliContext.instrumentPostHogEvent({
|
|
1223255
|
+
command: "fern generator list",
|
|
1223256
|
+
properties: {
|
|
1223257
|
+
outputLocation: argv.output
|
|
1223258
|
+
}
|
|
1223259
|
+
});
|
|
1223260
|
+
await getGeneratorList({
|
|
1223261
|
+
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
1223262
|
+
commandLineApiWorkspace: void 0,
|
|
1223263
|
+
defaultToAllApiWorkspaces: true
|
|
1223264
|
+
}),
|
|
1223265
|
+
generatorFilter: argv.generators ? new Set(argv.generators) : void 0,
|
|
1223266
|
+
groupFilter: argv.groups ? new Set(argv.groups) : void 0,
|
|
1223267
|
+
apiFilter: argv.apis ? new Set(argv.apis) : void 0,
|
|
1223268
|
+
apiKeyFallback: argv.apiFallback,
|
|
1223269
|
+
cliContext,
|
|
1223137
1223270
|
outputLocation: argv.output
|
|
1223138
|
-
}
|
|
1223139
|
-
}
|
|
1223140
|
-
|
|
1223141
|
-
|
|
1223142
|
-
|
|
1223143
|
-
|
|
1223144
|
-
|
|
1223145
|
-
|
|
1223146
|
-
|
|
1223147
|
-
|
|
1223148
|
-
|
|
1223149
|
-
|
|
1223150
|
-
|
|
1223151
|
-
|
|
1223152
|
-
|
|
1223153
|
-
|
|
1223271
|
+
});
|
|
1223272
|
+
}
|
|
1223273
|
+
).command(
|
|
1223274
|
+
"upgrade",
|
|
1223275
|
+
`Upgrades the specified generator in ${GENERATORS_CONFIGURATION_FILENAME} to the latest stable version.`,
|
|
1223276
|
+
(yargs2) => yargs2.option("generator", {
|
|
1223277
|
+
string: true,
|
|
1223278
|
+
description: "The type of generator to upgrade, ex: `fern-typescript-node-sdk`."
|
|
1223279
|
+
}).option("group", {
|
|
1223280
|
+
string: true,
|
|
1223281
|
+
description: "The group in which the generator is located, if group is not specified, the all generators of the specified type will be upgraded."
|
|
1223282
|
+
}).option("api", {
|
|
1223283
|
+
string: true,
|
|
1223284
|
+
description: "The API to upgrade the generator for. If not specified, the generator will be upgraded for all APIs."
|
|
1223285
|
+
}).option("include-major", {
|
|
1223286
|
+
boolean: true,
|
|
1223287
|
+
default: false,
|
|
1223288
|
+
description: "Whether or not to include major versions within the upgrade. Defaults to false, meaning major versions will be skipped."
|
|
1223289
|
+
}),
|
|
1223290
|
+
async (argv) => {
|
|
1223291
|
+
cliContext.instrumentPostHogEvent({
|
|
1223292
|
+
command: "fern generator upgrade",
|
|
1223293
|
+
properties: {
|
|
1223294
|
+
generator: argv.generator,
|
|
1223295
|
+
version: argv.version,
|
|
1223296
|
+
api: argv.api,
|
|
1223297
|
+
group: argv.group,
|
|
1223298
|
+
includeMajor: argv.includeMajor
|
|
1223299
|
+
}
|
|
1223300
|
+
});
|
|
1223301
|
+
await upgradeGenerator2({
|
|
1223302
|
+
cliContext,
|
|
1223303
|
+
generator: argv.generator,
|
|
1223304
|
+
group: argv.group,
|
|
1223305
|
+
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
1223306
|
+
commandLineApiWorkspace: argv.api,
|
|
1223307
|
+
defaultToAllApiWorkspaces: true
|
|
1223308
|
+
}),
|
|
1223309
|
+
includeMajor: argv.includeMajor
|
|
1223310
|
+
});
|
|
1223311
|
+
}
|
|
1223312
|
+
);
|
|
1223313
|
+
});
|
|
1223154
1223314
|
}
|
|
1223155
1223315
|
|
|
1223156
1223316
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
1223157
|
-
var
|
|
1223317
|
+
var import_promises33 = require("fs/promises");
|
|
1223158
1223318
|
async function addGeneratorToWorkspaces({
|
|
1223159
1223319
|
project: { apiWorkspaces },
|
|
1223160
1223320
|
generatorName,
|
|
@@ -1223175,7 +1223335,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1223175
1223335
|
groupName,
|
|
1223176
1223336
|
context
|
|
1223177
1223337
|
});
|
|
1223178
|
-
await (0,
|
|
1223338
|
+
await (0, import_promises33.writeFile)(
|
|
1223179
1223339
|
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1223180
1223340
|
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1223181
1223341
|
}),
|
|
@@ -1232597,10 +1232757,10 @@ function visitFrontmatterImages(data2, keys7, mapImage) {
|
|
|
1232597
1232757
|
}
|
|
1232598
1232758
|
|
|
1232599
1232759
|
// ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
1232600
|
-
var
|
|
1232760
|
+
var import_promises34 = require("fs/promises");
|
|
1232601
1232761
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
1232602
1232762
|
async function defaultMarkdownLoader(filepath) {
|
|
1232603
|
-
const { content: content3 } = (0, import_gray_matter2.default)(await (0,
|
|
1232763
|
+
const { content: content3 } = (0, import_gray_matter2.default)(await (0, import_promises34.readFile)(filepath));
|
|
1232604
1232764
|
return content3;
|
|
1232605
1232765
|
}
|
|
1232606
1232766
|
async function replaceReferencedMarkdown({
|
|
@@ -1232637,9 +1232797,9 @@ async function replaceReferencedMarkdown({
|
|
|
1232637
1232797
|
}
|
|
1232638
1232798
|
|
|
1232639
1232799
|
// ../docs-markdown-utils/lib/replaceReferencedCode.js
|
|
1232640
|
-
var
|
|
1232800
|
+
var import_promises35 = require("fs/promises");
|
|
1232641
1232801
|
async function defaultFileLoader(filepath) {
|
|
1232642
|
-
const file = await (0,
|
|
1232802
|
+
const file = await (0, import_promises35.readFile)(filepath);
|
|
1232643
1232803
|
return file.toString();
|
|
1232644
1232804
|
}
|
|
1232645
1232805
|
async function replaceReferencedCode({
|
|
@@ -1237724,12 +1237884,12 @@ function stringifyFernFilepath(fernFilepath) {
|
|
|
1237724
1237884
|
}
|
|
1237725
1237885
|
|
|
1237726
1237886
|
// ../generation/ir-generator/lib/utils/convertToFernFilepath.js
|
|
1237727
|
-
var
|
|
1237887
|
+
var import_path28 = __toESM(require("path"), 1);
|
|
1237728
1237888
|
function convertToFernFilepath({ relativeFilepath, casingsGenerator }) {
|
|
1237729
1237889
|
const pathToPackage = dirname(relativeFilepath);
|
|
1237730
|
-
const filename = (0,
|
|
1237731
|
-
const packagePath = pathToPackage === "." ? [] : pathToPackage.split(
|
|
1237732
|
-
const file = filename !== FERN_PACKAGE_MARKER_FILENAME ? casingsGenerator.generateName(
|
|
1237890
|
+
const filename = (0, import_path28.basename)(relativeFilepath);
|
|
1237891
|
+
const packagePath = pathToPackage === "." ? [] : pathToPackage.split(import_path28.default.sep).map((part) => casingsGenerator.generateName(part));
|
|
1237892
|
+
const file = filename !== FERN_PACKAGE_MARKER_FILENAME ? casingsGenerator.generateName(import_path28.default.parse(filename).name) : void 0;
|
|
1237733
1237893
|
const allParts = [];
|
|
1237734
1237894
|
allParts.push(...packagePath);
|
|
1237735
1237895
|
if (file != null) {
|
|
@@ -1239674,7 +1239834,7 @@ function convertObject4({ typeName, rawObject, example, fileContainingType, file
|
|
|
1239674
1239834
|
throw new Error(`Example is not an object. Got: ${JSON.stringify(example)}`);
|
|
1239675
1239835
|
}
|
|
1239676
1239836
|
return ExampleTypeShape.object({
|
|
1239677
|
-
properties: rawObject.properties != null ? Object.entries(example).reduce((exampleProperties, [wireKey, propertyExample]) => {
|
|
1239837
|
+
properties: rawObject.properties != null || rawObject.extends != null ? Object.entries(example).reduce((exampleProperties, [wireKey, propertyExample]) => {
|
|
1239678
1239838
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
1239679
1239839
|
typeName,
|
|
1239680
1239840
|
wirePropertyKey: wireKey,
|
|
@@ -1242092,23 +1242252,23 @@ var ExampleGenerator = class {
|
|
|
1242092
1242252
|
}
|
|
1242093
1242253
|
this.flattenedProperties = /* @__PURE__ */ new Map();
|
|
1242094
1242254
|
for (const typeId of this.types.keys()) {
|
|
1242095
|
-
this.flattenedProperties.set(typeId, this.getFlattenedProperties(typeId));
|
|
1242255
|
+
this.flattenedProperties.set(typeId, this.getFlattenedProperties(typeId, 0));
|
|
1242096
1242256
|
}
|
|
1242097
1242257
|
}
|
|
1242098
|
-
convertPropertyToExampleProperty(originalType, property5) {
|
|
1242258
|
+
convertPropertyToExampleProperty(originalType, property5, depth) {
|
|
1242099
1242259
|
return {
|
|
1242100
1242260
|
name: property5.name,
|
|
1242101
|
-
value: this.generateExampleTypeReference(property5.valueType,
|
|
1242261
|
+
value: this.generateExampleTypeReference(property5.valueType, depth),
|
|
1242102
1242262
|
originalTypeDeclaration: originalType
|
|
1242103
1242263
|
};
|
|
1242104
1242264
|
}
|
|
1242105
|
-
getFlattenedProperties(typeId) {
|
|
1242265
|
+
getFlattenedProperties(typeId, depth) {
|
|
1242106
1242266
|
const td = this.types.get(typeId);
|
|
1242107
1242267
|
const foundTd = td === void 0 ? [] : this.flattenedProperties.get(typeId) ?? td.shape._visit({
|
|
1242108
1242268
|
alias: (atd) => {
|
|
1242109
1242269
|
return atd.aliasOf._visit({
|
|
1242110
1242270
|
container: () => [],
|
|
1242111
|
-
named: (dtn) => this.getFlattenedProperties(dtn.typeId),
|
|
1242271
|
+
named: (dtn) => this.getFlattenedProperties(dtn.typeId, depth),
|
|
1242112
1242272
|
primitive: () => [],
|
|
1242113
1242273
|
unknown: () => [],
|
|
1242114
1242274
|
_other: () => []
|
|
@@ -1242120,16 +1242280,16 @@ var ExampleGenerator = class {
|
|
|
1242120
1242280
|
},
|
|
1242121
1242281
|
object: (otd) => {
|
|
1242122
1242282
|
const props = [
|
|
1242123
|
-
...otd.properties.map((prop) => this.convertPropertyToExampleProperty(td.name, prop)),
|
|
1242124
|
-
...otd.extends.flatMap((eo) => this.getFlattenedProperties(eo.typeId))
|
|
1242283
|
+
...otd.properties.map((prop) => this.convertPropertyToExampleProperty(td.name, prop, depth)),
|
|
1242284
|
+
...otd.extends.flatMap((eo) => this.getFlattenedProperties(eo.typeId, depth))
|
|
1242125
1242285
|
];
|
|
1242126
1242286
|
this.flattenedProperties.set(typeId, props);
|
|
1242127
1242287
|
return props;
|
|
1242128
1242288
|
},
|
|
1242129
1242289
|
union: (utd) => {
|
|
1242130
1242290
|
const props = [
|
|
1242131
|
-
...utd.baseProperties.map((prop) => this.convertPropertyToExampleProperty(td.name, prop)),
|
|
1242132
|
-
...utd.extends.flatMap((eo) => this.getFlattenedProperties(eo.typeId))
|
|
1242291
|
+
...utd.baseProperties.map((prop) => this.convertPropertyToExampleProperty(td.name, prop, depth)),
|
|
1242292
|
+
...utd.extends.flatMap((eo) => this.getFlattenedProperties(eo.typeId, depth))
|
|
1242133
1242293
|
];
|
|
1242134
1242294
|
this.flattenedProperties.set(typeId, props);
|
|
1242135
1242295
|
return props;
|
|
@@ -1242375,11 +1242535,11 @@ var ExampleGenerator = class {
|
|
|
1242375
1242535
|
case "enum":
|
|
1242376
1242536
|
return this.generateExampleTypeForEnum(typeDeclaration.shape);
|
|
1242377
1242537
|
case "object":
|
|
1242378
|
-
return this.generateExampleTypeForObject(typeDeclaration.name);
|
|
1242538
|
+
return this.generateExampleTypeForObject(typeDeclaration.name, depth);
|
|
1242379
1242539
|
case "union":
|
|
1242380
1242540
|
return this.generateExampleTypeForUnion(typeDeclaration.name.typeId, typeDeclaration.shape, depth);
|
|
1242381
1242541
|
case "undiscriminatedUnion":
|
|
1242382
|
-
return this.generateExampleTypeForUndiscriminatedUnion(typeDeclaration.shape);
|
|
1242542
|
+
return this.generateExampleTypeForUndiscriminatedUnion(typeDeclaration.shape, depth);
|
|
1242383
1242543
|
default:
|
|
1242384
1242544
|
assertNever(typeDeclaration.shape);
|
|
1242385
1242545
|
}
|
|
@@ -1242405,8 +1242565,11 @@ var ExampleGenerator = class {
|
|
|
1242405
1242565
|
})
|
|
1242406
1242566
|
});
|
|
1242407
1242567
|
}
|
|
1242408
|
-
generateExampleTypeForObject(declaredTypeName) {
|
|
1242568
|
+
generateExampleTypeForObject(declaredTypeName, depth) {
|
|
1242409
1242569
|
const providedExample = this.userProvidedTypeExamples.get(declaredTypeName.typeId);
|
|
1242570
|
+
if (!this.flattenedProperties.has(declaredTypeName.typeId)) {
|
|
1242571
|
+
this.flattenedProperties.set(declaredTypeName.typeId, this.getFlattenedProperties(declaredTypeName.typeId, depth));
|
|
1242572
|
+
}
|
|
1242410
1242573
|
const exampleProperties = this.flattenedProperties.get(declaredTypeName.typeId);
|
|
1242411
1242574
|
const jsonExample = {};
|
|
1242412
1242575
|
exampleProperties == null ? void 0 : exampleProperties.forEach((prop) => jsonExample[prop.name.wireValue] = prop.value.jsonExample);
|
|
@@ -1242474,9 +1242637,9 @@ var ExampleGenerator = class {
|
|
|
1242474
1242637
|
});
|
|
1242475
1242638
|
});
|
|
1242476
1242639
|
}
|
|
1242477
|
-
generateExampleTypeForUndiscriminatedUnion(undiscriminatedUnionDeclaration) {
|
|
1242640
|
+
generateExampleTypeForUndiscriminatedUnion(undiscriminatedUnionDeclaration, depth) {
|
|
1242478
1242641
|
return undiscriminatedUnionDeclaration.members.map((member, index2) => {
|
|
1242479
|
-
const memberExample = this.generateExampleTypeReference(member.type,
|
|
1242642
|
+
const memberExample = this.generateExampleTypeReference(member.type, depth);
|
|
1242480
1242643
|
return this.newNamelessExampleType({
|
|
1242481
1242644
|
jsonExample: memberExample.jsonExample,
|
|
1242482
1242645
|
shape: ExampleTypeShape.undiscriminatedUnion({
|
|
@@ -1244295,10 +1244458,10 @@ var PropertyResolverImpl = class {
|
|
|
1244295
1244458
|
};
|
|
1244296
1244459
|
|
|
1244297
1244460
|
// ../generation/ir-generator/lib/parsers/ProtobufParser.js
|
|
1244298
|
-
var
|
|
1244461
|
+
var import_promises36 = require("fs/promises");
|
|
1244299
1244462
|
var ProtobufParser = class {
|
|
1244300
1244463
|
async parse({ absoluteFilePath }) {
|
|
1244301
|
-
const content3 = await (0,
|
|
1244464
|
+
const content3 = await (0, import_promises36.readFile)(absoluteFilePath, "utf-8");
|
|
1244302
1244465
|
const csharpNamespaceMatch = content3.match(/option\s+csharp_namespace\s*=\s*"([^"]+)";/);
|
|
1244303
1244466
|
const packageNameMatch = content3.match(/package\s+([a-zA-Z_][\w.]*);/);
|
|
1244304
1244467
|
const serviceNameMatch = content3.match(/service\s+([a-zA-Z_]\w*)\s*{/);
|
|
@@ -1245093,7 +1245256,7 @@ function filterServiceTypeReferenceInfoForAudiences(serviceTypeReferenceInfo, fi
|
|
|
1245093
1245256
|
// ../docs-resolver/lib/DocsDefinitionResolver.js
|
|
1245094
1245257
|
var import_dayjs3 = __toESM(require_dayjs_min(), 1);
|
|
1245095
1245258
|
var import_utc3 = __toESM(require_utc(), 1);
|
|
1245096
|
-
var
|
|
1245259
|
+
var import_promises37 = require("fs/promises");
|
|
1245097
1245260
|
var import_gray_matter3 = __toESM(require_gray_matter(), 1);
|
|
1245098
1245261
|
|
|
1245099
1245262
|
// ../docs-resolver/lib/utils/isSubpackage.js
|
|
@@ -1247300,7 +1247463,7 @@ var DocsDefinitionResolver = class {
|
|
|
1247300
1247463
|
const jsFilePaths = /* @__PURE__ */ new Set();
|
|
1247301
1247464
|
await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
|
|
1247302
1247465
|
const absoluteFilePath = resolve(this.docsWorkspace.absoluteFilepath, filepath);
|
|
1247303
|
-
const stats = await (0,
|
|
1247466
|
+
const stats = await (0, import_promises37.stat)(absoluteFilePath);
|
|
1247304
1247467
|
if (stats.isDirectory()) {
|
|
1247305
1247468
|
const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx}");
|
|
1247306
1247469
|
files.forEach((file) => {
|
|
@@ -1247312,7 +1247475,7 @@ var DocsDefinitionResolver = class {
|
|
|
1247312
1247475
|
}));
|
|
1247313
1247476
|
jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
|
|
1247314
1247477
|
const relativeFilePath = this.toRelativeFilepath(filePath);
|
|
1247315
|
-
const contents = (await (0,
|
|
1247478
|
+
const contents = (await (0, import_promises37.readFile)(filePath)).toString();
|
|
1247316
1247479
|
return [relativeFilePath, contents];
|
|
1247317
1247480
|
})));
|
|
1247318
1247481
|
}
|
|
@@ -1247732,7 +1247895,7 @@ function convertAvailability5(availability) {
|
|
|
1247732
1247895
|
var import_cors = __toESM(require_lib20(), 1);
|
|
1247733
1247896
|
var import_express = __toESM(require_express3(), 1);
|
|
1247734
1247897
|
var import_http2 = __toESM(require("http"), 1);
|
|
1247735
|
-
var
|
|
1247898
|
+
var import_path30 = __toESM(require("path"), 1);
|
|
1247736
1247899
|
|
|
1247737
1247900
|
// ../../../node_modules/.pnpm/watcher@2.3.1/node_modules/watcher/dist/watcher.js
|
|
1247738
1247901
|
var import_node_events = require("events");
|
|
@@ -1249389,10 +1249552,10 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
1249389
1249552
|
// ../docs-preview/lib/downloadLocalDocsBundle.js
|
|
1249390
1249553
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
1249391
1249554
|
var import_fs7 = require("fs");
|
|
1249392
|
-
var
|
|
1249555
|
+
var import_promises38 = require("fs/promises");
|
|
1249393
1249556
|
var import_os4 = require("os");
|
|
1249394
|
-
var
|
|
1249395
|
-
var
|
|
1249557
|
+
var import_path29 = __toESM(require("path"), 1);
|
|
1249558
|
+
var import_promises39 = require("stream/promises");
|
|
1249396
1249559
|
var import_tmp_promise5 = __toESM(require_tmp_promise(), 1);
|
|
1249397
1249560
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
1249398
1249561
|
var ETAG_FILENAME = "etag";
|
|
@@ -1249423,7 +1249586,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1249423
1249586
|
let currentETag = void 0;
|
|
1249424
1249587
|
if (currentETagExists) {
|
|
1249425
1249588
|
logger.debug("Reading existing ETag");
|
|
1249426
|
-
currentETag = (await (0,
|
|
1249589
|
+
currentETag = (await (0, import_promises38.readFile)(eTagFilepath)).toString();
|
|
1249427
1249590
|
}
|
|
1249428
1249591
|
if (currentETag != null && currentETag === eTag) {
|
|
1249429
1249592
|
logger.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -1249437,7 +1249600,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1249437
1249600
|
const dir = await import_tmp_promise5.default.dir({ prefix: "fern" });
|
|
1249438
1249601
|
const absoluteDirectoryToTmpDir = AbsoluteFilePath.of(dir.path);
|
|
1249439
1249602
|
logger.debug(`Created tmp directory ${absoluteDirectoryToTmpDir}`);
|
|
1249440
|
-
const docsBundleZipResponse = await fetch(`${
|
|
1249603
|
+
const docsBundleZipResponse = await fetch(`${import_path29.default.join(bucketUrl, key)}`);
|
|
1249441
1249604
|
const outputZipPath = join(absoluteDirectoryToTmpDir, RelativeFilePath.of("output.zip"));
|
|
1249442
1249605
|
const contents = docsBundleZipResponse.body;
|
|
1249443
1249606
|
if (contents == null) {
|
|
@@ -1249445,18 +1249608,18 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1249445
1249608
|
type: "failure"
|
|
1249446
1249609
|
};
|
|
1249447
1249610
|
}
|
|
1249448
|
-
await (0,
|
|
1249611
|
+
await (0, import_promises39.pipeline)(contents, (0, import_fs7.createWriteStream)(outputZipPath));
|
|
1249449
1249612
|
logger.debug(`Wrote output.zip to ${outputZipPath}`);
|
|
1249450
1249613
|
const absolutePathToPreviewFolder = getPathToPreviewFolder();
|
|
1249451
1249614
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1249452
|
-
await (0,
|
|
1249615
|
+
await (0, import_promises38.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1249453
1249616
|
}
|
|
1249454
|
-
await (0,
|
|
1249617
|
+
await (0, import_promises38.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
1249455
1249618
|
logger.debug(`rm -rf ${absolutePathToPreviewFolder}`);
|
|
1249456
1249619
|
const absolutePathToBundleFolder = getPathToBundleFolder();
|
|
1249457
|
-
await (0,
|
|
1249620
|
+
await (0, import_promises38.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
1249458
1249621
|
await (0, import_decompress.default)(outputZipPath, absolutePathToBundleFolder);
|
|
1249459
|
-
await (0,
|
|
1249622
|
+
await (0, import_promises38.writeFile)(eTagFilepath, eTag);
|
|
1249460
1249623
|
logger.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
1249461
1249624
|
return {
|
|
1249462
1249625
|
type: "success"
|
|
@@ -1249650,9 +1249813,9 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
|
|
|
1249650
1249813
|
}
|
|
1249651
1249814
|
return next2();
|
|
1249652
1249815
|
});
|
|
1249653
|
-
app.use("/_next", import_express.default.static(
|
|
1249816
|
+
app.use("/_next", import_express.default.static(import_path30.default.join(getPathToBundleFolder(), "/_next")));
|
|
1249654
1249817
|
app.use("*", async (_req, res) => {
|
|
1249655
|
-
return res.sendFile(
|
|
1249818
|
+
return res.sendFile(import_path30.default.join(getPathToBundleFolder(), "/[[...slug]].html"));
|
|
1249656
1249819
|
});
|
|
1249657
1249820
|
app.listen(port);
|
|
1249658
1249821
|
context.logger.info(`Running server on http://localhost:${port}`);
|
|
@@ -1250397,7 +1250560,7 @@ function convertRequestWrapperPropertyToString(property5) {
|
|
|
1250397
1250560
|
}
|
|
1250398
1250561
|
|
|
1250399
1250562
|
// ../yaml/validator/lib/rules/no-duplicate-declarations/no-duplicate-declarations.js
|
|
1250400
|
-
var
|
|
1250563
|
+
var import_path31 = __toESM(require("path"), 1);
|
|
1250401
1250564
|
var NoDuplicateDeclarationsRule = {
|
|
1250402
1250565
|
name: "no-duplicate-declarations",
|
|
1250403
1250566
|
create: async ({ workspace, logger }) => {
|
|
@@ -1250405,7 +1250568,7 @@ var NoDuplicateDeclarationsRule = {
|
|
|
1250405
1250568
|
const seenTypes = {};
|
|
1250406
1250569
|
const getRuleViolations = ({ declaredName, relativeFilepath }) => {
|
|
1250407
1250570
|
var _a6;
|
|
1250408
|
-
const relativeDirectoryPath =
|
|
1250571
|
+
const relativeDirectoryPath = import_path31.default.dirname(relativeFilepath);
|
|
1250409
1250572
|
const declarationsForName = (_a6 = declarations[relativeDirectoryPath]) == null ? void 0 : _a6[declaredName];
|
|
1250410
1250573
|
if (declarationsForName == null) {
|
|
1250411
1250574
|
logger.error(`Could not find declarations for name: ${declaredName}. This is an error in the Fern validator.`);
|
|
@@ -1250442,7 +1250605,7 @@ var NoDuplicateDeclarationsRule = {
|
|
|
1250442
1250605
|
async function getDeclarations(workspace) {
|
|
1250443
1250606
|
const declarations = {};
|
|
1250444
1250607
|
await visitAllDefinitionFiles(workspace, async (relativeFilepath, file) => {
|
|
1250445
|
-
const relativeDirectoryPath =
|
|
1250608
|
+
const relativeDirectoryPath = import_path31.default.dirname(relativeFilepath);
|
|
1250446
1250609
|
const declarationsForDirectory = declarations[relativeDirectoryPath] ?? (declarations[relativeDirectoryPath] = {});
|
|
1250447
1250610
|
const addDeclaration = (declaredName) => {
|
|
1250448
1250611
|
(declarationsForDirectory[declaredName] ?? (declarationsForDirectory[declaredName] = [])).push(relativeFilepath);
|
|
@@ -1252057,7 +1252220,7 @@ var ValidFieldNamesRule = {
|
|
|
1252057
1252220
|
};
|
|
1252058
1252221
|
|
|
1252059
1252222
|
// ../yaml/validator/lib/rules/valid-navigation/valid-navigation.js
|
|
1252060
|
-
var
|
|
1252223
|
+
var import_path32 = __toESM(require("path"), 1);
|
|
1252061
1252224
|
var ValidNavigationRule = {
|
|
1252062
1252225
|
name: "valid-navigation",
|
|
1252063
1252226
|
create: ({ workspace }) => {
|
|
@@ -1252066,7 +1252229,7 @@ var ValidNavigationRule = {
|
|
|
1252066
1252229
|
const directoryToChildren = allNamedDefinitionFilepaths.reduce((acc, definitionFilepath) => {
|
|
1252067
1252230
|
var _a6;
|
|
1252068
1252231
|
const children2 = acc[_a6 = dirname(definitionFilepath)] ?? (acc[_a6] = /* @__PURE__ */ new Set());
|
|
1252069
|
-
children2.add(
|
|
1252232
|
+
children2.add(import_path32.default.basename(definitionFilepath));
|
|
1252070
1252233
|
return acc;
|
|
1252071
1252234
|
}, {});
|
|
1252072
1252235
|
return {
|
|
@@ -1265859,7 +1266022,7 @@ function compile(vfileCompatible, compileOptions) {
|
|
|
1265859
1266022
|
}
|
|
1265860
1266023
|
|
|
1265861
1266024
|
// ../../../node_modules/.pnpm/vfile-matter@5.0.0/node_modules/vfile-matter/lib/index.js
|
|
1265862
|
-
var
|
|
1266025
|
+
var import_yaml2 = __toESM(require_dist5(), 1);
|
|
1265863
1266026
|
var regex3 = /^---(?:\r?\n|\r)(?:([\s\S]*?)(?:\r?\n|\r))?---(?:\r?\n|\r|$)/;
|
|
1265864
1266027
|
function matter2(file, options2) {
|
|
1265865
1266028
|
const options_ = options2 || {};
|
|
@@ -1265868,7 +1266031,7 @@ function matter2(file, options2) {
|
|
|
1265868
1266031
|
let doc = String(file);
|
|
1265869
1266032
|
const match = regex3.exec(doc);
|
|
1265870
1266033
|
if (match) {
|
|
1265871
|
-
file.data.matter =
|
|
1266034
|
+
file.data.matter = import_yaml2.default.parse(match[1], yamlOptions);
|
|
1265872
1266035
|
if (strip) {
|
|
1265873
1266036
|
doc = doc.slice(match[0].length);
|
|
1265874
1266037
|
file.value = file.value && typeof file.value === "object" ? new TextEncoder().encode(doc) : doc;
|
|
@@ -1267636,7 +1267799,7 @@ var domain = {
|
|
|
1267636
1267799
|
tokenize: tokenizeDomain,
|
|
1267637
1267800
|
partial: true
|
|
1267638
1267801
|
};
|
|
1267639
|
-
var
|
|
1267802
|
+
var path33 = {
|
|
1267640
1267803
|
tokenize: tokenizePath,
|
|
1267641
1267804
|
partial: true
|
|
1267642
1267805
|
};
|
|
@@ -1267744,7 +1267907,7 @@ function tokenizeWwwAutolink(effects, ok4, nok) {
|
|
|
1267744
1267907
|
}
|
|
1267745
1267908
|
effects.enter("literalAutolink");
|
|
1267746
1267909
|
effects.enter("literalAutolinkWww");
|
|
1267747
|
-
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(
|
|
1267910
|
+
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path33, wwwAfter), nok), nok)(code4);
|
|
1267748
1267911
|
}
|
|
1267749
1267912
|
function wwwAfter(code4) {
|
|
1267750
1267913
|
effects.exit("literalAutolinkWww");
|
|
@@ -1267794,7 +1267957,7 @@ function tokenizeProtocolAutolink(effects, ok4, nok) {
|
|
|
1267794
1267957
|
return nok(code4);
|
|
1267795
1267958
|
}
|
|
1267796
1267959
|
function afterProtocol(code4) {
|
|
1267797
|
-
return code4 === null || asciiControl(code4) || markdownLineEndingOrSpace(code4) || unicodeWhitespace(code4) || unicodePunctuation(code4) ? nok(code4) : effects.attempt(domain, effects.attempt(
|
|
1267960
|
+
return code4 === null || asciiControl(code4) || markdownLineEndingOrSpace(code4) || unicodeWhitespace(code4) || unicodePunctuation(code4) ? nok(code4) : effects.attempt(domain, effects.attempt(path33, protocolAfter), nok)(code4);
|
|
1267798
1267961
|
}
|
|
1267799
1267962
|
function protocolAfter(code4) {
|
|
1267800
1267963
|
effects.exit("literalAutolinkHttp");
|
|
@@ -1269829,7 +1269992,7 @@ var innerPath = function innerPath2(name2, height2) {
|
|
|
1269829
1269992
|
return "";
|
|
1269830
1269993
|
}
|
|
1269831
1269994
|
};
|
|
1269832
|
-
var
|
|
1269995
|
+
var path34 = {
|
|
1269833
1269996
|
doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
|
|
1269834
1269997
|
doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",
|
|
1269835
1269998
|
leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",
|
|
@@ -1272736,7 +1272899,7 @@ var PathNode = class {
|
|
|
1272736
1272899
|
if (this.alternate) {
|
|
1272737
1272900
|
node2.setAttribute("d", this.alternate);
|
|
1272738
1272901
|
} else {
|
|
1272739
|
-
node2.setAttribute("d",
|
|
1272902
|
+
node2.setAttribute("d", path34[this.pathName]);
|
|
1272740
1272903
|
}
|
|
1272741
1272904
|
return node2;
|
|
1272742
1272905
|
}
|
|
@@ -1272744,7 +1272907,7 @@ var PathNode = class {
|
|
|
1272744
1272907
|
if (this.alternate) {
|
|
1272745
1272908
|
return '<path d="' + utils.escape(this.alternate) + '"/>';
|
|
1272746
1272909
|
} else {
|
|
1272747
|
-
return '<path d="' + utils.escape(
|
|
1272910
|
+
return '<path d="' + utils.escape(path34[this.pathName]) + '"/>';
|
|
1272748
1272911
|
}
|
|
1272749
1272912
|
}
|
|
1272750
1272913
|
};
|
|
@@ -1292047,8 +1292210,8 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
|
|
|
1292047
1292210
|
}
|
|
1292048
1292211
|
|
|
1292049
1292212
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileAst.js
|
|
1292050
|
-
var
|
|
1292051
|
-
var
|
|
1292213
|
+
var import_promises40 = require("fs/promises");
|
|
1292214
|
+
var import_path33 = __toESM(require("path"), 1);
|
|
1292052
1292215
|
async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToConfiguration, absolutePathToFernFolder, context, loadAPIWorkspace2) {
|
|
1292053
1292216
|
var _a6, _b4, _c4, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1292054
1292217
|
await ((_a6 = visitor.file) == null ? void 0 : _a6.call(visitor, {
|
|
@@ -1292087,7 +1292250,7 @@ async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToC
|
|
|
1292087
1292250
|
for (const filepath of filepaths) {
|
|
1292088
1292251
|
await ((_b4 = visitor.filepath) == null ? void 0 : _b4.call(visitor, {
|
|
1292089
1292252
|
absoluteFilepath: filepath,
|
|
1292090
|
-
value:
|
|
1292253
|
+
value: import_path33.default.relative(absolutePathToFernFolder, filepath),
|
|
1292091
1292254
|
willBeUploaded: true
|
|
1292092
1292255
|
}, [relativePath]));
|
|
1292093
1292256
|
}
|
|
@@ -1292248,7 +1292411,7 @@ async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToC
|
|
|
1292248
1292411
|
willBeUploaded: false
|
|
1292249
1292412
|
});
|
|
1292250
1292413
|
const absoluteFilepath = resolve(dirname(absoluteFilepathToConfiguration), version3.path);
|
|
1292251
|
-
const content3 = js_yaml_default.load((await (0,
|
|
1292414
|
+
const content3 = js_yaml_default.load((await (0, import_promises40.readFile)(absoluteFilepath)).toString());
|
|
1292252
1292415
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1292253
1292416
|
await ((_a7 = visitor.versionFile) == null ? void 0 : _a7.call(visitor, {
|
|
1292254
1292417
|
path: version3.path,
|
|
@@ -1292319,7 +1292482,7 @@ async function visitNavigationItem({ navigationItem, visitor, nodePath, absolute
|
|
|
1292319
1292482
|
});
|
|
1292320
1292483
|
const absoluteFilepath = resolve(dirname(absoluteFilepathToConfiguration), navigationItem.path);
|
|
1292321
1292484
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1292322
|
-
const content3 = (await (0,
|
|
1292485
|
+
const content3 = (await (0, import_promises40.readFile)(absoluteFilepath)).toString();
|
|
1292323
1292486
|
await ((_a6 = visitor.markdownPage) == null ? void 0 : _a6.call(visitor, {
|
|
1292324
1292487
|
title: navigationItem.page,
|
|
1292325
1292488
|
content: content3,
|
|
@@ -1294748,8 +1294911,8 @@ var supportedExtensions = new Set(extensions);
|
|
|
1294748
1294911
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
1294749
1294912
|
|
|
1294750
1294913
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
1294751
|
-
var
|
|
1294752
|
-
var
|
|
1294914
|
+
var import_promises41 = require("fs/promises");
|
|
1294915
|
+
var import_path34 = __toESM(require("path"), 1);
|
|
1294753
1294916
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
1294754
1294917
|
"image/jpeg",
|
|
1294755
1294918
|
"image/png",
|
|
@@ -1294825,7 +1294988,7 @@ var ValidFileTypes = {
|
|
|
1294825
1294988
|
}
|
|
1294826
1294989
|
};
|
|
1294827
1294990
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
1294828
|
-
const file = await (0,
|
|
1294991
|
+
const file = await (0, import_promises41.readFile)(absoluteFilepath);
|
|
1294829
1294992
|
const fileType = await fileTypeFromBuffer(file);
|
|
1294830
1294993
|
if (fileType != null) {
|
|
1294831
1294994
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -1294839,7 +1295002,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
|
|
|
1294839
1295002
|
];
|
|
1294840
1295003
|
}
|
|
1294841
1295004
|
}
|
|
1294842
|
-
let extension2 =
|
|
1295005
|
+
let extension2 = import_path34.default.extname(absoluteFilepath).toLowerCase();
|
|
1294843
1295006
|
if (extension2.startsWith(".")) {
|
|
1294844
1295007
|
extension2 = extension2.substring(1);
|
|
1294845
1295008
|
}
|
|
@@ -1295026,8 +1295189,8 @@ async function formatWorkspaces({
|
|
|
1295026
1295189
|
}
|
|
1295027
1295190
|
|
|
1295028
1295191
|
// src/commands/generate-fdr/generateFdrApiDefinitionForWorkspaces.ts
|
|
1295029
|
-
var
|
|
1295030
|
-
var
|
|
1295192
|
+
var import_promises42 = require("fs/promises");
|
|
1295193
|
+
var import_path35 = __toESM(require("path"), 1);
|
|
1295031
1295194
|
|
|
1295032
1295195
|
// src/commands/generate-ir/generateIrForFernWorkspace.ts
|
|
1295033
1295196
|
async function generateIrForFernWorkspace({
|
|
@@ -1295080,8 +1295243,8 @@ async function generateFdrApiDefinitionForWorkspaces({
|
|
|
1295080
1295243
|
ir,
|
|
1295081
1295244
|
snippetsConfig: {}
|
|
1295082
1295245
|
});
|
|
1295083
|
-
const resolvedOutputFilePath =
|
|
1295084
|
-
await (0,
|
|
1295246
|
+
const resolvedOutputFilePath = import_path35.default.resolve(outputFilepath);
|
|
1295247
|
+
await (0, import_promises42.writeFile)(resolvedOutputFilePath, await stringifyLargeObject(apiDefinition, { pretty: true }));
|
|
1295085
1295248
|
context.logger.info(`Wrote FDR API definition to ${resolvedOutputFilePath}`);
|
|
1295086
1295249
|
});
|
|
1295087
1295250
|
})
|
|
@@ -1304024,7 +1304187,7 @@ var V53_TO_V52_MIGRATION = {
|
|
|
1304024
1304187
|
[GeneratorName.OPENAPI_PYTHON_CLIENT]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1304025
1304188
|
[GeneratorName.OPENAPI]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1304026
1304189
|
[GeneratorName.STOPLIGHT]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1304027
|
-
[GeneratorName.POSTMAN]:
|
|
1304190
|
+
[GeneratorName.POSTMAN]: "0.2.0",
|
|
1304028
1304191
|
[GeneratorName.PYTHON_SDK]: "3.3.0-rc0",
|
|
1304029
1304192
|
[GeneratorName.GO_FIBER]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
1304030
1304193
|
[GeneratorName.GO_MODEL]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
@@ -1305596,8 +1305759,8 @@ function migrateIntermediateRepresentationThroughVersion({ intermediateRepresent
|
|
|
1305596
1305759
|
}
|
|
1305597
1305760
|
|
|
1305598
1305761
|
// src/commands/generate-ir/generateIrForWorkspaces.ts
|
|
1305599
|
-
var
|
|
1305600
|
-
var
|
|
1305762
|
+
var import_promises43 = require("fs/promises");
|
|
1305763
|
+
var import_path36 = __toESM(require("path"), 1);
|
|
1305601
1305764
|
async function generateIrForWorkspaces({
|
|
1305602
1305765
|
project,
|
|
1305603
1305766
|
irFilepath,
|
|
@@ -1305625,8 +1305788,8 @@ async function generateIrForWorkspaces({
|
|
|
1305625
1305788
|
version: version3,
|
|
1305626
1305789
|
readme
|
|
1305627
1305790
|
});
|
|
1305628
|
-
const irOutputFilePath =
|
|
1305629
|
-
await (0,
|
|
1305791
|
+
const irOutputFilePath = import_path36.default.resolve(irFilepath);
|
|
1305792
|
+
await (0, import_promises43.writeFile)(
|
|
1305630
1305793
|
irOutputFilePath,
|
|
1305631
1305794
|
await stringifyLargeObject(intermediateRepresentation, { pretty: true })
|
|
1305632
1305795
|
);
|
|
@@ -1305669,8 +1305832,8 @@ async function getIntermediateRepresentation({
|
|
|
1305669
1305832
|
}
|
|
1305670
1305833
|
|
|
1305671
1305834
|
// src/commands/generate-openapi-ir/generateOpenAPIIrForWorkspaces.ts
|
|
1305672
|
-
var
|
|
1305673
|
-
var
|
|
1305835
|
+
var import_promises44 = require("fs/promises");
|
|
1305836
|
+
var import_path37 = __toESM(require("path"), 1);
|
|
1305674
1305837
|
async function generateOpenAPIIrForWorkspaces({
|
|
1305675
1305838
|
project,
|
|
1305676
1305839
|
irFilepath,
|
|
@@ -1305690,11 +1305853,11 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1305690
1305853
|
specs: openAPISpecs,
|
|
1305691
1305854
|
taskContext: context
|
|
1305692
1305855
|
});
|
|
1305693
|
-
const irOutputFilePath =
|
|
1305856
|
+
const irOutputFilePath = import_path37.default.resolve(irFilepath);
|
|
1305694
1305857
|
const openApiIrJson = await serialization_exports3.OpenApiIntermediateRepresentation.jsonOrThrow(openAPIIr, {
|
|
1305695
1305858
|
skipValidation: true
|
|
1305696
1305859
|
});
|
|
1305697
|
-
await (0,
|
|
1305860
|
+
await (0, import_promises44.writeFile)(irOutputFilePath, await stringifyLargeObject(openApiIrJson, { pretty: true }));
|
|
1305698
1305861
|
context.logger.info(`Wrote IR to ${irOutputFilePath}`);
|
|
1305699
1305862
|
});
|
|
1305700
1305863
|
})
|
|
@@ -1305702,7 +1305865,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1305702
1305865
|
}
|
|
1305703
1305866
|
|
|
1305704
1305867
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
1305705
|
-
var
|
|
1305868
|
+
var import_promises45 = require("fs/promises");
|
|
1305706
1305869
|
async function writeOverridesForWorkspaces({
|
|
1305707
1305870
|
project,
|
|
1305708
1305871
|
includeModels,
|
|
@@ -1305727,7 +1305890,7 @@ async function writeOverridesForWorkspaces({
|
|
|
1305727
1305890
|
async function readExistingOverrides(overridesFilepath, context) {
|
|
1305728
1305891
|
let parsedOverrides = null;
|
|
1305729
1305892
|
try {
|
|
1305730
|
-
const contents = (await (0,
|
|
1305893
|
+
const contents = (await (0, import_promises45.readFile)(overridesFilepath, "utf8")).toString();
|
|
1305731
1305894
|
try {
|
|
1305732
1305895
|
parsedOverrides = JSON.parse(contents);
|
|
1305733
1305896
|
} catch (err) {
|
|
@@ -1305785,7 +1305948,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
1305785
1305948
|
}
|
|
1305786
1305949
|
}
|
|
1305787
1305950
|
const components = { schemas };
|
|
1305788
|
-
await (0,
|
|
1305951
|
+
await (0, import_promises45.writeFile)(
|
|
1305789
1305952
|
join(dirname(spec.absoluteFilepath), RelativeFilePath.of("openapi-overrides.yml")),
|
|
1305790
1305953
|
js_yaml_default.dump({ paths, components })
|
|
1305791
1305954
|
);
|
|
@@ -1305803,15 +1305966,15 @@ var import_generator_exec_sdk = __toESM(require_generator_exec_sdk(), 1);
|
|
|
1305803
1305966
|
var import_api3 = __toESM(require_api35(), 1);
|
|
1305804
1305967
|
|
|
1305805
1305968
|
// ../generation/local-generation/local-workspace-runner/lib/constants.js
|
|
1305806
|
-
var
|
|
1305969
|
+
var import_path38 = __toESM(require("path"), 1);
|
|
1305807
1305970
|
var DOCKER_FERN_DIRECTORY = "/fern";
|
|
1305808
|
-
var DOCKER_CODEGEN_OUTPUT_DIRECTORY =
|
|
1305809
|
-
var DOCKER_GENERATOR_CONFIG_PATH =
|
|
1305810
|
-
var DOCKER_PATH_TO_IR =
|
|
1305811
|
-
var DOCKER_PATH_TO_SNIPPET =
|
|
1305812
|
-
var DOCKER_PATH_TO_SNIPPET_TEMPLATES =
|
|
1305813
|
-
var DOCKER_GENERATORS_DIRECTORY =
|
|
1305814
|
-
var DOCKER_SOURCES_DIRECTORY =
|
|
1305971
|
+
var DOCKER_CODEGEN_OUTPUT_DIRECTORY = import_path38.default.join(DOCKER_FERN_DIRECTORY, "output");
|
|
1305972
|
+
var DOCKER_GENERATOR_CONFIG_PATH = import_path38.default.join(DOCKER_FERN_DIRECTORY, "config.json");
|
|
1305973
|
+
var DOCKER_PATH_TO_IR = import_path38.default.join(DOCKER_FERN_DIRECTORY, "ir.json");
|
|
1305974
|
+
var DOCKER_PATH_TO_SNIPPET = import_path38.default.join(DOCKER_FERN_DIRECTORY, "snippet.json");
|
|
1305975
|
+
var DOCKER_PATH_TO_SNIPPET_TEMPLATES = import_path38.default.join(DOCKER_FERN_DIRECTORY, "snippet-templates.json");
|
|
1305976
|
+
var DOCKER_GENERATORS_DIRECTORY = import_path38.default.join(DOCKER_FERN_DIRECTORY, "generators");
|
|
1305977
|
+
var DOCKER_SOURCES_DIRECTORY = import_path38.default.join(DOCKER_FERN_DIRECTORY, "sources");
|
|
1305815
1305978
|
|
|
1305816
1305979
|
// ../generation/local-generation/local-workspace-runner/lib/getGeneratorConfig.js
|
|
1305817
1305980
|
var DEFAULT_OUTPUT_VERSION = "0.0.1";
|
|
@@ -1306058,7 +1306221,7 @@ async function getIntermediateRepresentation2({ workspace, audiences, generatorI
|
|
|
1306058
1306221
|
|
|
1306059
1306222
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
1306060
1306223
|
var import_dockerode2 = __toESM(require_docker(), 1);
|
|
1306061
|
-
var
|
|
1306224
|
+
var import_promises46 = require("fs/promises");
|
|
1306062
1306225
|
var import_stream3 = require("stream");
|
|
1306063
1306226
|
var import_tmp_promise6 = __toESM(require_tmp_promise(), 1);
|
|
1306064
1306227
|
async function runDocker({ imageName, args, binds, writeLogsToFile = true, removeAfterCompletion = false }) {
|
|
@@ -1306097,7 +1306260,7 @@ async function tryRunDocker({ docker, imageName, args, binds, removeAfterComplet
|
|
|
1306097
1306260
|
if (status.StatusCode !== 0) {
|
|
1306098
1306261
|
if (writeLogsToFile) {
|
|
1306099
1306262
|
const tmpFile = await import_tmp_promise6.default.file();
|
|
1306100
|
-
await (0,
|
|
1306263
|
+
await (0, import_promises46.writeFile)(tmpFile.path, logs);
|
|
1306101
1306264
|
throw new Error(`Docker exited with a non-zero exit code. Logs here: ${tmpFile.path}`);
|
|
1306102
1306265
|
} else {
|
|
1306103
1306266
|
throw new Error("Docker exited with a non-zero exit code.");
|
|
@@ -1306119,12 +1306282,12 @@ async function pullImage(docker, imageName) {
|
|
|
1306119
1306282
|
|
|
1306120
1306283
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
1306121
1306284
|
var FernGeneratorExecParsing = __toESM(require_serialization33(), 1);
|
|
1306122
|
-
var
|
|
1306285
|
+
var import_promises48 = require("fs/promises");
|
|
1306123
1306286
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
1306124
1306287
|
|
|
1306125
1306288
|
// ../generation/local-generation/local-workspace-runner/lib/LocalTaskHandler.js
|
|
1306126
1306289
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
1306127
|
-
var
|
|
1306290
|
+
var import_promises47 = require("fs/promises");
|
|
1306128
1306291
|
var import_tmp_promise7 = __toESM(require_tmp_promise(), 1);
|
|
1306129
1306292
|
var LocalTaskHandler = class {
|
|
1306130
1306293
|
context;
|
|
@@ -1306170,7 +1306333,7 @@ var LocalTaskHandler = class {
|
|
|
1306170
1306333
|
const tmpOutputResolutionDir = AbsoluteFilePath.of((await import_tmp_promise7.default.dir({})).path);
|
|
1306171
1306334
|
const absolutePathToFernignore = AbsoluteFilePath.of(join(this.absolutePathToLocalOutput, RelativeFilePath.of(FERNIGNORE_FILENAME)));
|
|
1306172
1306335
|
const fernIngnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
1306173
|
-
await (0,
|
|
1306336
|
+
await (0, import_promises47.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
1306174
1306337
|
await this.runGitCommand(["init"], tmpOutputResolutionDir);
|
|
1306175
1306338
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
1306176
1306339
|
const response = await this.runGitCommand(["config", "--list"], tmpOutputResolutionDir);
|
|
@@ -1306183,16 +1306346,16 @@ var LocalTaskHandler = class {
|
|
|
1306183
1306346
|
await this.copyGeneratedFilesToDirectory(tmpOutputResolutionDir);
|
|
1306184
1306347
|
await this.runGitCommand(["reset", "--", ...fernIngnorePaths], tmpOutputResolutionDir);
|
|
1306185
1306348
|
await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
1306186
|
-
await (0,
|
|
1306187
|
-
await (0,
|
|
1306349
|
+
await (0, import_promises47.rmdir)(this.absolutePathToLocalOutput, { recursive: true });
|
|
1306350
|
+
await (0, import_promises47.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
1306188
1306351
|
}
|
|
1306189
1306352
|
async copyGeneratedFilesNoFernIgnore() {
|
|
1306190
1306353
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
1306191
|
-
await (0,
|
|
1306354
|
+
await (0, import_promises47.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
1306192
1306355
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
1306193
1306356
|
}
|
|
1306194
1306357
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
1306195
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
1306358
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises47.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
1306196
1306359
|
if (firstLocalOutputItem == null) {
|
|
1306197
1306360
|
return;
|
|
1306198
1306361
|
}
|
|
@@ -1306200,15 +1306363,15 @@ var LocalTaskHandler = class {
|
|
|
1306200
1306363
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
1306201
1306364
|
await (0, import_decompress2.default)(join(this.absolutePathToTmpOutputDirectory, RelativeFilePath.of(firstLocalOutputItem)), outputPath);
|
|
1306202
1306365
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
1306203
|
-
await (0,
|
|
1306366
|
+
await (0, import_promises47.cp)(join(this.absolutePathToTmpOutputDirectory, RelativeFilePath.of(localOutputItem)), join(outputPath, RelativeFilePath.of(localOutputItem)), { recursive: true });
|
|
1306204
1306367
|
}
|
|
1306205
1306368
|
} else {
|
|
1306206
|
-
await (0,
|
|
1306369
|
+
await (0, import_promises47.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
1306207
1306370
|
}
|
|
1306208
1306371
|
}
|
|
1306209
1306372
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
1306210
1306373
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
1306211
|
-
await (0,
|
|
1306374
|
+
await (0, import_promises47.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
1306212
1306375
|
}
|
|
1306213
1306376
|
async runGitCommand(options2, cwd2) {
|
|
1306214
1306377
|
const response = await loggingExeca(this.context.logger, "git", options2, {
|
|
@@ -1306220,7 +1306383,7 @@ var LocalTaskHandler = class {
|
|
|
1306220
1306383
|
};
|
|
1306221
1306384
|
var NEW_LINE_REGEX = /\r?\n/;
|
|
1306222
1306385
|
async function getFernIgnorePaths({ absolutePathToFernignore }) {
|
|
1306223
|
-
const fernIgnoreFileContents = (await (0,
|
|
1306386
|
+
const fernIgnoreFileContents = (await (0, import_promises47.readFile)(absolutePathToFernignore)).toString();
|
|
1306224
1306387
|
return [
|
|
1306225
1306388
|
FERNIGNORE_FILENAME,
|
|
1306226
1306389
|
...fernIgnoreFileContents.trim().split(NEW_LINE_REGEX).filter((line) => !line.startsWith("#") && line.length > 0)
|
|
@@ -1306313,7 +1306476,7 @@ async function writeIrToFile({ workspace, audiences, generatorInvocation, worksp
|
|
|
1306313
1306476
|
tmpdir: workspaceTempDir.path
|
|
1306314
1306477
|
});
|
|
1306315
1306478
|
const absolutePathToIr = AbsoluteFilePath.of(irFile.path);
|
|
1306316
|
-
await (0,
|
|
1306479
|
+
await (0, import_promises48.writeFile)(absolutePathToIr, JSON.stringify(intermediateRepresentation, void 0, 4));
|
|
1306317
1306480
|
context.logger.debug(`Wrote IR to ${absolutePathToIr}`);
|
|
1306318
1306481
|
return absolutePathToIr;
|
|
1306319
1306482
|
}
|
|
@@ -1306345,7 +1306508,7 @@ async function runGenerator({ workspaceName, organization, outputVersion, absolu
|
|
|
1306345
1306508
|
if (!parsedConfig.ok) {
|
|
1306346
1306509
|
throw new Error(`Failed to parse config.json into ${absolutePathToWriteConfigJson}`);
|
|
1306347
1306510
|
}
|
|
1306348
|
-
await (0,
|
|
1306511
|
+
await (0, import_promises48.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(parsedConfig.value, void 0, 4));
|
|
1306349
1306512
|
const doesConfigJsonExist = await waitUntilPathExists(absolutePathToWriteConfigJson, 5e3);
|
|
1306350
1306513
|
if (!doesConfigJsonExist) {
|
|
1306351
1306514
|
throw new Error(`Failed to create ${absolutePathToWriteConfigJson}`);
|
|
@@ -1306376,7 +1306539,7 @@ function getDockerDestinationForSource(source) {
|
|
|
1306376
1306539
|
|
|
1306377
1306540
|
// ../generation/local-generation/local-workspace-runner/lib/runLocalGenerationForWorkspace.js
|
|
1306378
1306541
|
var import_os5 = __toESM(require("os"), 1);
|
|
1306379
|
-
var
|
|
1306542
|
+
var import_path39 = __toESM(require("path"), 1);
|
|
1306380
1306543
|
var import_tmp_promise9 = __toESM(require_tmp_promise(), 1);
|
|
1306381
1306544
|
async function runLocalGenerationForWorkspace({ projectConfig, workspace, generatorGroup, keepDocker, context }) {
|
|
1306382
1306545
|
const workspaceTempDir = await getWorkspaceTempDir();
|
|
@@ -1306419,7 +1306582,7 @@ async function runLocalGenerationForWorkspace({ projectConfig, workspace, genera
|
|
|
1306419
1306582
|
}
|
|
1306420
1306583
|
async function getWorkspaceTempDir() {
|
|
1306421
1306584
|
return import_tmp_promise9.default.dir({
|
|
1306422
|
-
tmpdir: import_os5.default.platform() === "darwin" ?
|
|
1306585
|
+
tmpdir: import_os5.default.platform() === "darwin" ? import_path39.default.join("/private", import_os5.default.tmpdir()) : void 0,
|
|
1306423
1306586
|
prefix: "fern"
|
|
1306424
1306587
|
});
|
|
1306425
1306588
|
}
|
|
@@ -1306430,8 +1306593,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
|
|
|
1306430
1306593
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
1306431
1306594
|
var import_axios5 = __toESM(require_axios4(), 1);
|
|
1306432
1306595
|
var import_fs8 = require("fs");
|
|
1306433
|
-
var
|
|
1306434
|
-
var
|
|
1306596
|
+
var import_promises49 = require("fs/promises");
|
|
1306597
|
+
var import_promises50 = require("stream/promises");
|
|
1306435
1306598
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context }) {
|
|
1306436
1306599
|
try {
|
|
1306437
1306600
|
await downloadFileForTask({
|
|
@@ -1306448,18 +1306611,18 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
1306448
1306611
|
responseType: "stream"
|
|
1306449
1306612
|
});
|
|
1306450
1306613
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1306451
|
-
await (0,
|
|
1306614
|
+
await (0, import_promises49.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1306452
1306615
|
}
|
|
1306453
|
-
await (0,
|
|
1306454
|
-
await (0,
|
|
1306616
|
+
await (0, import_promises49.mkdir)(dirname(absolutePathToLocalOutput), { recursive: true });
|
|
1306617
|
+
await (0, import_promises50.pipeline)(request.data, (0, import_fs8.createWriteStream)(absolutePathToLocalOutput));
|
|
1306455
1306618
|
}
|
|
1306456
1306619
|
|
|
1306457
1306620
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
1306458
1306621
|
var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
1306459
1306622
|
var import_axios6 = __toESM(require_axios4(), 1);
|
|
1306460
1306623
|
var import_form_data2 = __toESM(require_form_data(), 1);
|
|
1306461
|
-
var
|
|
1306462
|
-
var
|
|
1306624
|
+
var import_promises51 = require("fs/promises");
|
|
1306625
|
+
var import_path40 = require("path");
|
|
1306463
1306626
|
var import_tar2 = __toESM(require_tar(), 1);
|
|
1306464
1306627
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
1306465
1306628
|
async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version3, context, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview }) {
|
|
@@ -1306499,23 +1306662,23 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1306499
1306662
|
context.logger.debug(`Writing mock fern definition to ${absolutePathToTmpDir}`);
|
|
1306500
1306663
|
const absolutePathToTmpFernDirectory = join(absolutePathToTmpDir, RelativeFilePath.of(FERN_DIRECTORY));
|
|
1306501
1306664
|
const absolutePathToTmpDefinitionDirectory = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(DEFINITION_DIRECTORY));
|
|
1306502
|
-
await (0,
|
|
1306665
|
+
await (0, import_promises51.mkdir)(absolutePathToTmpDefinitionDirectory, { recursive: true });
|
|
1306503
1306666
|
const absolutePathToApiYml = join(absolutePathToTmpDefinitionDirectory, RelativeFilePath.of(ROOT_API_FILENAME));
|
|
1306504
|
-
await (0,
|
|
1306667
|
+
await (0, import_promises51.writeFile)(absolutePathToApiYml, js_yaml_default.dump(workspace.definition.rootApiFile.contents));
|
|
1306505
1306668
|
await writeFernDefinition({
|
|
1306506
1306669
|
absolutePathToDefinitionDirectory: absolutePathToTmpDefinitionDirectory,
|
|
1306507
1306670
|
definition: workspace.definition
|
|
1306508
1306671
|
});
|
|
1306509
1306672
|
const absolutePathToFernConfigJson = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(PROJECT_CONFIG_FILENAME));
|
|
1306510
|
-
await (0,
|
|
1306673
|
+
await (0, import_promises51.writeFile)(absolutePathToFernConfigJson, JSON.stringify(projectConfig.rawConfig, void 0, 2));
|
|
1306511
1306674
|
try {
|
|
1306512
1306675
|
const sources = workspace.getSources();
|
|
1306513
1306676
|
for (const source of sources) {
|
|
1306514
|
-
const sourceContents = await (0,
|
|
1306515
|
-
const relativeLocation = (0,
|
|
1306677
|
+
const sourceContents = await (0, import_promises51.readFile)(source.absoluteFilePath);
|
|
1306678
|
+
const relativeLocation = (0, import_path40.relative)(workspace.absoluteFilepath, source.absoluteFilePath);
|
|
1306516
1306679
|
const absolutePathToSourceFile = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(relativeLocation));
|
|
1306517
|
-
await (0,
|
|
1306518
|
-
await (0,
|
|
1306680
|
+
await (0, import_promises51.mkdir)(dirname(absolutePathToSourceFile), { recursive: true });
|
|
1306681
|
+
await (0, import_promises51.writeFile)(absolutePathToSourceFile, sourceContents);
|
|
1306519
1306682
|
}
|
|
1306520
1306683
|
} catch (error) {
|
|
1306521
1306684
|
context.logger.debug(`Failed to write source files to disk, continuing: ${error}`);
|
|
@@ -1306538,7 +1306701,7 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1306538
1306701
|
}
|
|
1306539
1306702
|
} else {
|
|
1306540
1306703
|
context.logger.debug("Uploading definition...");
|
|
1306541
|
-
await import_axios6.default.put(definitionUploadUrlRequest.body.s3Url, await (0,
|
|
1306704
|
+
await import_axios6.default.put(definitionUploadUrlRequest.body.s3Url, await (0, import_promises51.readFile)(tarPath));
|
|
1306542
1306705
|
fernDefinitionMetadata = {
|
|
1306543
1306706
|
definitionS3DownloadUrl: definitionUploadUrlRequest.body.s3Url,
|
|
1306544
1306707
|
outputPath: ".mock",
|
|
@@ -1306600,14 +1306763,14 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1306600
1306763
|
async function writeFernDefinition({ absolutePathToDefinitionDirectory, definition: definition3 }) {
|
|
1306601
1306764
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
1306602
1306765
|
const absolutePathToDefinitionFile = join(absolutePathToDefinitionDirectory, RelativeFilePath.of(relativePath));
|
|
1306603
|
-
await (0,
|
|
1306604
|
-
await (0,
|
|
1306766
|
+
await (0, import_promises51.mkdir)(dirname(absolutePathToDefinitionFile), { recursive: true });
|
|
1306767
|
+
await (0, import_promises51.writeFile)(absolutePathToDefinitionFile, js_yaml_default.dump(definitionFile.contents));
|
|
1306605
1306768
|
}
|
|
1306606
1306769
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
1306607
1306770
|
if (packageMarker.contents.export == null) {
|
|
1306608
1306771
|
const absolutePathToPackageMarker = join(absolutePathToDefinitionDirectory, RelativeFilePath.of(relativePath));
|
|
1306609
|
-
await (0,
|
|
1306610
|
-
await (0,
|
|
1306772
|
+
await (0, import_promises51.mkdir)(dirname(absolutePathToPackageMarker), { recursive: true });
|
|
1306773
|
+
await (0, import_promises51.writeFile)(absolutePathToPackageMarker, js_yaml_default.dump(packageMarker.contents));
|
|
1306611
1306774
|
}
|
|
1306612
1306775
|
}
|
|
1306613
1306776
|
for (const [relativePath, importedDefinition] of Object.entries(definition3.importedDefinitions)) {
|
|
@@ -1306723,9 +1306886,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context }) {
|
|
|
1306723
1306886
|
var import_axios7 = __toESM(require_axios4(), 1);
|
|
1306724
1306887
|
var import_decompress3 = __toESM(require_decompress(), 1);
|
|
1306725
1306888
|
var import_fs9 = require("fs");
|
|
1306726
|
-
var
|
|
1306727
|
-
var
|
|
1306728
|
-
var
|
|
1306889
|
+
var import_promises52 = require("fs/promises");
|
|
1306890
|
+
var import_path41 = __toESM(require("path"), 1);
|
|
1306891
|
+
var import_promises53 = require("stream/promises");
|
|
1306729
1306892
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
1306730
1306893
|
var _isFinished, _createdSnippets, _snippetsS3PreSignedReadUrl;
|
|
1306731
1306894
|
var RemoteTaskHandler = class {
|
|
@@ -1306809,7 +1306972,7 @@ var RemoteTaskHandler = class {
|
|
|
1306809
1306972
|
} : void 0;
|
|
1306810
1306973
|
}
|
|
1306811
1306974
|
getAbsolutePathToLocalOutput() {
|
|
1306812
|
-
return this.absolutePathToPreview != null ? join(this.absolutePathToPreview, RelativeFilePath.of(
|
|
1306975
|
+
return this.absolutePathToPreview != null ? join(this.absolutePathToPreview, RelativeFilePath.of(import_path41.default.basename(this.generatorInvocation.name))) : this.generatorInvocation.absolutePathToLocalOutput;
|
|
1306813
1306976
|
}
|
|
1306814
1306977
|
get isFinished() {
|
|
1306815
1306978
|
return __privateGet(this, _isFinished);
|
|
@@ -1306840,12 +1307003,12 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1306840
1307003
|
responseType: "stream"
|
|
1306841
1307004
|
});
|
|
1306842
1307005
|
const tmpDir = await import_tmp_promise11.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1306843
|
-
const outputZipPath =
|
|
1306844
|
-
await (0,
|
|
1307006
|
+
const outputZipPath = import_path41.default.join(tmpDir.path, "output.zip");
|
|
1307007
|
+
await (0, import_promises53.pipeline)(request.data, (0, import_fs9.createWriteStream)(outputZipPath));
|
|
1306845
1307008
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1306846
|
-
await (0,
|
|
1307009
|
+
await (0, import_promises52.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1306847
1307010
|
}
|
|
1306848
|
-
await (0,
|
|
1307011
|
+
await (0, import_promises52.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
1306849
1307012
|
await (0, import_decompress3.default)(outputZipPath, absolutePathToLocalOutput);
|
|
1306850
1307013
|
}
|
|
1306851
1307014
|
function convertLogLevel(logLevel) {
|
|
@@ -1306864,7 +1307027,7 @@ function convertLogLevel(logLevel) {
|
|
|
1306864
1307027
|
}
|
|
1306865
1307028
|
|
|
1306866
1307029
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
1306867
|
-
var
|
|
1307030
|
+
var import_promises54 = require("fs/promises");
|
|
1306868
1307031
|
var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
|
|
1306869
1307032
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
1306870
1307033
|
var SourceUploader = class {
|
|
@@ -1306885,7 +1307048,7 @@ var SourceUploader = class {
|
|
|
1306885
1307048
|
}
|
|
1306886
1307049
|
async uploadSource(source, uploadURL) {
|
|
1306887
1307050
|
const uploadCommand = await this.getUploadCommand(source);
|
|
1306888
|
-
const fileData = await (0,
|
|
1307051
|
+
const fileData = await (0, import_promises54.readFile)(uploadCommand.absoluteFilePath);
|
|
1306889
1307052
|
const response = await fetch(uploadURL, {
|
|
1306890
1307053
|
method: "PUT",
|
|
1306891
1307054
|
body: fileData,
|
|
@@ -1306905,7 +1307068,7 @@ var SourceUploader = class {
|
|
|
1306905
1307068
|
absoluteFilePath,
|
|
1306906
1307069
|
cleanup: async () => {
|
|
1306907
1307070
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
1306908
|
-
await (0,
|
|
1307071
|
+
await (0, import_promises54.unlink)(absoluteFilePath);
|
|
1306909
1307072
|
}
|
|
1306910
1307073
|
};
|
|
1306911
1307074
|
}
|
|
@@ -1307150,7 +1307313,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
1307150
1307313
|
|
|
1307151
1307314
|
// ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
|
|
1307152
1307315
|
var import_axios8 = __toESM(require_axios4(), 1);
|
|
1307153
|
-
var
|
|
1307316
|
+
var import_promises55 = require("fs/promises");
|
|
1307154
1307317
|
var mime = __toESM(require_mime_types(), 1);
|
|
1307155
1307318
|
|
|
1307156
1307319
|
// ../generation/remote-generation/remote-workspace-runner/lib/measureImageSizes.js
|
|
@@ -1307305,7 +1307468,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context, batchSize)
|
|
|
1307305
1307468
|
const absoluteFilePath = resolve(docsWorkspacePath, relativeFilePath);
|
|
1307306
1307469
|
try {
|
|
1307307
1307470
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
1307308
|
-
await import_axios8.default.put(uploadUrl, await (0,
|
|
1307471
|
+
await import_axios8.default.put(uploadUrl, await (0, import_promises55.readFile)(absoluteFilePath), {
|
|
1307309
1307472
|
headers: {
|
|
1307310
1307473
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType
|
|
1307311
1307474
|
}
|
|
@@ -1307925,8 +1308088,8 @@ async function mockServer({
|
|
|
1307925
1308088
|
// src/commands/register/registerWorkspacesV1.ts
|
|
1307926
1308089
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
1307927
1308090
|
var import_axios9 = __toESM(require_axios4(), 1);
|
|
1307928
|
-
var
|
|
1307929
|
-
var
|
|
1308091
|
+
var import_promises56 = require("fs/promises");
|
|
1308092
|
+
var import_path42 = __toESM(require("path"), 1);
|
|
1307930
1308093
|
var import_tar3 = __toESM(require_tar(), 1);
|
|
1307931
1308094
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
1307932
1308095
|
async function registerWorkspacesV1({
|
|
@@ -1307971,11 +1308134,11 @@ async function registerWorkspacesV1({
|
|
|
1307971
1308134
|
return;
|
|
1307972
1308135
|
}
|
|
1307973
1308136
|
const tmpDir = await import_tmp_promise13.default.dir();
|
|
1307974
|
-
const tarPath =
|
|
1308137
|
+
const tarPath = import_path42.default.join(tmpDir.path, "definition.tgz");
|
|
1307975
1308138
|
context.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
1307976
1308139
|
await import_tar3.default.create({ file: tarPath, cwd: resolvedWorkspace.absoluteFilepath }, ["."]);
|
|
1307977
1308140
|
context.logger.info("Uploading definition...");
|
|
1307978
|
-
await import_axios9.default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
1308141
|
+
await import_axios9.default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises56.readFile)(tarPath));
|
|
1307979
1308142
|
context.logger.info(
|
|
1307980
1308143
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
1307981
1308144
|
);
|
|
@@ -1308102,20 +1308265,20 @@ async function generateToken({
|
|
|
1308102
1308265
|
|
|
1308103
1308266
|
// src/commands/upgrade/updateApiSpec.ts
|
|
1308104
1308267
|
var fs7 = __toESM(require("fs"), 1);
|
|
1308105
|
-
var
|
|
1308268
|
+
var import_promises57 = require("fs/promises");
|
|
1308106
1308269
|
var import_stream4 = require("stream");
|
|
1308107
|
-
var
|
|
1308270
|
+
var import_promises58 = require("stream/promises");
|
|
1308108
1308271
|
async function fetchAndWriteFile(url, path45, logger) {
|
|
1308109
1308272
|
const resp = await fetch(url);
|
|
1308110
1308273
|
if (resp.ok && resp.body) {
|
|
1308111
1308274
|
logger.debug("Origin successfully fetched, writing to file");
|
|
1308112
1308275
|
const fileStream = fs7.createWriteStream(path45);
|
|
1308113
|
-
await (0,
|
|
1308114
|
-
const fileContents = await (0,
|
|
1308276
|
+
await (0, import_promises58.finished)(import_stream4.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
1308277
|
+
const fileContents = await (0, import_promises57.readFile)(path45, "utf8");
|
|
1308115
1308278
|
try {
|
|
1308116
|
-
await (0,
|
|
1308279
|
+
await (0, import_promises57.writeFile)(path45, JSON.stringify(JSON.parse(fileContents), void 0, 2), "utf8");
|
|
1308117
1308280
|
} catch (e) {
|
|
1308118
|
-
await (0,
|
|
1308281
|
+
await (0, import_promises57.writeFile)(path45, js_yaml_default.dump(js_yaml_default.load(fileContents)), "utf8");
|
|
1308119
1308282
|
}
|
|
1308120
1308283
|
logger.debug("File written successfully");
|
|
1308121
1308284
|
}
|
|
@@ -1308203,7 +1308366,7 @@ async function updateApiSpec({
|
|
|
1308203
1308366
|
}
|
|
1308204
1308367
|
|
|
1308205
1308368
|
// ../yaml/yaml-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
1308206
|
-
var
|
|
1308369
|
+
var import_promises59 = require("fs/promises");
|
|
1308207
1308370
|
|
|
1308208
1308371
|
// ../yaml/yaml-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
1308209
1308372
|
var import_glob_promise2 = __toESM(require_lib(), 1);
|
|
@@ -1308237,7 +1308400,7 @@ var migration = {
|
|
|
1308237
1308400
|
try {
|
|
1308238
1308401
|
const fileContents = await getFileContents(yamlFilepath);
|
|
1308239
1308402
|
const newContents = addDiscriminantToFile(fileContents);
|
|
1308240
|
-
await (0,
|
|
1308403
|
+
await (0, import_promises59.writeFile)(yamlFilepath, newContents);
|
|
1308241
1308404
|
} catch (error) {
|
|
1308242
1308405
|
context.failAndThrow("Failed to migrate " + yamlFilepath, error);
|
|
1308243
1308406
|
}
|
|
@@ -1308245,7 +1308408,7 @@ var migration = {
|
|
|
1308245
1308408
|
}
|
|
1308246
1308409
|
};
|
|
1308247
1308410
|
async function getFileContents(filepath) {
|
|
1308248
|
-
const buffer = await (0,
|
|
1308411
|
+
const buffer = await (0, import_promises59.readFile)(filepath);
|
|
1308249
1308412
|
return buffer.toString();
|
|
1308250
1308413
|
}
|
|
1308251
1308414
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -1308274,8 +1308437,8 @@ var versionMigrations = {
|
|
|
1308274
1308437
|
var __default = versionMigrations;
|
|
1308275
1308438
|
|
|
1308276
1308439
|
// ../yaml/yaml-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
1308277
|
-
var
|
|
1308278
|
-
var
|
|
1308440
|
+
var import_promises60 = require("fs/promises");
|
|
1308441
|
+
var import_yaml3 = __toESM(require_dist5(), 1);
|
|
1308279
1308442
|
|
|
1308280
1308443
|
// ../yaml/yaml-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
1308281
1308444
|
var import_glob_promise3 = __toESM(require_lib(), 1);
|
|
@@ -1308315,39 +1308478,39 @@ var migration2 = {
|
|
|
1308315
1308478
|
}
|
|
1308316
1308479
|
};
|
|
1308317
1308480
|
async function migrateFile(filepath, context) {
|
|
1308318
|
-
const contents = await (0,
|
|
1308319
|
-
const parsedDocument =
|
|
1308481
|
+
const contents = await (0, import_promises60.readFile)(filepath);
|
|
1308482
|
+
const parsedDocument = import_yaml3.default.parseDocument(contents.toString());
|
|
1308320
1308483
|
const types3 = parsedDocument.get("types");
|
|
1308321
1308484
|
if (types3 == null) {
|
|
1308322
1308485
|
return;
|
|
1308323
1308486
|
}
|
|
1308324
|
-
if (!
|
|
1308487
|
+
if (!import_yaml3.default.isMap(types3)) {
|
|
1308325
1308488
|
context.failWithoutThrowing(`"types" is not a map in ${filepath}`);
|
|
1308326
1308489
|
return;
|
|
1308327
1308490
|
}
|
|
1308328
1308491
|
for (const typeDeclaration of types3.items) {
|
|
1308329
|
-
if (
|
|
1308492
|
+
if (import_yaml3.default.isMap(typeDeclaration.value)) {
|
|
1308330
1308493
|
const union4 = typeDeclaration.value.get("union");
|
|
1308331
1308494
|
if (union4 == null) {
|
|
1308332
1308495
|
continue;
|
|
1308333
1308496
|
}
|
|
1308334
|
-
if (!
|
|
1308497
|
+
if (!import_yaml3.default.isMap(union4)) {
|
|
1308335
1308498
|
context.failWithoutThrowing(`"union" is not a map in ${filepath}`);
|
|
1308336
1308499
|
continue;
|
|
1308337
1308500
|
}
|
|
1308338
1308501
|
for (const singleUnionType of union4.items) {
|
|
1308339
|
-
if (
|
|
1308502
|
+
if (import_yaml3.default.isScalar(singleUnionType.value)) {
|
|
1308340
1308503
|
singleUnionType.value = {
|
|
1308341
1308504
|
type: singleUnionType.value,
|
|
1308342
1308505
|
key: singleUnionType.key
|
|
1308343
1308506
|
};
|
|
1308344
|
-
} else if (
|
|
1308345
|
-
singleUnionType.value.add(new
|
|
1308507
|
+
} else if (import_yaml3.default.isMap(singleUnionType.value)) {
|
|
1308508
|
+
singleUnionType.value.add(new import_yaml3.default.Pair("key", singleUnionType.key));
|
|
1308346
1308509
|
}
|
|
1308347
1308510
|
}
|
|
1308348
1308511
|
}
|
|
1308349
1308512
|
}
|
|
1308350
|
-
await (0,
|
|
1308513
|
+
await (0, import_promises60.writeFile)(filepath, parsedDocument.toString());
|
|
1308351
1308514
|
}
|
|
1308352
1308515
|
|
|
1308353
1308516
|
// ../yaml/yaml-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -1308358,8 +1308521,8 @@ var versionMigrations2 = {
|
|
|
1308358
1308521
|
var __default2 = versionMigrations2;
|
|
1308359
1308522
|
|
|
1308360
1308523
|
// ../yaml/yaml-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
1308361
|
-
var
|
|
1308362
|
-
var
|
|
1308524
|
+
var import_promises61 = require("fs/promises");
|
|
1308525
|
+
var import_yaml4 = __toESM(require_dist5(), 1);
|
|
1308363
1308526
|
|
|
1308364
1308527
|
// ../yaml/yaml-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
1308365
1308528
|
var import_glob_promise4 = __toESM(require_lib(), 1);
|
|
@@ -1308399,18 +1308562,18 @@ var migration3 = {
|
|
|
1308399
1308562
|
}
|
|
1308400
1308563
|
};
|
|
1308401
1308564
|
async function migrateGeneratorsYml(filepath, context) {
|
|
1308402
|
-
const contents = await (0,
|
|
1308403
|
-
const parsedDocument =
|
|
1308565
|
+
const contents = await (0, import_promises61.readFile)(filepath);
|
|
1308566
|
+
const parsedDocument = import_yaml4.default.parseDocument(contents.toString());
|
|
1308404
1308567
|
const draftGenerators = parsedDocument.get("draft");
|
|
1308405
1308568
|
if (draftGenerators == null) {
|
|
1308406
1308569
|
return;
|
|
1308407
1308570
|
}
|
|
1308408
|
-
if (!
|
|
1308571
|
+
if (!import_yaml4.default.isSeq(draftGenerators)) {
|
|
1308409
1308572
|
context.failWithoutThrowing(`draft generators are not a list in ${filepath}`);
|
|
1308410
1308573
|
return;
|
|
1308411
1308574
|
}
|
|
1308412
1308575
|
draftGenerators.items.forEach((draftGenerator) => {
|
|
1308413
|
-
if (!
|
|
1308576
|
+
if (!import_yaml4.default.isMap(draftGenerator)) {
|
|
1308414
1308577
|
context.failWithoutThrowing(`draft generator is not an object in ${filepath}`);
|
|
1308415
1308578
|
return;
|
|
1308416
1308579
|
}
|
|
@@ -1308426,7 +1308589,7 @@ async function migrateGeneratorsYml(filepath, context) {
|
|
|
1308426
1308589
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
1308427
1308590
|
}
|
|
1308428
1308591
|
});
|
|
1308429
|
-
await (0,
|
|
1308592
|
+
await (0, import_promises61.writeFile)(filepath, parsedDocument.toString());
|
|
1308430
1308593
|
}
|
|
1308431
1308594
|
|
|
1308432
1308595
|
// ../yaml/yaml-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -1308437,8 +1308600,8 @@ var versionMigrations3 = {
|
|
|
1308437
1308600
|
var __default3 = versionMigrations3;
|
|
1308438
1308601
|
|
|
1308439
1308602
|
// ../yaml/yaml-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
1308440
|
-
var
|
|
1308441
|
-
var
|
|
1308603
|
+
var import_promises62 = require("fs/promises");
|
|
1308604
|
+
var import_yaml5 = __toESM(require_dist5(), 1);
|
|
1308442
1308605
|
|
|
1308443
1308606
|
// ../yaml/yaml-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
1308444
1308607
|
var import_glob_promise5 = __toESM(require_lib(), 1);
|
|
@@ -1308478,15 +1308641,15 @@ var migration4 = {
|
|
|
1308478
1308641
|
}
|
|
1308479
1308642
|
};
|
|
1308480
1308643
|
async function migrateFile2(filepath, context) {
|
|
1308481
|
-
const contents = await (0,
|
|
1308482
|
-
const parsedDocument =
|
|
1308644
|
+
const contents = await (0, import_promises62.readFile)(filepath);
|
|
1308645
|
+
const parsedDocument = import_yaml5.default.parseDocument(contents.toString());
|
|
1308483
1308646
|
const addType = (typeName, typeDeclaration) => {
|
|
1308484
1308647
|
const types3 = parsedDocument.get("types");
|
|
1308485
1308648
|
if (types3 == null) {
|
|
1308486
1308649
|
parsedDocument.set("types", {
|
|
1308487
1308650
|
[typeName]: typeDeclaration
|
|
1308488
1308651
|
});
|
|
1308489
|
-
} else if (!
|
|
1308652
|
+
} else if (!import_yaml5.default.isMap(types3)) {
|
|
1308490
1308653
|
context.failWithoutThrowing(`"types" is not a map in ${filepath}`);
|
|
1308491
1308654
|
} else {
|
|
1308492
1308655
|
types3.set(typeName, typeDeclaration);
|
|
@@ -1308496,12 +1308659,12 @@ async function migrateFile2(filepath, context) {
|
|
|
1308496
1308659
|
if (errors2 == null) {
|
|
1308497
1308660
|
return;
|
|
1308498
1308661
|
}
|
|
1308499
|
-
if (!
|
|
1308662
|
+
if (!import_yaml5.default.isMap(errors2)) {
|
|
1308500
1308663
|
context.failWithoutThrowing(`"errors" is not a map in ${filepath}`);
|
|
1308501
1308664
|
return;
|
|
1308502
1308665
|
}
|
|
1308503
1308666
|
for (const errorDeclaration of errors2.items) {
|
|
1308504
|
-
if (!
|
|
1308667
|
+
if (!import_yaml5.default.isMap(errorDeclaration.value)) {
|
|
1308505
1308668
|
context.failWithoutThrowing(`Error "${errorDeclaration.key}" is not a map in ${filepath}`);
|
|
1308506
1308669
|
continue;
|
|
1308507
1308670
|
}
|
|
@@ -1308513,7 +1308676,7 @@ async function migrateFile2(filepath, context) {
|
|
|
1308513
1308676
|
}
|
|
1308514
1308677
|
const httpSection = errorDeclaration.value.get("http");
|
|
1308515
1308678
|
if (httpSection != null) {
|
|
1308516
|
-
if (!
|
|
1308679
|
+
if (!import_yaml5.default.isMap(httpSection)) {
|
|
1308517
1308680
|
context.failWithoutThrowing(`http in "${errorDeclaration.key}" is not a map in ${filepath}`);
|
|
1308518
1308681
|
} else {
|
|
1308519
1308682
|
const statusCode = httpSection.get("statusCode", true);
|
|
@@ -1308522,7 +1308685,7 @@ async function migrateFile2(filepath, context) {
|
|
|
1308522
1308685
|
}
|
|
1308523
1308686
|
}
|
|
1308524
1308687
|
}
|
|
1308525
|
-
await (0,
|
|
1308688
|
+
await (0, import_promises62.writeFile)(filepath, parsedDocument.toString());
|
|
1308526
1308689
|
}
|
|
1308527
1308690
|
|
|
1308528
1308691
|
// ../yaml/yaml-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -1308533,8 +1308696,8 @@ var versionMigrations4 = {
|
|
|
1308533
1308696
|
var __default4 = versionMigrations4;
|
|
1308534
1308697
|
|
|
1308535
1308698
|
// ../yaml/yaml-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
1308536
|
-
var
|
|
1308537
|
-
var
|
|
1308699
|
+
var import_promises63 = require("fs/promises");
|
|
1308700
|
+
var import_yaml6 = __toESM(require_dist5(), 1);
|
|
1308538
1308701
|
|
|
1308539
1308702
|
// ../yaml/yaml-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
1308540
1308703
|
var import_glob_promise6 = __toESM(require_lib(), 1);
|
|
@@ -1308574,37 +1308737,37 @@ var migration5 = {
|
|
|
1308574
1308737
|
}
|
|
1308575
1308738
|
};
|
|
1308576
1308739
|
async function migrateGeneratorsYml2(filepath, context) {
|
|
1308577
|
-
const contents = await (0,
|
|
1308578
|
-
const parsedDocument =
|
|
1308740
|
+
const contents = await (0, import_promises63.readFile)(filepath);
|
|
1308741
|
+
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
1308579
1308742
|
const releaseGenerators = parsedDocument.get("release");
|
|
1308580
1308743
|
if (releaseGenerators == null) {
|
|
1308581
1308744
|
return;
|
|
1308582
1308745
|
}
|
|
1308583
|
-
if (!
|
|
1308746
|
+
if (!import_yaml6.default.isSeq(releaseGenerators)) {
|
|
1308584
1308747
|
context.failWithoutThrowing(`release generators are not a list in ${filepath}`);
|
|
1308585
1308748
|
return;
|
|
1308586
1308749
|
}
|
|
1308587
1308750
|
releaseGenerators.items.forEach((releaseGenerator) => {
|
|
1308588
|
-
if (!
|
|
1308751
|
+
if (!import_yaml6.default.isMap(releaseGenerator)) {
|
|
1308589
1308752
|
context.failWithoutThrowing(`release generator is not an object in ${filepath}`);
|
|
1308590
1308753
|
return;
|
|
1308591
1308754
|
}
|
|
1308592
1308755
|
const outputs = releaseGenerator.get("outputs");
|
|
1308593
|
-
if (!
|
|
1308756
|
+
if (!import_yaml6.default.isMap(outputs)) {
|
|
1308594
1308757
|
context.failWithoutThrowing(`outputs is not an object in ${filepath}`);
|
|
1308595
1308758
|
return;
|
|
1308596
1308759
|
}
|
|
1308597
1308760
|
const githubOutput = outputs.get("github");
|
|
1308598
|
-
if (
|
|
1308761
|
+
if (import_yaml6.default.isMap(githubOutput) && githubOutput.has("repository")) {
|
|
1308599
1308762
|
releaseGenerator.set("github", githubOutput);
|
|
1308600
1308763
|
}
|
|
1308601
1308764
|
const publishing = {};
|
|
1308602
1308765
|
const npmOutput = outputs.get("npm");
|
|
1308603
|
-
if (
|
|
1308766
|
+
if (import_yaml6.default.isMap(npmOutput)) {
|
|
1308604
1308767
|
publishing.npm = npmOutput;
|
|
1308605
1308768
|
}
|
|
1308606
1308769
|
const mavenOutput = outputs.get("maven");
|
|
1308607
|
-
if (
|
|
1308770
|
+
if (import_yaml6.default.isMap(mavenOutput)) {
|
|
1308608
1308771
|
publishing.maven = mavenOutput;
|
|
1308609
1308772
|
}
|
|
1308610
1308773
|
if (Object.keys(publishing).length > 0) {
|
|
@@ -1308612,7 +1308775,7 @@ async function migrateGeneratorsYml2(filepath, context) {
|
|
|
1308612
1308775
|
}
|
|
1308613
1308776
|
releaseGenerator.delete("outputs");
|
|
1308614
1308777
|
});
|
|
1308615
|
-
await (0,
|
|
1308778
|
+
await (0, import_promises63.writeFile)(filepath, parsedDocument.toString());
|
|
1308616
1308779
|
}
|
|
1308617
1308780
|
|
|
1308618
1308781
|
// ../yaml/yaml-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -1308623,7 +1308786,7 @@ var versionMigrations5 = {
|
|
|
1308623
1308786
|
var __default5 = versionMigrations5;
|
|
1308624
1308787
|
|
|
1308625
1308788
|
// ../yaml/yaml-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
1308626
|
-
var
|
|
1308789
|
+
var import_promises64 = require("fs/promises");
|
|
1308627
1308790
|
|
|
1308628
1308791
|
// ../yaml/yaml-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
1308629
1308792
|
var import_glob_promise7 = __toESM(require_lib(), 1);
|
|
@@ -1308654,9 +1308817,9 @@ var migration6 = {
|
|
|
1308654
1308817
|
run: async ({ context }) => {
|
|
1308655
1308818
|
const yamlFiles = await getAllYamlFiles4(context);
|
|
1308656
1308819
|
for (const filepath of yamlFiles) {
|
|
1308657
|
-
const contents = await (0,
|
|
1308820
|
+
const contents = await (0, import_promises64.readFile)(filepath);
|
|
1308658
1308821
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
1308659
|
-
await (0,
|
|
1308822
|
+
await (0, import_promises64.writeFile)(filepath, newContents);
|
|
1308660
1308823
|
}
|
|
1308661
1308824
|
}
|
|
1308662
1308825
|
};
|
|
@@ -1308669,7 +1308832,7 @@ var versionMigrations6 = {
|
|
|
1308669
1308832
|
var __default6 = versionMigrations6;
|
|
1308670
1308833
|
|
|
1308671
1308834
|
// ../yaml/yaml-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
1308672
|
-
var
|
|
1308835
|
+
var import_promises65 = require("fs/promises");
|
|
1308673
1308836
|
|
|
1308674
1308837
|
// ../yaml/yaml-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
1308675
1308838
|
var import_glob_promise8 = __toESM(require_lib(), 1);
|
|
@@ -1308700,9 +1308863,9 @@ var migration7 = {
|
|
|
1308700
1308863
|
run: async ({ context }) => {
|
|
1308701
1308864
|
const yamlFiles = await getAllRootApiYamlFiles(context);
|
|
1308702
1308865
|
for (const filepath of yamlFiles) {
|
|
1308703
|
-
const contents = await (0,
|
|
1308866
|
+
const contents = await (0, import_promises65.readFile)(filepath);
|
|
1308704
1308867
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
1308705
|
-
await (0,
|
|
1308868
|
+
await (0, import_promises65.writeFile)(filepath, newContents);
|
|
1308706
1308869
|
}
|
|
1308707
1308870
|
}
|
|
1308708
1308871
|
};
|
|
@@ -1308715,7 +1308878,7 @@ var versionMigrations7 = {
|
|
|
1308715
1308878
|
var __default7 = versionMigrations7;
|
|
1308716
1308879
|
|
|
1308717
1308880
|
// ../yaml/yaml-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
1308718
|
-
var
|
|
1308881
|
+
var import_promises66 = require("fs/promises");
|
|
1308719
1308882
|
|
|
1308720
1308883
|
// ../yaml/yaml-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
1308721
1308884
|
var import_glob_promise9 = __toESM(require_lib(), 1);
|
|
@@ -1308822,7 +1308985,7 @@ var migration8 = {
|
|
|
1308822
1308985
|
}
|
|
1308823
1308986
|
};
|
|
1308824
1308987
|
async function migrateGeneratorsYml3(filepath) {
|
|
1308825
|
-
const contentsStr = await (0,
|
|
1308988
|
+
const contentsStr = await (0, import_promises66.readFile)(filepath);
|
|
1308826
1308989
|
const contents = js_yaml_default.load(contentsStr.toString());
|
|
1308827
1308990
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
1308828
1308991
|
let newGeneratorsConfiguration = {};
|
|
@@ -1308840,7 +1309003,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
1308840
1309003
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
1308841
1309004
|
};
|
|
1308842
1309005
|
}
|
|
1308843
|
-
await (0,
|
|
1309006
|
+
await (0, import_promises66.writeFile)(filepath, js_yaml_default.dump(newGeneratorsConfiguration));
|
|
1308844
1309007
|
}
|
|
1308845
1309008
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
1308846
1309009
|
const newSchema = {
|
|
@@ -1308915,8 +1309078,8 @@ var versionMigrations8 = {
|
|
|
1308915
1309078
|
var __default8 = versionMigrations8;
|
|
1308916
1309079
|
|
|
1308917
1309080
|
// ../yaml/yaml-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
1308918
|
-
var
|
|
1308919
|
-
var
|
|
1309081
|
+
var import_promises67 = require("fs/promises");
|
|
1309082
|
+
var import_yaml7 = __toESM(require_dist5(), 1);
|
|
1308920
1309083
|
|
|
1308921
1309084
|
// ../yaml/yaml-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
1308922
1309085
|
var import_glob_promise10 = __toESM(require_lib(), 1);
|
|
@@ -1308956,10 +1309119,10 @@ var migration9 = {
|
|
|
1308956
1309119
|
}
|
|
1308957
1309120
|
};
|
|
1308958
1309121
|
async function migrateRootApiFile(filepath) {
|
|
1308959
|
-
const contents = await (0,
|
|
1308960
|
-
const parsedDocument =
|
|
1309122
|
+
const contents = await (0, import_promises67.readFile)(filepath);
|
|
1309123
|
+
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
1308961
1309124
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
1308962
|
-
if (errorDiscriminant == null || !
|
|
1309125
|
+
if (errorDiscriminant == null || !import_yaml7.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
1308963
1309126
|
return;
|
|
1308964
1309127
|
}
|
|
1308965
1309128
|
parsedDocument.set("error-discrimination", {
|
|
@@ -1308967,7 +1309130,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
1308967
1309130
|
"property-name": errorDiscriminant.value
|
|
1308968
1309131
|
});
|
|
1308969
1309132
|
parsedDocument.delete("error-discriminant");
|
|
1308970
|
-
await (0,
|
|
1309133
|
+
await (0, import_promises67.writeFile)(filepath, parsedDocument.toString());
|
|
1308971
1309134
|
}
|
|
1308972
1309135
|
|
|
1308973
1309136
|
// ../yaml/yaml-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -1308978,8 +1309141,8 @@ var versionMigrations9 = {
|
|
|
1308978
1309141
|
var __default9 = versionMigrations9;
|
|
1308979
1309142
|
|
|
1308980
1309143
|
// ../yaml/yaml-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
1308981
|
-
var
|
|
1308982
|
-
var
|
|
1309144
|
+
var import_promises68 = require("fs/promises");
|
|
1309145
|
+
var import_yaml8 = __toESM(require_dist5(), 1);
|
|
1308983
1309146
|
|
|
1308984
1309147
|
// ../yaml/yaml-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
1308985
1309148
|
var import_glob_promise11 = __toESM(require_lib(), 1);
|
|
@@ -1309019,24 +1309182,24 @@ var migration10 = {
|
|
|
1309019
1309182
|
}
|
|
1309020
1309183
|
};
|
|
1309021
1309184
|
async function migrateYamlFile(filepath, context) {
|
|
1309022
|
-
const contents = await (0,
|
|
1309023
|
-
const parsedDocument =
|
|
1309185
|
+
const contents = await (0, import_promises68.readFile)(filepath);
|
|
1309186
|
+
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
1309024
1309187
|
const services = parsedDocument.get("services");
|
|
1309025
1309188
|
if (services == null) {
|
|
1309026
1309189
|
return;
|
|
1309027
1309190
|
}
|
|
1309028
|
-
if (!
|
|
1309191
|
+
if (!import_yaml8.default.isMap(services)) {
|
|
1309029
1309192
|
throw new Error("'services' is not a map");
|
|
1309030
1309193
|
}
|
|
1309031
1309194
|
const httpServices = services.get("http");
|
|
1309032
1309195
|
if (httpServices == null) {
|
|
1309033
1309196
|
return;
|
|
1309034
1309197
|
}
|
|
1309035
|
-
if (!
|
|
1309198
|
+
if (!import_yaml8.default.isMap(httpServices)) {
|
|
1309036
1309199
|
throw new Error("'http' is not a map");
|
|
1309037
1309200
|
}
|
|
1309038
1309201
|
for (const service of httpServices.items) {
|
|
1309039
|
-
if (!
|
|
1309202
|
+
if (!import_yaml8.default.isMap(service.value)) {
|
|
1309040
1309203
|
context.failWithoutThrowing(`Service '${service.key}' is not a map`);
|
|
1309041
1309204
|
continue;
|
|
1309042
1309205
|
}
|
|
@@ -1309044,12 +1309207,12 @@ async function migrateYamlFile(filepath, context) {
|
|
|
1309044
1309207
|
if (endpoints == null) {
|
|
1309045
1309208
|
continue;
|
|
1309046
1309209
|
}
|
|
1309047
|
-
if (!
|
|
1309210
|
+
if (!import_yaml8.default.isMap(endpoints)) {
|
|
1309048
1309211
|
context.failWithoutThrowing(`Endpoints are not a map in service '${service.key}'`);
|
|
1309049
1309212
|
continue;
|
|
1309050
1309213
|
}
|
|
1309051
1309214
|
for (const endpoint of endpoints.items) {
|
|
1309052
|
-
if (!
|
|
1309215
|
+
if (!import_yaml8.default.isMap(endpoint.value)) {
|
|
1309053
1309216
|
context.failWithoutThrowing(`Endpoint ${endpoint.key} is not a map in service '${service.key}'`);
|
|
1309054
1309217
|
continue;
|
|
1309055
1309218
|
}
|
|
@@ -1309059,14 +1309222,14 @@ async function migrateYamlFile(filepath, context) {
|
|
|
1309059
1309222
|
context.failWithoutThrowing("Failed to convert endpoint", e);
|
|
1309060
1309223
|
}
|
|
1309061
1309224
|
}
|
|
1309062
|
-
await (0,
|
|
1309225
|
+
await (0, import_promises68.writeFile)(filepath, parsedDocument.toString());
|
|
1309063
1309226
|
}
|
|
1309064
1309227
|
}
|
|
1309065
1309228
|
function convertEndpoint18({ document: document4, endpoint }) {
|
|
1309066
|
-
const newRequest = new
|
|
1309229
|
+
const newRequest = new import_yaml8.default.YAMLMap();
|
|
1309067
1309230
|
const parsedRequestBody = parseRequestBody(endpoint);
|
|
1309068
1309231
|
if (parsedRequestBody != null) {
|
|
1309069
|
-
let newBody = new
|
|
1309232
|
+
let newBody = new import_yaml8.default.YAMLMap();
|
|
1309070
1309233
|
const { requestBodyType, docs: originalRequestDocs } = parsedRequestBody;
|
|
1309071
1309234
|
if (originalRequestDocs != null) {
|
|
1309072
1309235
|
newBody.set("docs", originalRequestDocs);
|
|
@@ -1309074,11 +1309237,11 @@ function convertEndpoint18({ document: document4, endpoint }) {
|
|
|
1309074
1309237
|
newBody.set("type", requestBodyType);
|
|
1309075
1309238
|
const documentTypes = document4.get("types");
|
|
1309076
1309239
|
if (documentTypes != null) {
|
|
1309077
|
-
if (!
|
|
1309240
|
+
if (!import_yaml8.default.isMap(documentTypes)) {
|
|
1309078
1309241
|
throw new Error("types are not a map");
|
|
1309079
1309242
|
}
|
|
1309080
1309243
|
const maybeTypeDeclarationForRequest = documentTypes.get(requestBodyType);
|
|
1309081
|
-
if (maybeTypeDeclarationForRequest != null &&
|
|
1309244
|
+
if (maybeTypeDeclarationForRequest != null && import_yaml8.default.isMap(maybeTypeDeclarationForRequest)) {
|
|
1309082
1309245
|
const objectExtends = maybeTypeDeclarationForRequest.get("extends");
|
|
1309083
1309246
|
const objectProperties = maybeTypeDeclarationForRequest.get("properties");
|
|
1309084
1309247
|
if (objectExtends != null || objectProperties != null) {
|
|
@@ -1309113,7 +1309276,7 @@ function parseRequestBody(endpoint) {
|
|
|
1309113
1309276
|
if (typeof requestBody === "string") {
|
|
1309114
1309277
|
return { requestBodyType: requestBody, docs: void 0 };
|
|
1309115
1309278
|
}
|
|
1309116
|
-
if (
|
|
1309279
|
+
if (import_yaml8.default.isMap(requestBody)) {
|
|
1309117
1309280
|
const type2 = requestBody.get("type");
|
|
1309118
1309281
|
if (type2 == null) {
|
|
1309119
1309282
|
throw new Error("request type does not exist");
|
|
@@ -1309143,10 +1309306,10 @@ var import_legacy_docs_config = __toESM(require_legacy_docs_config(), 1);
|
|
|
1309143
1309306
|
var LegacyDocsSerializers = __toESM(require_serialization34(), 1);
|
|
1309144
1309307
|
|
|
1309145
1309308
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
1309146
|
-
var
|
|
1309309
|
+
var import_promises69 = require("fs/promises");
|
|
1309147
1309310
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
1309148
1309311
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1309149
|
-
const contentsStr = await (0,
|
|
1309312
|
+
const contentsStr = await (0, import_promises69.readFile)(filepath);
|
|
1309150
1309313
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
1309151
1309314
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
1309152
1309315
|
if (result.ok) {
|
|
@@ -1309164,7 +1309327,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
1309164
1309327
|
}
|
|
1309165
1309328
|
|
|
1309166
1309329
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
1309167
|
-
var
|
|
1309330
|
+
var import_promises71 = require("fs/promises");
|
|
1309168
1309331
|
|
|
1309169
1309332
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
1309170
1309333
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -1309345,10 +1309508,10 @@ __export(legacy_exports, {
|
|
|
1309345
1309508
|
});
|
|
1309346
1309509
|
|
|
1309347
1309510
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
1309348
|
-
var
|
|
1309511
|
+
var import_promises70 = require("fs/promises");
|
|
1309349
1309512
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
1309350
1309513
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1309351
|
-
const contentsStr = await (0,
|
|
1309514
|
+
const contentsStr = await (0, import_promises70.readFile)(filepath);
|
|
1309352
1309515
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
1309353
1309516
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
1309354
1309517
|
if (result.success) {
|
|
@@ -1309378,7 +1309541,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
1309378
1309541
|
var APIS_DIRECTORY2 = "apis";
|
|
1309379
1309542
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
1309380
1309543
|
const absolutePathToApisDirectory = join(absolutePathToFernDirectory, RelativeFilePath.of(APIS_DIRECTORY2));
|
|
1309381
|
-
await (0,
|
|
1309544
|
+
await (0, import_promises71.mkdir)(absolutePathToApisDirectory);
|
|
1309382
1309545
|
for (const workspace of workspaces) {
|
|
1309383
1309546
|
const absolutePathToWorkspace = join(absolutePathToFernDirectory, RelativeFilePath.of(workspace));
|
|
1309384
1309547
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -1309386,11 +1309549,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
1309386
1309549
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
1309387
1309550
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1309388
1309551
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1309389
|
-
await (0,
|
|
1309552
|
+
await (0, import_promises71.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1309390
1309553
|
}
|
|
1309391
1309554
|
const absolutePathToNestedWorkspace = join(absolutePathToApisDirectory, RelativeFilePath.of(workspace));
|
|
1309392
1309555
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1309393
|
-
await (0,
|
|
1309556
|
+
await (0, import_promises71.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1309394
1309557
|
}
|
|
1309395
1309558
|
}
|
|
1309396
1309559
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -1309403,7 +1309566,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
1309403
1309566
|
generatorsConfiguration,
|
|
1309404
1309567
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1309405
1309568
|
});
|
|
1309406
|
-
await (0,
|
|
1309569
|
+
await (0, import_promises71.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309407
1309570
|
return convertedResponse.docsURLs;
|
|
1309408
1309571
|
}
|
|
1309409
1309572
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -1309417,19 +1309580,19 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
1309417
1309580
|
apiName
|
|
1309418
1309581
|
});
|
|
1309419
1309582
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1309420
|
-
await (0,
|
|
1309583
|
+
await (0, import_promises71.writeFile)(absolutePathToDocsConfig, js_yaml_default.dump(convertedDocsConfig));
|
|
1309421
1309584
|
}
|
|
1309422
1309585
|
|
|
1309423
1309586
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
1309424
|
-
var
|
|
1309587
|
+
var import_promises72 = require("fs/promises");
|
|
1309425
1309588
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1309426
1309589
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
1309427
1309590
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
1309428
1309591
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1309429
1309592
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1309430
1309593
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1309431
|
-
await (0,
|
|
1309432
|
-
await (0,
|
|
1309594
|
+
await (0, import_promises72.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1309595
|
+
await (0, import_promises72.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1309433
1309596
|
}
|
|
1309434
1309597
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
1309435
1309598
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1309442,7 +1309605,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
1309442
1309605
|
apiName: void 0
|
|
1309443
1309606
|
});
|
|
1309444
1309607
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1309445
|
-
await (0,
|
|
1309608
|
+
await (0, import_promises72.writeFile)(absolutePathToDocsConfig, js_yaml_default.dump(convertedDocsConfig));
|
|
1309446
1309609
|
}
|
|
1309447
1309610
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
1309448
1309611
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1309454,22 +1309617,22 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
1309454
1309617
|
generatorsConfiguration,
|
|
1309455
1309618
|
pathModificationStrategy: "MoveUp"
|
|
1309456
1309619
|
});
|
|
1309457
|
-
await (0,
|
|
1309620
|
+
await (0, import_promises72.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309458
1309621
|
return convertedResponse.docsURLs;
|
|
1309459
1309622
|
}
|
|
1309460
1309623
|
|
|
1309461
1309624
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
1309462
|
-
var
|
|
1309625
|
+
var import_promises73 = require("fs/promises");
|
|
1309463
1309626
|
var APIS_DIRECTORY3 = "apis";
|
|
1309464
1309627
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
1309465
1309628
|
const absolutePathToApisDirectory = join(absolutePathToFernDirectory, RelativeFilePath.of(APIS_DIRECTORY3));
|
|
1309466
|
-
await (0,
|
|
1309629
|
+
await (0, import_promises73.mkdir)(absolutePathToApisDirectory);
|
|
1309467
1309630
|
for (const workspace of workspaces) {
|
|
1309468
1309631
|
const absolutePathToWorkspace = join(absolutePathToFernDirectory, RelativeFilePath.of(workspace));
|
|
1309469
1309632
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
1309470
1309633
|
const absolutePathToNestedWorkspace = join(absolutePathToApisDirectory, RelativeFilePath.of(workspace));
|
|
1309471
1309634
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1309472
|
-
await (0,
|
|
1309635
|
+
await (0, import_promises73.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1309473
1309636
|
}
|
|
1309474
1309637
|
}
|
|
1309475
1309638
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -1309482,15 +1309645,15 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
1309482
1309645
|
generatorsConfiguration,
|
|
1309483
1309646
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1309484
1309647
|
});
|
|
1309485
|
-
await (0,
|
|
1309648
|
+
await (0, import_promises73.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309486
1309649
|
}
|
|
1309487
1309650
|
|
|
1309488
1309651
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
1309489
|
-
var
|
|
1309652
|
+
var import_promises74 = require("fs/promises");
|
|
1309490
1309653
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1309491
1309654
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
1309492
1309655
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1309493
|
-
await (0,
|
|
1309656
|
+
await (0, import_promises74.rmdir)(absolutePathToWorkspace, { recursive: true });
|
|
1309494
1309657
|
}
|
|
1309495
1309658
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
1309496
1309659
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1309502,7 +1309665,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
1309502
1309665
|
generatorsConfiguration,
|
|
1309503
1309666
|
pathModificationStrategy: "MoveUp"
|
|
1309504
1309667
|
});
|
|
1309505
|
-
await (0,
|
|
1309668
|
+
await (0, import_promises74.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309506
1309669
|
}
|
|
1309507
1309670
|
|
|
1309508
1309671
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -1309579,8 +1309742,8 @@ var versionMigrations11 = {
|
|
|
1309579
1309742
|
var __default11 = versionMigrations11;
|
|
1309580
1309743
|
|
|
1309581
1309744
|
// ../yaml/yaml-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
1309582
|
-
var
|
|
1309583
|
-
var
|
|
1309745
|
+
var import_promises75 = require("fs/promises");
|
|
1309746
|
+
var import_yaml9 = __toESM(require_dist5(), 1);
|
|
1309584
1309747
|
|
|
1309585
1309748
|
// ../yaml/yaml-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
1309586
1309749
|
var import_glob_promise12 = __toESM(require_lib(), 1);
|
|
@@ -1309620,24 +1309783,24 @@ var migration12 = {
|
|
|
1309620
1309783
|
}
|
|
1309621
1309784
|
};
|
|
1309622
1309785
|
async function migrateYamlFile2(filepath, context) {
|
|
1309623
|
-
const contents = await (0,
|
|
1309624
|
-
const parsedDocument =
|
|
1309786
|
+
const contents = await (0, import_promises75.readFile)(filepath);
|
|
1309787
|
+
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
1309625
1309788
|
const types3 = parsedDocument.get("types");
|
|
1309626
1309789
|
if (types3 == null) {
|
|
1309627
1309790
|
return;
|
|
1309628
1309791
|
}
|
|
1309629
|
-
if (!
|
|
1309792
|
+
if (!import_yaml9.default.isMap(types3)) {
|
|
1309630
1309793
|
throw new Error("'types' is not a map");
|
|
1309631
1309794
|
}
|
|
1309632
1309795
|
for (const type2 of types3.items) {
|
|
1309633
|
-
if (!
|
|
1309796
|
+
if (!import_yaml9.default.isMap(type2.value)) {
|
|
1309634
1309797
|
continue;
|
|
1309635
1309798
|
}
|
|
1309636
1309799
|
const examples = type2.value.get("examples");
|
|
1309637
1309800
|
if (examples == null) {
|
|
1309638
1309801
|
continue;
|
|
1309639
1309802
|
}
|
|
1309640
|
-
if (!
|
|
1309803
|
+
if (!import_yaml9.default.isSeq(examples)) {
|
|
1309641
1309804
|
context.failWithoutThrowing("'examples' are not a list");
|
|
1309642
1309805
|
continue;
|
|
1309643
1309806
|
}
|
|
@@ -1309646,7 +1309809,7 @@ async function migrateYamlFile2(filepath, context) {
|
|
|
1309646
1309809
|
examples.set(i2, { value });
|
|
1309647
1309810
|
}
|
|
1309648
1309811
|
}
|
|
1309649
|
-
await (0,
|
|
1309812
|
+
await (0, import_promises75.writeFile)(filepath, parsedDocument.toString());
|
|
1309650
1309813
|
}
|
|
1309651
1309814
|
|
|
1309652
1309815
|
// ../yaml/yaml-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -1309657,8 +1309820,8 @@ var versionMigrations12 = {
|
|
|
1309657
1309820
|
var __default12 = versionMigrations12;
|
|
1309658
1309821
|
|
|
1309659
1309822
|
// ../yaml/yaml-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
1309660
|
-
var
|
|
1309661
|
-
var
|
|
1309823
|
+
var import_promises76 = require("fs/promises");
|
|
1309824
|
+
var import_yaml10 = __toESM(require_dist5(), 1);
|
|
1309662
1309825
|
|
|
1309663
1309826
|
// ../yaml/yaml-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
1309664
1309827
|
var import_glob_promise13 = __toESM(require_lib(), 1);
|
|
@@ -1309698,14 +1309861,14 @@ var migration13 = {
|
|
|
1309698
1309861
|
}
|
|
1309699
1309862
|
};
|
|
1309700
1309863
|
async function migrateYamlFile3(filepath, context) {
|
|
1309701
|
-
const contents = await (0,
|
|
1309702
|
-
const parsedDocument =
|
|
1309703
|
-
if (!
|
|
1309864
|
+
const contents = await (0, import_promises76.readFile)(filepath);
|
|
1309865
|
+
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
1309866
|
+
if (!import_yaml10.default.isMap(parsedDocument.contents)) {
|
|
1309704
1309867
|
return context.failAndThrow("File is not a map");
|
|
1309705
1309868
|
}
|
|
1309706
1309869
|
for (const pair of parsedDocument.contents.items) {
|
|
1309707
|
-
if (
|
|
1309708
|
-
if (!
|
|
1309870
|
+
if (import_yaml10.default.isScalar(pair.key) && pair.key.value === "services") {
|
|
1309871
|
+
if (!import_yaml10.default.isMap(pair.value)) {
|
|
1309709
1309872
|
return context.failAndThrow("Services are not a map");
|
|
1309710
1309873
|
}
|
|
1309711
1309874
|
const httpServices = pair.value.get("http");
|
|
@@ -1309713,7 +1309876,7 @@ async function migrateYamlFile3(filepath, context) {
|
|
|
1309713
1309876
|
parsedDocument.contents.delete("services");
|
|
1309714
1309877
|
return;
|
|
1309715
1309878
|
}
|
|
1309716
|
-
if (!
|
|
1309879
|
+
if (!import_yaml10.default.isMap(httpServices)) {
|
|
1309717
1309880
|
return context.failAndThrow("http is not a map");
|
|
1309718
1309881
|
}
|
|
1309719
1309882
|
const [firstService, ...remainingServices] = httpServices.items;
|
|
@@ -1309728,7 +1309891,7 @@ async function migrateYamlFile3(filepath, context) {
|
|
|
1309728
1309891
|
pair.value = firstService.value;
|
|
1309729
1309892
|
}
|
|
1309730
1309893
|
}
|
|
1309731
|
-
await (0,
|
|
1309894
|
+
await (0, import_promises76.writeFile)(filepath, parsedDocument.toString());
|
|
1309732
1309895
|
}
|
|
1309733
1309896
|
|
|
1309734
1309897
|
// ../yaml/yaml-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -1309739,8 +1309902,8 @@ var versionMigrations13 = {
|
|
|
1309739
1309902
|
var __default13 = versionMigrations13;
|
|
1309740
1309903
|
|
|
1309741
1309904
|
// ../yaml/yaml-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
1309742
|
-
var
|
|
1309743
|
-
var
|
|
1309905
|
+
var import_promises77 = require("fs/promises");
|
|
1309906
|
+
var import_yaml11 = __toESM(require_dist5(), 1);
|
|
1309744
1309907
|
|
|
1309745
1309908
|
// ../yaml/yaml-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
1309746
1309909
|
var import_glob_promise14 = __toESM(require_lib(), 1);
|
|
@@ -1309780,26 +1309943,26 @@ var migration14 = {
|
|
|
1309780
1309943
|
}
|
|
1309781
1309944
|
};
|
|
1309782
1309945
|
async function migrateYamlFile4(filepath, context) {
|
|
1309783
|
-
const contents = await (0,
|
|
1309784
|
-
const parsedDocument =
|
|
1309785
|
-
if (!
|
|
1309946
|
+
const contents = await (0, import_promises77.readFile)(filepath);
|
|
1309947
|
+
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1309948
|
+
if (!import_yaml11.default.isMap(parsedDocument.contents)) {
|
|
1309786
1309949
|
return context.failAndThrow("File is not a map");
|
|
1309787
1309950
|
}
|
|
1309788
1309951
|
const service = parsedDocument.contents.get("service");
|
|
1309789
1309952
|
if (service == null) {
|
|
1309790
1309953
|
return;
|
|
1309791
1309954
|
}
|
|
1309792
|
-
if (!
|
|
1309955
|
+
if (!import_yaml11.default.isMap(service)) {
|
|
1309793
1309956
|
return context.failAndThrow("service is not a map");
|
|
1309794
1309957
|
}
|
|
1309795
|
-
const indexOfServiceDocsPair = service.items.findIndex((item) =>
|
|
1309958
|
+
const indexOfServiceDocsPair = service.items.findIndex((item) => import_yaml11.default.isScalar(item.key) && item.key.value === "docs");
|
|
1309796
1309959
|
const docsPair = service.items[indexOfServiceDocsPair];
|
|
1309797
1309960
|
if (docsPair == null) {
|
|
1309798
1309961
|
return;
|
|
1309799
1309962
|
}
|
|
1309800
1309963
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
1309801
1309964
|
parsedDocument.contents.items.unshift(docsPair);
|
|
1309802
|
-
await (0,
|
|
1309965
|
+
await (0, import_promises77.writeFile)(filepath, parsedDocument.toString());
|
|
1309803
1309966
|
}
|
|
1309804
1309967
|
|
|
1309805
1309968
|
// ../yaml/yaml-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -1309810,7 +1309973,7 @@ var versionMigrations14 = {
|
|
|
1309810
1309973
|
var __default14 = versionMigrations14;
|
|
1309811
1309974
|
|
|
1309812
1309975
|
// ../yaml/yaml-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
1309813
|
-
var
|
|
1309976
|
+
var import_promises78 = require("fs/promises");
|
|
1309814
1309977
|
|
|
1309815
1309978
|
// ../yaml/yaml-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
1309816
1309979
|
var import_glob_promise15 = __toESM(require_lib(), 1);
|
|
@@ -1309850,14 +1310013,14 @@ var migration15 = {
|
|
|
1309850
1310013
|
}
|
|
1309851
1310014
|
};
|
|
1309852
1310015
|
async function migrateYamlFile5(filepath) {
|
|
1309853
|
-
const contents = await (0,
|
|
1310016
|
+
const contents = await (0, import_promises78.readFile)(filepath);
|
|
1309854
1310017
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
1309855
1310018
|
const regex4 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
1309856
1310019
|
const updatedSnapshot = contents.toString().replace(regex4, (_match, _prefix, domain2) => {
|
|
1309857
1310020
|
return `docs:
|
|
1309858
1310021
|
domain: "${domain2}.${domainSuffix}"`;
|
|
1309859
1310022
|
});
|
|
1309860
|
-
await (0,
|
|
1310023
|
+
await (0, import_promises78.writeFile)(filepath, updatedSnapshot.toString());
|
|
1309861
1310024
|
}
|
|
1309862
1310025
|
|
|
1309863
1310026
|
// ../yaml/yaml-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -1309958,7 +1310121,7 @@ ${source_default.dim(migration16.summary)}`
|
|
|
1309958
1310121
|
}
|
|
1309959
1310122
|
|
|
1309960
1310123
|
// src/commands/upgrade/upgrade.ts
|
|
1309961
|
-
var
|
|
1310124
|
+
var import_promises79 = require("fs/promises");
|
|
1309962
1310125
|
|
|
1309963
1310126
|
// ../../../node_modules/.pnpm/immer@9.0.15/node_modules/immer/dist/immer.esm.mjs
|
|
1309964
1310127
|
function n(n2) {
|
|
@@ -1310447,7 +1310610,7 @@ async function upgrade({
|
|
|
1310447
1310610
|
const newProjectConfig = immer_esm_default(projectConfig.rawConfig, (draft) => {
|
|
1310448
1310611
|
draft.version = fernCliUpgradeInfo.latestVersion;
|
|
1310449
1310612
|
});
|
|
1310450
|
-
await (0,
|
|
1310613
|
+
await (0, import_promises79.writeFile)(projectConfig._absolutePath, JSON.stringify(newProjectConfig, void 0, 2));
|
|
1310451
1310614
|
cliContext.logger.info(
|
|
1310452
1310615
|
`Upgrading from ${source_default.dim(cliContext.environment.packageVersion)} \u2192 ${source_default.green(
|
|
1310453
1310616
|
fernCliUpgradeInfo.latestVersion
|
|
@@ -1310468,125 +1310631,6 @@ async function upgrade({
|
|
|
1310468
1310631
|
}
|
|
1310469
1310632
|
}
|
|
1310470
1310633
|
|
|
1310471
|
-
// src/commands/upgrade/upgradeGenerator.ts
|
|
1310472
|
-
var import_promises79 = require("fs/promises");
|
|
1310473
|
-
var import_path42 = __toESM(require("path"), 1);
|
|
1310474
|
-
var semver3 = __toESM(require_semver2(), 1);
|
|
1310475
|
-
var import_yaml11 = __toESM(require_dist5(), 1);
|
|
1310476
|
-
async function loadAndUpdateGenerators({
|
|
1310477
|
-
absolutePathToWorkspace,
|
|
1310478
|
-
context,
|
|
1310479
|
-
generatorFilter,
|
|
1310480
|
-
groupFilter,
|
|
1310481
|
-
includeMajor
|
|
1310482
|
-
}) {
|
|
1310483
|
-
const filepath = generators_yml_exports.getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1310484
|
-
if (!await doesPathExist(filepath)) {
|
|
1310485
|
-
context.failAndThrow("Generators configuration file was not found, no generators to upgrade.");
|
|
1310486
|
-
return void 0;
|
|
1310487
|
-
}
|
|
1310488
|
-
const contents = await (0, import_promises79.readFile)(filepath);
|
|
1310489
|
-
context.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1310490
|
-
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1310491
|
-
const generatorGroups = parsedDocument.get("groups");
|
|
1310492
|
-
if (generatorGroups == null) {
|
|
1310493
|
-
context.failAndThrow("No groups were found within the generators configuration, no generators to upgrade.");
|
|
1310494
|
-
return void 0;
|
|
1310495
|
-
}
|
|
1310496
|
-
if (!import_yaml11.default.isMap(generatorGroups)) {
|
|
1310497
|
-
context.failAndThrow(`Expected 'groups' to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`);
|
|
1310498
|
-
return void 0;
|
|
1310499
|
-
}
|
|
1310500
|
-
context.logger.debug(`Groups found: ${generatorGroups.toString()}`);
|
|
1310501
|
-
for (const groupBlock of generatorGroups.items) {
|
|
1310502
|
-
const groupName = groupBlock.key;
|
|
1310503
|
-
const group = groupBlock.value;
|
|
1310504
|
-
if (!import_yaml11.default.isMap(group)) {
|
|
1310505
|
-
context.failAndThrow(
|
|
1310506
|
-
`Expected group ${groupName} to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310507
|
-
);
|
|
1310508
|
-
continue;
|
|
1310509
|
-
}
|
|
1310510
|
-
if (groupFilter != null && group.get("name") !== groupName) {
|
|
1310511
|
-
continue;
|
|
1310512
|
-
}
|
|
1310513
|
-
const generators = group.get("generators");
|
|
1310514
|
-
if (!import_yaml11.default.isSeq(generators)) {
|
|
1310515
|
-
context.failAndThrow(
|
|
1310516
|
-
`Expected group ${groupName} to have a 'generators' key in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310517
|
-
);
|
|
1310518
|
-
continue;
|
|
1310519
|
-
}
|
|
1310520
|
-
context.logger.debug(`Generators found: ${generators.toString()}`);
|
|
1310521
|
-
for (const generator of generators.items) {
|
|
1310522
|
-
if (!import_yaml11.default.isMap(generator)) {
|
|
1310523
|
-
context.failAndThrow(
|
|
1310524
|
-
`Expected generator in group ${groupName} to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310525
|
-
);
|
|
1310526
|
-
}
|
|
1310527
|
-
if (generatorFilter != null && generator.get("name") !== generatorFilter) {
|
|
1310528
|
-
continue;
|
|
1310529
|
-
}
|
|
1310530
|
-
const generatorName = generator.get("name");
|
|
1310531
|
-
const normalizedGeneratorName = generators_yml_exports.getGeneratorNameOrThrow(generatorName, context);
|
|
1310532
|
-
const currentVersion = generator.get("version");
|
|
1310533
|
-
const latestVersion2 = await generators_yml_exports.getLatestGeneratorVersion(normalizedGeneratorName, context);
|
|
1310534
|
-
context.logger.debug(`${generatorName}, ${currentVersion}, ${latestVersion2}`);
|
|
1310535
|
-
if (latestVersion2 == null) {
|
|
1310536
|
-
continue;
|
|
1310537
|
-
}
|
|
1310538
|
-
const currentMajor = semver3.major(currentVersion);
|
|
1310539
|
-
const latestMajor = semver3.major(latestVersion2);
|
|
1310540
|
-
if (currentMajor === latestMajor || includeMajor) {
|
|
1310541
|
-
generator.set("version", latestVersion2);
|
|
1310542
|
-
context.logger.info(source_default.green(`${generatorName} has been upgraded to latest in group: ${groupName}`));
|
|
1310543
|
-
}
|
|
1310544
|
-
}
|
|
1310545
|
-
}
|
|
1310546
|
-
return parsedDocument.toString();
|
|
1310547
|
-
}
|
|
1310548
|
-
async function upgradeGenerator2({
|
|
1310549
|
-
cliContext,
|
|
1310550
|
-
generator,
|
|
1310551
|
-
group,
|
|
1310552
|
-
project: { apiWorkspaces },
|
|
1310553
|
-
includeMajor
|
|
1310554
|
-
}) {
|
|
1310555
|
-
await Promise.all(
|
|
1310556
|
-
apiWorkspaces.map(async (workspace) => {
|
|
1310557
|
-
await cliContext.runTaskForWorkspace(workspace, async (context) => {
|
|
1310558
|
-
var _a6;
|
|
1310559
|
-
const generatorsConfiguration = await generators_yml_exports.loadRawGeneratorsConfiguration({
|
|
1310560
|
-
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1310561
|
-
context
|
|
1310562
|
-
}) ?? {};
|
|
1310563
|
-
if (generatorsConfiguration == null || generatorsConfiguration.groups == null) {
|
|
1310564
|
-
context.failAndThrow(
|
|
1310565
|
-
"No groups were found within the generators configuration, no generators to upgrade."
|
|
1310566
|
-
);
|
|
1310567
|
-
return;
|
|
1310568
|
-
}
|
|
1310569
|
-
context.logger.info(`Upgrading generators in workspace: ${workspace.workspaceName}`);
|
|
1310570
|
-
const updatedConfiguration = await loadAndUpdateGenerators({
|
|
1310571
|
-
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1310572
|
-
context,
|
|
1310573
|
-
generatorFilter: generator,
|
|
1310574
|
-
groupFilter: group,
|
|
1310575
|
-
includeMajor
|
|
1310576
|
-
});
|
|
1310577
|
-
if (updatedConfiguration != null) {
|
|
1310578
|
-
await (0, import_promises79.writeFile)(
|
|
1310579
|
-
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1310580
|
-
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1310581
|
-
}),
|
|
1310582
|
-
updatedConfiguration
|
|
1310583
|
-
);
|
|
1310584
|
-
}
|
|
1310585
|
-
});
|
|
1310586
|
-
})
|
|
1310587
|
-
);
|
|
1310588
|
-
}
|
|
1310589
|
-
|
|
1310590
1310634
|
// src/commands/validate/validateWorkspaces.ts
|
|
1310591
1310635
|
async function validateWorkspaces({
|
|
1310592
1310636
|
project,
|
|
@@ -1310792,7 +1310836,6 @@ async function tryRunCli(cliContext) {
|
|
|
1310792
1310836
|
addWriteOverridesCommand(cli, cliContext);
|
|
1310793
1310837
|
addTestCommand(cli, cliContext);
|
|
1310794
1310838
|
addUpdateApiSpecCommand(cli, cliContext);
|
|
1310795
|
-
addUpgradeGeneratorCommand(cli, cliContext);
|
|
1310796
1310839
|
addUpgradeCommand({
|
|
1310797
1310840
|
cli,
|
|
1310798
1310841
|
cliContext,
|
|
@@ -1310801,7 +1310844,7 @@ async function tryRunCli(cliContext) {
|
|
|
1310801
1310844
|
}
|
|
1310802
1310845
|
});
|
|
1310803
1310846
|
addGetOrganizationCommand(cli, cliContext);
|
|
1310804
|
-
|
|
1310847
|
+
addGeneratorCommands(cli, cliContext);
|
|
1310805
1310848
|
cli.middleware(async (argv) => {
|
|
1310806
1310849
|
cliContext.setLogLevel(argv["log-level"]);
|
|
1310807
1310850
|
cliContext.logDebugInfo();
|
|
@@ -1311235,48 +1311278,6 @@ function addUpgradeCommand({
|
|
|
1311235
1311278
|
}
|
|
1311236
1311279
|
);
|
|
1311237
1311280
|
}
|
|
1311238
|
-
function addUpgradeGeneratorCommand(cli, cliContext) {
|
|
1311239
|
-
cli.command(
|
|
1311240
|
-
"generator upgrade",
|
|
1311241
|
-
`Upgrades the specified generator in ${GENERATORS_CONFIGURATION_FILENAME} to the latest stable version.`,
|
|
1311242
|
-
(yargs) => yargs.option("generator", {
|
|
1311243
|
-
string: true,
|
|
1311244
|
-
description: "The type of generator to upgrade, ex: `fern-typescript-node-sdk`."
|
|
1311245
|
-
}).option("group", {
|
|
1311246
|
-
string: true,
|
|
1311247
|
-
description: "The group in which the generator is located, if group is not specified, the all generators of the specified type will be upgraded."
|
|
1311248
|
-
}).option("api", {
|
|
1311249
|
-
string: true,
|
|
1311250
|
-
description: "The API to upgrade the generator for. If not specified, the generator will be upgraded for all APIs."
|
|
1311251
|
-
}).option("include-major", {
|
|
1311252
|
-
boolean: true,
|
|
1311253
|
-
default: false,
|
|
1311254
|
-
description: "Whether or not to include major versions within the upgrade. Defaults to false, meaning major versions will be skipped."
|
|
1311255
|
-
}),
|
|
1311256
|
-
async (argv) => {
|
|
1311257
|
-
cliContext.instrumentPostHogEvent({
|
|
1311258
|
-
command: "fern generator upgrade",
|
|
1311259
|
-
properties: {
|
|
1311260
|
-
generator: argv.generator,
|
|
1311261
|
-
version: argv.version,
|
|
1311262
|
-
api: argv.api,
|
|
1311263
|
-
group: argv.group,
|
|
1311264
|
-
includeMajor: argv.includeMajor
|
|
1311265
|
-
}
|
|
1311266
|
-
});
|
|
1311267
|
-
await upgradeGenerator2({
|
|
1311268
|
-
cliContext,
|
|
1311269
|
-
generator: argv.generator,
|
|
1311270
|
-
group: argv.group,
|
|
1311271
|
-
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
1311272
|
-
commandLineApiWorkspace: argv.api,
|
|
1311273
|
-
defaultToAllApiWorkspaces: true
|
|
1311274
|
-
}),
|
|
1311275
|
-
includeMajor: argv.includeMajor
|
|
1311276
|
-
});
|
|
1311277
|
-
}
|
|
1311278
|
-
);
|
|
1311279
|
-
}
|
|
1311280
1311281
|
function addUpdateApiSpecCommand(cli, cliContext) {
|
|
1311281
1311282
|
cli.command(
|
|
1311282
1311283
|
"api update",
|