fern-api 0.39.16 → 0.39.18
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 +539 -503
- 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.18",
|
|
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.18",
|
|
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.18" == null) {
|
|
1197754
1197754
|
this.logger.error("CLI_VERSION is not defined");
|
|
1197755
1197755
|
}
|
|
1197756
|
-
return "0.39.
|
|
1197756
|
+
return "0.39.18";
|
|
1197757
1197757
|
}
|
|
1197758
1197758
|
getCliName() {
|
|
1197759
1197759
|
if ("fern" == null) {
|
|
@@ -1202422,7 +1202422,7 @@ var ExamplePrimitive = {
|
|
|
1202422
1202422
|
},
|
|
1202423
1202423
|
datetime: (value) => {
|
|
1202424
1202424
|
return {
|
|
1202425
|
-
|
|
1202425
|
+
...value,
|
|
1202426
1202426
|
type: "datetime",
|
|
1202427
1202427
|
_visit: function(visitor) {
|
|
1202428
1202428
|
return ExamplePrimitive._visit(this, visitor);
|
|
@@ -1202477,7 +1202477,7 @@ var ExamplePrimitive = {
|
|
|
1202477
1202477
|
case "date":
|
|
1202478
1202478
|
return visitor.date(value.date);
|
|
1202479
1202479
|
case "datetime":
|
|
1202480
|
-
return visitor.datetime(value
|
|
1202480
|
+
return visitor.datetime(value);
|
|
1202481
1202481
|
case "uuid":
|
|
1202482
1202482
|
return visitor.uuid(value.uuid);
|
|
1202483
1202483
|
case "base64":
|
|
@@ -1202692,6 +1202692,7 @@ __export(serialization_exports2, {
|
|
|
1202692
1202692
|
ExampleCodeSampleLanguage: () => ExampleCodeSampleLanguage,
|
|
1202693
1202693
|
ExampleCodeSampleSdk: () => ExampleCodeSampleSdk,
|
|
1202694
1202694
|
ExampleContainer: () => ExampleContainer2,
|
|
1202695
|
+
ExampleDatetime: () => ExampleDatetime,
|
|
1202695
1202696
|
ExampleEndpointCall: () => ExampleEndpointCall,
|
|
1202696
1202697
|
ExampleEndpointErrorResponse: () => ExampleEndpointErrorResponse,
|
|
1202697
1202698
|
ExampleEndpointSuccessResponse: () => ExampleEndpointSuccessResponse2,
|
|
@@ -1206055,6 +1206056,7 @@ __export(types_exports2, {
|
|
|
1206055
1206056
|
EnumValue: () => EnumValue,
|
|
1206056
1206057
|
ExampleAliasType: () => ExampleAliasType,
|
|
1206057
1206058
|
ExampleContainer: () => ExampleContainer2,
|
|
1206059
|
+
ExampleDatetime: () => ExampleDatetime,
|
|
1206058
1206060
|
ExampleEnumType: () => ExampleEnumType,
|
|
1206059
1206061
|
ExampleKeyValuePair: () => ExampleKeyValuePair,
|
|
1206060
1206062
|
ExampleListContainer: () => ExampleListContainer,
|
|
@@ -1206324,6 +1206326,12 @@ var ExampleTypeReference = schemas_exports4.objectWithoutOptionalProperties({
|
|
|
1206324
1206326
|
shape: schemas_exports4.lazy(() => ExampleTypeReferenceShape2)
|
|
1206325
1206327
|
}).extend(WithJsonExample);
|
|
1206326
1206328
|
|
|
1206329
|
+
// ../../ir-sdk/lib/sdk/serialization/resources/types/types/ExampleDatetime.js
|
|
1206330
|
+
var ExampleDatetime = schemas_exports4.objectWithoutOptionalProperties({
|
|
1206331
|
+
datetime: schemas_exports4.date(),
|
|
1206332
|
+
raw: schemas_exports4.string().optional()
|
|
1206333
|
+
});
|
|
1206334
|
+
|
|
1206327
1206335
|
// ../../ir-sdk/lib/sdk/serialization/resources/types/types/ExamplePrimitive.js
|
|
1206328
1206336
|
var ExamplePrimitive2 = schemas_exports4.union("type", {
|
|
1206329
1206337
|
integer: schemas_exports4.object({
|
|
@@ -1206353,9 +1206361,7 @@ var ExamplePrimitive2 = schemas_exports4.union("type", {
|
|
|
1206353
1206361
|
date: schemas_exports4.object({
|
|
1206354
1206362
|
date: schemas_exports4.string()
|
|
1206355
1206363
|
}),
|
|
1206356
|
-
datetime:
|
|
1206357
|
-
datetime: schemas_exports4.date()
|
|
1206358
|
-
}),
|
|
1206364
|
+
datetime: ExampleDatetime,
|
|
1206359
1206365
|
uuid: schemas_exports4.object({
|
|
1206360
1206366
|
uuid: schemas_exports4.string()
|
|
1206361
1206367
|
}),
|
|
@@ -1206387,7 +1206393,7 @@ var ExamplePrimitive2 = schemas_exports4.union("type", {
|
|
|
1206387
1206393
|
case "date":
|
|
1206388
1206394
|
return ExamplePrimitive.date(value.date);
|
|
1206389
1206395
|
case "datetime":
|
|
1206390
|
-
return ExamplePrimitive.datetime(value
|
|
1206396
|
+
return ExamplePrimitive.datetime(value);
|
|
1206391
1206397
|
case "uuid":
|
|
1206392
1206398
|
return ExamplePrimitive.uuid(value.uuid);
|
|
1206393
1206399
|
case "base64":
|
|
@@ -1210371,7 +1210377,8 @@ var StatusCode = schemas_exports5.number();
|
|
|
1210371
1210377
|
// ../openapi-ir-sdk/lib/sdk/serialization/resources/commons/types/Server.js
|
|
1210372
1210378
|
var Server = schemas_exports5.objectWithoutOptionalProperties({
|
|
1210373
1210379
|
name: schemas_exports5.string().optional(),
|
|
1210374
|
-
url: schemas_exports5.string()
|
|
1210380
|
+
url: schemas_exports5.string(),
|
|
1210381
|
+
audiences: schemas_exports5.list(schemas_exports5.string()).optional()
|
|
1210375
1210382
|
}).extend(WithDescription);
|
|
1210376
1210383
|
|
|
1210377
1210384
|
// ../openapi-ir-sdk/lib/sdk/serialization/resources/example/index.js
|
|
@@ -1218159,7 +1218166,8 @@ function convertServer(server) {
|
|
|
1218159
1218166
|
return {
|
|
1218160
1218167
|
url: getServerUrl({ url: server.url, variables: server.variables ?? {} }),
|
|
1218161
1218168
|
description: server.description,
|
|
1218162
|
-
name: getServerName(server)
|
|
1218169
|
+
name: getServerName(server),
|
|
1218170
|
+
audiences: getExtension(server, FernOpenAPIExtension.AUDIENCES)
|
|
1218163
1218171
|
};
|
|
1218164
1218172
|
}
|
|
1218165
1218173
|
function getServerUrl({ url, variables }) {
|
|
@@ -1220683,69 +1220691,93 @@ function buildChannel({ channel, context, declarationFile }) {
|
|
|
1220683
1220691
|
// ../openapi-ir-to-fern/lib/buildEnvironments.js
|
|
1220684
1220692
|
var PRODUCTION_ENVNIRONMENT_NAME = "Production";
|
|
1220685
1220693
|
var DEFAULT_ENVIRONMENT_NAME = "Default";
|
|
1220694
|
+
function extractUrlsFromEnvironmentSchema(record4) {
|
|
1220695
|
+
return Object.entries(record4).reduce((acc, [name2, schemaOrUrl]) => {
|
|
1220696
|
+
if (isRawMultipleBaseUrlsEnvironment(schemaOrUrl)) {
|
|
1220697
|
+
Object.entries(schemaOrUrl.urls).forEach(([urlsName, urlsValue]) => {
|
|
1220698
|
+
acc[urlsName] = urlsValue;
|
|
1220699
|
+
});
|
|
1220700
|
+
} else {
|
|
1220701
|
+
acc[name2] = typeof schemaOrUrl === "string" ? schemaOrUrl : schemaOrUrl.url;
|
|
1220702
|
+
}
|
|
1220703
|
+
return acc;
|
|
1220704
|
+
}, {});
|
|
1220705
|
+
}
|
|
1220686
1220706
|
function buildEnvironments(context) {
|
|
1220687
|
-
var _a6;
|
|
1220688
|
-
const
|
|
1220689
|
-
const
|
|
1220707
|
+
var _a6, _b4;
|
|
1220708
|
+
const topLevelServersWithName = {};
|
|
1220709
|
+
const topLevelSkippedServers = [];
|
|
1220690
1220710
|
for (const server of context.ir.servers) {
|
|
1220711
|
+
const environmentSchema = server.audiences ? {
|
|
1220712
|
+
url: server.url,
|
|
1220713
|
+
audiences: server.audiences
|
|
1220714
|
+
} : server.url;
|
|
1220691
1220715
|
if (server.name == null) {
|
|
1220692
|
-
|
|
1220716
|
+
topLevelSkippedServers.push(environmentSchema);
|
|
1220693
1220717
|
continue;
|
|
1220694
1220718
|
}
|
|
1220695
|
-
|
|
1220719
|
+
topLevelServersWithName[server.name] = environmentSchema;
|
|
1220696
1220720
|
}
|
|
1220697
|
-
const
|
|
1220698
|
-
const
|
|
1220721
|
+
const endpointLevelServersWithName = {};
|
|
1220722
|
+
const endpointLevelSkippedServers = [];
|
|
1220699
1220723
|
for (const endpoint of context.ir.endpoints) {
|
|
1220700
1220724
|
for (const server of endpoint.server) {
|
|
1220725
|
+
const environmentSchema = server.audiences ? {
|
|
1220726
|
+
url: server.url,
|
|
1220727
|
+
audiences: server.audiences
|
|
1220728
|
+
} : server.url;
|
|
1220701
1220729
|
if (server.name == null) {
|
|
1220702
|
-
|
|
1220730
|
+
endpointLevelSkippedServers.push(environmentSchema);
|
|
1220703
1220731
|
continue;
|
|
1220704
1220732
|
}
|
|
1220705
|
-
|
|
1220733
|
+
endpointLevelServersWithName[server.name] = environmentSchema;
|
|
1220706
1220734
|
}
|
|
1220707
1220735
|
}
|
|
1220708
|
-
const
|
|
1220709
|
-
const
|
|
1220710
|
-
if (
|
|
1220736
|
+
const numTopLevelServers = Object.keys(topLevelServersWithName).length;
|
|
1220737
|
+
const numEndpointLevelServers = Object.keys(endpointLevelServersWithName).length;
|
|
1220738
|
+
if (numTopLevelServers === 0 && numEndpointLevelServers === 0) {
|
|
1220711
1220739
|
const singleURL = (_a6 = context.ir.servers[0]) == null ? void 0 : _a6.url;
|
|
1220740
|
+
const singleURLAudiences = (_b4 = context.ir.servers[0]) == null ? void 0 : _b4.audiences;
|
|
1220712
1220741
|
if (singleURL != null) {
|
|
1220713
1220742
|
context.builder.addEnvironment({
|
|
1220714
1220743
|
name: DEFAULT_ENVIRONMENT_NAME,
|
|
1220715
|
-
schema:
|
|
1220744
|
+
schema: singleURLAudiences ? {
|
|
1220745
|
+
url: singleURL,
|
|
1220746
|
+
audiences: singleURLAudiences
|
|
1220747
|
+
} : singleURL
|
|
1220716
1220748
|
});
|
|
1220717
1220749
|
context.builder.setDefaultEnvironment(DEFAULT_ENVIRONMENT_NAME);
|
|
1220718
1220750
|
}
|
|
1220719
|
-
} else if (
|
|
1220751
|
+
} else if (numTopLevelServers > 0 && numEndpointLevelServers === 0) {
|
|
1220720
1220752
|
let count = 0;
|
|
1220721
|
-
if (
|
|
1220722
|
-
context.logger.error(`Skipping servers ${
|
|
1220753
|
+
if (topLevelSkippedServers.length > 0) {
|
|
1220754
|
+
context.logger.error(`Skipping servers ${topLevelSkippedServers.map((server) => typeof server === "string" ? server : server.url).join(", ")} because x-fern-server-name was not provided.`);
|
|
1220723
1220755
|
}
|
|
1220724
|
-
for (const [name2,
|
|
1220756
|
+
for (const [name2, schema2] of Object.entries(topLevelServersWithName)) {
|
|
1220725
1220757
|
if (count === 0) {
|
|
1220726
1220758
|
context.builder.setDefaultEnvironment(name2);
|
|
1220727
1220759
|
}
|
|
1220728
1220760
|
context.builder.addEnvironment({
|
|
1220729
1220761
|
name: name2,
|
|
1220730
|
-
schema:
|
|
1220762
|
+
schema: schema2
|
|
1220731
1220763
|
});
|
|
1220732
1220764
|
count += 1;
|
|
1220733
1220765
|
}
|
|
1220734
|
-
} else if (
|
|
1220735
|
-
if (
|
|
1220736
|
-
context.logger.error(`Skipping servers ${[...
|
|
1220766
|
+
} else if (numEndpointLevelServers > 0) {
|
|
1220767
|
+
if (topLevelSkippedServers.length > 0 || endpointLevelSkippedServers.length > 0) {
|
|
1220768
|
+
context.logger.error(`Skipping servers ${[...topLevelSkippedServers, ...endpointLevelSkippedServers].map((server) => typeof server === "string" ? server : server.url).join(", ")} because x-fern-server-name was not provided.`);
|
|
1220737
1220769
|
}
|
|
1220738
|
-
const
|
|
1220739
|
-
if (
|
|
1220740
|
-
const [name2, _4] =
|
|
1220770
|
+
const toplevelServerEntries = Object.entries(topLevelServersWithName)[0];
|
|
1220771
|
+
if (toplevelServerEntries != null) {
|
|
1220772
|
+
const [name2, _4] = toplevelServerEntries;
|
|
1220741
1220773
|
context.setDefaultServerName(name2);
|
|
1220742
1220774
|
}
|
|
1220743
1220775
|
context.builder.addEnvironment({
|
|
1220744
1220776
|
name: PRODUCTION_ENVNIRONMENT_NAME,
|
|
1220745
1220777
|
schema: {
|
|
1220746
1220778
|
urls: {
|
|
1220747
|
-
...
|
|
1220748
|
-
...
|
|
1220779
|
+
...extractUrlsFromEnvironmentSchema(topLevelServersWithName),
|
|
1220780
|
+
...extractUrlsFromEnvironmentSchema(endpointLevelServersWithName)
|
|
1220749
1220781
|
}
|
|
1220750
1220782
|
}
|
|
1220751
1220783
|
});
|
|
@@ -1223078,6 +1223110,125 @@ async function getOrganziation({
|
|
|
1223078
1223110
|
}
|
|
1223079
1223111
|
}
|
|
1223080
1223112
|
|
|
1223113
|
+
// src/commands/upgrade/upgradeGenerator.ts
|
|
1223114
|
+
var import_promises32 = require("fs/promises");
|
|
1223115
|
+
var import_path27 = __toESM(require("path"), 1);
|
|
1223116
|
+
var semver3 = __toESM(require_semver2(), 1);
|
|
1223117
|
+
var import_yaml = __toESM(require_dist5(), 1);
|
|
1223118
|
+
async function loadAndUpdateGenerators({
|
|
1223119
|
+
absolutePathToWorkspace,
|
|
1223120
|
+
context,
|
|
1223121
|
+
generatorFilter,
|
|
1223122
|
+
groupFilter,
|
|
1223123
|
+
includeMajor
|
|
1223124
|
+
}) {
|
|
1223125
|
+
const filepath = generators_yml_exports.getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1223126
|
+
if (!await doesPathExist(filepath)) {
|
|
1223127
|
+
context.failAndThrow("Generators configuration file was not found, no generators to upgrade.");
|
|
1223128
|
+
return void 0;
|
|
1223129
|
+
}
|
|
1223130
|
+
const contents = await (0, import_promises32.readFile)(filepath);
|
|
1223131
|
+
context.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1223132
|
+
const parsedDocument = import_yaml.default.parseDocument(contents.toString());
|
|
1223133
|
+
const generatorGroups = parsedDocument.get("groups");
|
|
1223134
|
+
if (generatorGroups == null) {
|
|
1223135
|
+
context.failAndThrow("No groups were found within the generators configuration, no generators to upgrade.");
|
|
1223136
|
+
return void 0;
|
|
1223137
|
+
}
|
|
1223138
|
+
if (!import_yaml.default.isMap(generatorGroups)) {
|
|
1223139
|
+
context.failAndThrow(`Expected 'groups' to be a map in ${import_path27.default.relative(process.cwd(), filepath)}`);
|
|
1223140
|
+
return void 0;
|
|
1223141
|
+
}
|
|
1223142
|
+
context.logger.debug(`Groups found: ${generatorGroups.toString()}`);
|
|
1223143
|
+
for (const groupBlock of generatorGroups.items) {
|
|
1223144
|
+
const groupName = groupBlock.key;
|
|
1223145
|
+
const group = groupBlock.value;
|
|
1223146
|
+
if (!import_yaml.default.isMap(group)) {
|
|
1223147
|
+
context.failAndThrow(
|
|
1223148
|
+
`Expected group ${groupName} to be a map in ${import_path27.default.relative(process.cwd(), filepath)}`
|
|
1223149
|
+
);
|
|
1223150
|
+
continue;
|
|
1223151
|
+
}
|
|
1223152
|
+
if (groupFilter != null && group.get("name") !== groupName) {
|
|
1223153
|
+
continue;
|
|
1223154
|
+
}
|
|
1223155
|
+
const generators = group.get("generators");
|
|
1223156
|
+
if (!import_yaml.default.isSeq(generators)) {
|
|
1223157
|
+
context.failAndThrow(
|
|
1223158
|
+
`Expected group ${groupName} to have a 'generators' key in ${import_path27.default.relative(process.cwd(), filepath)}`
|
|
1223159
|
+
);
|
|
1223160
|
+
continue;
|
|
1223161
|
+
}
|
|
1223162
|
+
context.logger.debug(`Generators found: ${generators.toString()}`);
|
|
1223163
|
+
for (const generator of generators.items) {
|
|
1223164
|
+
if (!import_yaml.default.isMap(generator)) {
|
|
1223165
|
+
context.failAndThrow(
|
|
1223166
|
+
`Expected generator in group ${groupName} to be a map in ${import_path27.default.relative(process.cwd(), filepath)}`
|
|
1223167
|
+
);
|
|
1223168
|
+
}
|
|
1223169
|
+
if (generatorFilter != null && generator.get("name") !== generatorFilter) {
|
|
1223170
|
+
continue;
|
|
1223171
|
+
}
|
|
1223172
|
+
const generatorName = generator.get("name");
|
|
1223173
|
+
const normalizedGeneratorName = generators_yml_exports.getGeneratorNameOrThrow(generatorName, context);
|
|
1223174
|
+
const currentVersion = generator.get("version");
|
|
1223175
|
+
const latestVersion2 = await generators_yml_exports.getLatestGeneratorVersion(normalizedGeneratorName, context);
|
|
1223176
|
+
context.logger.debug(`${generatorName}, ${currentVersion}, ${latestVersion2}`);
|
|
1223177
|
+
if (latestVersion2 == null) {
|
|
1223178
|
+
continue;
|
|
1223179
|
+
}
|
|
1223180
|
+
const currentMajor = semver3.major(currentVersion);
|
|
1223181
|
+
const latestMajor = semver3.major(latestVersion2);
|
|
1223182
|
+
if (currentMajor === latestMajor || includeMajor) {
|
|
1223183
|
+
generator.set("version", latestVersion2);
|
|
1223184
|
+
context.logger.info(source_default.green(`${generatorName} has been upgraded to latest in group: ${groupName}`));
|
|
1223185
|
+
}
|
|
1223186
|
+
}
|
|
1223187
|
+
}
|
|
1223188
|
+
return parsedDocument.toString();
|
|
1223189
|
+
}
|
|
1223190
|
+
async function upgradeGenerator2({
|
|
1223191
|
+
cliContext,
|
|
1223192
|
+
generator,
|
|
1223193
|
+
group,
|
|
1223194
|
+
project: { apiWorkspaces },
|
|
1223195
|
+
includeMajor
|
|
1223196
|
+
}) {
|
|
1223197
|
+
await Promise.all(
|
|
1223198
|
+
apiWorkspaces.map(async (workspace) => {
|
|
1223199
|
+
await cliContext.runTaskForWorkspace(workspace, async (context) => {
|
|
1223200
|
+
var _a6;
|
|
1223201
|
+
const generatorsConfiguration = await generators_yml_exports.loadRawGeneratorsConfiguration({
|
|
1223202
|
+
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1223203
|
+
context
|
|
1223204
|
+
}) ?? {};
|
|
1223205
|
+
if (generatorsConfiguration == null || generatorsConfiguration.groups == null) {
|
|
1223206
|
+
context.failAndThrow(
|
|
1223207
|
+
"No groups were found within the generators configuration, no generators to upgrade."
|
|
1223208
|
+
);
|
|
1223209
|
+
return;
|
|
1223210
|
+
}
|
|
1223211
|
+
context.logger.info(`Upgrading generators in workspace: ${workspace.workspaceName}`);
|
|
1223212
|
+
const updatedConfiguration = await loadAndUpdateGenerators({
|
|
1223213
|
+
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1223214
|
+
context,
|
|
1223215
|
+
generatorFilter: generator,
|
|
1223216
|
+
groupFilter: group,
|
|
1223217
|
+
includeMajor
|
|
1223218
|
+
});
|
|
1223219
|
+
if (updatedConfiguration != null) {
|
|
1223220
|
+
await (0, import_promises32.writeFile)(
|
|
1223221
|
+
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1223222
|
+
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1223223
|
+
}),
|
|
1223224
|
+
updatedConfiguration
|
|
1223225
|
+
);
|
|
1223226
|
+
}
|
|
1223227
|
+
});
|
|
1223228
|
+
})
|
|
1223229
|
+
);
|
|
1223230
|
+
}
|
|
1223231
|
+
|
|
1223081
1223232
|
// src/cliV2.ts
|
|
1223082
1223233
|
function addGetOrganizationCommand(cli, cliContext) {
|
|
1223083
1223234
|
cli.command(
|
|
@@ -1223106,55 +1223257,96 @@ function addGetOrganizationCommand(cli, cliContext) {
|
|
|
1223106
1223257
|
}
|
|
1223107
1223258
|
);
|
|
1223108
1223259
|
}
|
|
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
|
-
|
|
1223260
|
+
function addGeneratorCommands(cli, cliContext) {
|
|
1223261
|
+
cli.command("generator", "Operate on the generators within your Fern configuration", (yargs) => {
|
|
1223262
|
+
yargs.command(
|
|
1223263
|
+
"list",
|
|
1223264
|
+
false,
|
|
1223265
|
+
(yargs2) => yargs2.option("output", {
|
|
1223266
|
+
string: true,
|
|
1223267
|
+
alias: "o",
|
|
1223268
|
+
description: "The location to output the list as a text file, defaults to standard out."
|
|
1223269
|
+
}).option("generators", {
|
|
1223270
|
+
string: true,
|
|
1223271
|
+
type: "array",
|
|
1223272
|
+
description: "The type of generator to include in the list, ex: `fern-typescript-node-sdk`. If omitted, all generators will be listed."
|
|
1223273
|
+
}).option("groups", {
|
|
1223274
|
+
type: "array",
|
|
1223275
|
+
string: true,
|
|
1223276
|
+
description: "The groups to include generators from, if group is not specified, the all generators of the specified type will be listed."
|
|
1223277
|
+
}).option("apis", {
|
|
1223278
|
+
type: "array",
|
|
1223279
|
+
string: true,
|
|
1223280
|
+
description: "The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."
|
|
1223281
|
+
}).option("api-fallback", {
|
|
1223282
|
+
string: true,
|
|
1223283
|
+
description: "The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."
|
|
1223284
|
+
}),
|
|
1223285
|
+
async (argv) => {
|
|
1223286
|
+
cliContext.instrumentPostHogEvent({
|
|
1223287
|
+
command: "fern generator list",
|
|
1223288
|
+
properties: {
|
|
1223289
|
+
outputLocation: argv.output
|
|
1223290
|
+
}
|
|
1223291
|
+
});
|
|
1223292
|
+
await getGeneratorList({
|
|
1223293
|
+
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
1223294
|
+
commandLineApiWorkspace: void 0,
|
|
1223295
|
+
defaultToAllApiWorkspaces: true
|
|
1223296
|
+
}),
|
|
1223297
|
+
generatorFilter: argv.generators ? new Set(argv.generators) : void 0,
|
|
1223298
|
+
groupFilter: argv.groups ? new Set(argv.groups) : void 0,
|
|
1223299
|
+
apiFilter: argv.apis ? new Set(argv.apis) : void 0,
|
|
1223300
|
+
apiKeyFallback: argv.apiFallback,
|
|
1223301
|
+
cliContext,
|
|
1223137
1223302
|
outputLocation: argv.output
|
|
1223138
|
-
}
|
|
1223139
|
-
}
|
|
1223140
|
-
|
|
1223141
|
-
|
|
1223142
|
-
|
|
1223143
|
-
|
|
1223144
|
-
|
|
1223145
|
-
|
|
1223146
|
-
|
|
1223147
|
-
|
|
1223148
|
-
|
|
1223149
|
-
|
|
1223150
|
-
|
|
1223151
|
-
|
|
1223152
|
-
|
|
1223153
|
-
|
|
1223303
|
+
});
|
|
1223304
|
+
}
|
|
1223305
|
+
).command(
|
|
1223306
|
+
"upgrade",
|
|
1223307
|
+
`Upgrades the specified generator in ${GENERATORS_CONFIGURATION_FILENAME} to the latest stable version.`,
|
|
1223308
|
+
(yargs2) => yargs2.option("generator", {
|
|
1223309
|
+
string: true,
|
|
1223310
|
+
description: "The type of generator to upgrade, ex: `fern-typescript-node-sdk`."
|
|
1223311
|
+
}).option("group", {
|
|
1223312
|
+
string: true,
|
|
1223313
|
+
description: "The group in which the generator is located, if group is not specified, the all generators of the specified type will be upgraded."
|
|
1223314
|
+
}).option("api", {
|
|
1223315
|
+
string: true,
|
|
1223316
|
+
description: "The API to upgrade the generator for. If not specified, the generator will be upgraded for all APIs."
|
|
1223317
|
+
}).option("include-major", {
|
|
1223318
|
+
boolean: true,
|
|
1223319
|
+
default: false,
|
|
1223320
|
+
description: "Whether or not to include major versions within the upgrade. Defaults to false, meaning major versions will be skipped."
|
|
1223321
|
+
}),
|
|
1223322
|
+
async (argv) => {
|
|
1223323
|
+
cliContext.instrumentPostHogEvent({
|
|
1223324
|
+
command: "fern generator upgrade",
|
|
1223325
|
+
properties: {
|
|
1223326
|
+
generator: argv.generator,
|
|
1223327
|
+
version: argv.version,
|
|
1223328
|
+
api: argv.api,
|
|
1223329
|
+
group: argv.group,
|
|
1223330
|
+
includeMajor: argv.includeMajor
|
|
1223331
|
+
}
|
|
1223332
|
+
});
|
|
1223333
|
+
await upgradeGenerator2({
|
|
1223334
|
+
cliContext,
|
|
1223335
|
+
generator: argv.generator,
|
|
1223336
|
+
group: argv.group,
|
|
1223337
|
+
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
1223338
|
+
commandLineApiWorkspace: argv.api,
|
|
1223339
|
+
defaultToAllApiWorkspaces: true
|
|
1223340
|
+
}),
|
|
1223341
|
+
includeMajor: argv.includeMajor
|
|
1223342
|
+
});
|
|
1223343
|
+
}
|
|
1223344
|
+
);
|
|
1223345
|
+
});
|
|
1223154
1223346
|
}
|
|
1223155
1223347
|
|
|
1223156
1223348
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
1223157
|
-
var
|
|
1223349
|
+
var import_promises33 = require("fs/promises");
|
|
1223158
1223350
|
async function addGeneratorToWorkspaces({
|
|
1223159
1223351
|
project: { apiWorkspaces },
|
|
1223160
1223352
|
generatorName,
|
|
@@ -1223175,7 +1223367,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1223175
1223367
|
groupName,
|
|
1223176
1223368
|
context
|
|
1223177
1223369
|
});
|
|
1223178
|
-
await (0,
|
|
1223370
|
+
await (0, import_promises33.writeFile)(
|
|
1223179
1223371
|
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1223180
1223372
|
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1223181
1223373
|
}),
|
|
@@ -1232597,10 +1232789,10 @@ function visitFrontmatterImages(data2, keys7, mapImage) {
|
|
|
1232597
1232789
|
}
|
|
1232598
1232790
|
|
|
1232599
1232791
|
// ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
1232600
|
-
var
|
|
1232792
|
+
var import_promises34 = require("fs/promises");
|
|
1232601
1232793
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
1232602
1232794
|
async function defaultMarkdownLoader(filepath) {
|
|
1232603
|
-
const { content: content3 } = (0, import_gray_matter2.default)(await (0,
|
|
1232795
|
+
const { content: content3 } = (0, import_gray_matter2.default)(await (0, import_promises34.readFile)(filepath));
|
|
1232604
1232796
|
return content3;
|
|
1232605
1232797
|
}
|
|
1232606
1232798
|
async function replaceReferencedMarkdown({
|
|
@@ -1232637,9 +1232829,9 @@ async function replaceReferencedMarkdown({
|
|
|
1232637
1232829
|
}
|
|
1232638
1232830
|
|
|
1232639
1232831
|
// ../docs-markdown-utils/lib/replaceReferencedCode.js
|
|
1232640
|
-
var
|
|
1232832
|
+
var import_promises35 = require("fs/promises");
|
|
1232641
1232833
|
async function defaultFileLoader(filepath) {
|
|
1232642
|
-
const file = await (0,
|
|
1232834
|
+
const file = await (0, import_promises35.readFile)(filepath);
|
|
1232643
1232835
|
return file.toString();
|
|
1232644
1232836
|
}
|
|
1232645
1232837
|
async function replaceReferencedCode({
|
|
@@ -1237724,12 +1237916,12 @@ function stringifyFernFilepath(fernFilepath) {
|
|
|
1237724
1237916
|
}
|
|
1237725
1237917
|
|
|
1237726
1237918
|
// ../generation/ir-generator/lib/utils/convertToFernFilepath.js
|
|
1237727
|
-
var
|
|
1237919
|
+
var import_path28 = __toESM(require("path"), 1);
|
|
1237728
1237920
|
function convertToFernFilepath({ relativeFilepath, casingsGenerator }) {
|
|
1237729
1237921
|
const pathToPackage = dirname(relativeFilepath);
|
|
1237730
|
-
const filename = (0,
|
|
1237731
|
-
const packagePath = pathToPackage === "." ? [] : pathToPackage.split(
|
|
1237732
|
-
const file = filename !== FERN_PACKAGE_MARKER_FILENAME ? casingsGenerator.generateName(
|
|
1237922
|
+
const filename = (0, import_path28.basename)(relativeFilepath);
|
|
1237923
|
+
const packagePath = pathToPackage === "." ? [] : pathToPackage.split(import_path28.default.sep).map((part) => casingsGenerator.generateName(part));
|
|
1237924
|
+
const file = filename !== FERN_PACKAGE_MARKER_FILENAME ? casingsGenerator.generateName(import_path28.default.parse(filename).name) : void 0;
|
|
1237733
1237925
|
const allParts = [];
|
|
1237734
1237926
|
allParts.push(...packagePath);
|
|
1237735
1237927
|
if (file != null) {
|
|
@@ -1239592,7 +1239784,10 @@ function convertPrimitiveExample({ example, typeBeingExemplified }) {
|
|
|
1239592
1239784
|
if (typeof example !== "string") {
|
|
1239593
1239785
|
throw new Error("Example is not a string");
|
|
1239594
1239786
|
}
|
|
1239595
|
-
return ExampleTypeReferenceShape.primitive(ExamplePrimitive.datetime(
|
|
1239787
|
+
return ExampleTypeReferenceShape.primitive(ExamplePrimitive.datetime({
|
|
1239788
|
+
datetime: new Date(example),
|
|
1239789
|
+
raw: example
|
|
1239790
|
+
}));
|
|
1239596
1239791
|
},
|
|
1239597
1239792
|
date: () => {
|
|
1239598
1239793
|
if (typeof example !== "string") {
|
|
@@ -1239674,7 +1239869,7 @@ function convertObject4({ typeName, rawObject, example, fileContainingType, file
|
|
|
1239674
1239869
|
throw new Error(`Example is not an object. Got: ${JSON.stringify(example)}`);
|
|
1239675
1239870
|
}
|
|
1239676
1239871
|
return ExampleTypeShape.object({
|
|
1239677
|
-
properties: rawObject.properties != null ? Object.entries(example).reduce((exampleProperties, [wireKey, propertyExample]) => {
|
|
1239872
|
+
properties: rawObject.properties != null || rawObject.extends != null ? Object.entries(example).reduce((exampleProperties, [wireKey, propertyExample]) => {
|
|
1239678
1239873
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
1239679
1239874
|
typeName,
|
|
1239680
1239875
|
wirePropertyKey: wireKey,
|
|
@@ -1242673,7 +1242868,10 @@ var ExampleGenerator = class {
|
|
|
1242673
1242868
|
const exDateTime = example != null && typeof example === "string" ? example : examples_exports.DATE_TIME;
|
|
1242674
1242869
|
return {
|
|
1242675
1242870
|
jsonExample: exDateTime,
|
|
1242676
|
-
shape: ExampleTypeReferenceShape.primitive(ExamplePrimitive.datetime(
|
|
1242871
|
+
shape: ExampleTypeReferenceShape.primitive(ExamplePrimitive.datetime({
|
|
1242872
|
+
datetime: new Date(exDateTime),
|
|
1242873
|
+
raw: exDateTime
|
|
1242874
|
+
}))
|
|
1242677
1242875
|
};
|
|
1242678
1242876
|
}
|
|
1242679
1242877
|
case "UUID": {
|
|
@@ -1244298,10 +1244496,10 @@ var PropertyResolverImpl = class {
|
|
|
1244298
1244496
|
};
|
|
1244299
1244497
|
|
|
1244300
1244498
|
// ../generation/ir-generator/lib/parsers/ProtobufParser.js
|
|
1244301
|
-
var
|
|
1244499
|
+
var import_promises36 = require("fs/promises");
|
|
1244302
1244500
|
var ProtobufParser = class {
|
|
1244303
1244501
|
async parse({ absoluteFilePath }) {
|
|
1244304
|
-
const content3 = await (0,
|
|
1244502
|
+
const content3 = await (0, import_promises36.readFile)(absoluteFilePath, "utf-8");
|
|
1244305
1244503
|
const csharpNamespaceMatch = content3.match(/option\s+csharp_namespace\s*=\s*"([^"]+)";/);
|
|
1244306
1244504
|
const packageNameMatch = content3.match(/package\s+([a-zA-Z_][\w.]*);/);
|
|
1244307
1244505
|
const serviceNameMatch = content3.match(/service\s+([a-zA-Z_]\w*)\s*{/);
|
|
@@ -1245096,7 +1245294,7 @@ function filterServiceTypeReferenceInfoForAudiences(serviceTypeReferenceInfo, fi
|
|
|
1245096
1245294
|
// ../docs-resolver/lib/DocsDefinitionResolver.js
|
|
1245097
1245295
|
var import_dayjs3 = __toESM(require_dayjs_min(), 1);
|
|
1245098
1245296
|
var import_utc3 = __toESM(require_utc(), 1);
|
|
1245099
|
-
var
|
|
1245297
|
+
var import_promises37 = require("fs/promises");
|
|
1245100
1245298
|
var import_gray_matter3 = __toESM(require_gray_matter(), 1);
|
|
1245101
1245299
|
|
|
1245102
1245300
|
// ../docs-resolver/lib/utils/isSubpackage.js
|
|
@@ -1247303,7 +1247501,7 @@ var DocsDefinitionResolver = class {
|
|
|
1247303
1247501
|
const jsFilePaths = /* @__PURE__ */ new Set();
|
|
1247304
1247502
|
await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
|
|
1247305
1247503
|
const absoluteFilePath = resolve(this.docsWorkspace.absoluteFilepath, filepath);
|
|
1247306
|
-
const stats = await (0,
|
|
1247504
|
+
const stats = await (0, import_promises37.stat)(absoluteFilePath);
|
|
1247307
1247505
|
if (stats.isDirectory()) {
|
|
1247308
1247506
|
const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx}");
|
|
1247309
1247507
|
files.forEach((file) => {
|
|
@@ -1247315,7 +1247513,7 @@ var DocsDefinitionResolver = class {
|
|
|
1247315
1247513
|
}));
|
|
1247316
1247514
|
jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
|
|
1247317
1247515
|
const relativeFilePath = this.toRelativeFilepath(filePath);
|
|
1247318
|
-
const contents = (await (0,
|
|
1247516
|
+
const contents = (await (0, import_promises37.readFile)(filePath)).toString();
|
|
1247319
1247517
|
return [relativeFilePath, contents];
|
|
1247320
1247518
|
})));
|
|
1247321
1247519
|
}
|
|
@@ -1247735,7 +1247933,7 @@ function convertAvailability5(availability) {
|
|
|
1247735
1247933
|
var import_cors = __toESM(require_lib20(), 1);
|
|
1247736
1247934
|
var import_express = __toESM(require_express3(), 1);
|
|
1247737
1247935
|
var import_http2 = __toESM(require("http"), 1);
|
|
1247738
|
-
var
|
|
1247936
|
+
var import_path30 = __toESM(require("path"), 1);
|
|
1247739
1247937
|
|
|
1247740
1247938
|
// ../../../node_modules/.pnpm/watcher@2.3.1/node_modules/watcher/dist/watcher.js
|
|
1247741
1247939
|
var import_node_events = require("events");
|
|
@@ -1249392,10 +1249590,10 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
1249392
1249590
|
// ../docs-preview/lib/downloadLocalDocsBundle.js
|
|
1249393
1249591
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
1249394
1249592
|
var import_fs7 = require("fs");
|
|
1249395
|
-
var
|
|
1249593
|
+
var import_promises38 = require("fs/promises");
|
|
1249396
1249594
|
var import_os4 = require("os");
|
|
1249397
|
-
var
|
|
1249398
|
-
var
|
|
1249595
|
+
var import_path29 = __toESM(require("path"), 1);
|
|
1249596
|
+
var import_promises39 = require("stream/promises");
|
|
1249399
1249597
|
var import_tmp_promise5 = __toESM(require_tmp_promise(), 1);
|
|
1249400
1249598
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
1249401
1249599
|
var ETAG_FILENAME = "etag";
|
|
@@ -1249426,7 +1249624,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1249426
1249624
|
let currentETag = void 0;
|
|
1249427
1249625
|
if (currentETagExists) {
|
|
1249428
1249626
|
logger.debug("Reading existing ETag");
|
|
1249429
|
-
currentETag = (await (0,
|
|
1249627
|
+
currentETag = (await (0, import_promises38.readFile)(eTagFilepath)).toString();
|
|
1249430
1249628
|
}
|
|
1249431
1249629
|
if (currentETag != null && currentETag === eTag) {
|
|
1249432
1249630
|
logger.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -1249440,7 +1249638,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1249440
1249638
|
const dir = await import_tmp_promise5.default.dir({ prefix: "fern" });
|
|
1249441
1249639
|
const absoluteDirectoryToTmpDir = AbsoluteFilePath.of(dir.path);
|
|
1249442
1249640
|
logger.debug(`Created tmp directory ${absoluteDirectoryToTmpDir}`);
|
|
1249443
|
-
const docsBundleZipResponse = await fetch(`${
|
|
1249641
|
+
const docsBundleZipResponse = await fetch(`${import_path29.default.join(bucketUrl, key)}`);
|
|
1249444
1249642
|
const outputZipPath = join(absoluteDirectoryToTmpDir, RelativeFilePath.of("output.zip"));
|
|
1249445
1249643
|
const contents = docsBundleZipResponse.body;
|
|
1249446
1249644
|
if (contents == null) {
|
|
@@ -1249448,18 +1249646,18 @@ async function downloadBundle({ bucketUrl, logger, preferCached }) {
|
|
|
1249448
1249646
|
type: "failure"
|
|
1249449
1249647
|
};
|
|
1249450
1249648
|
}
|
|
1249451
|
-
await (0,
|
|
1249649
|
+
await (0, import_promises39.pipeline)(contents, (0, import_fs7.createWriteStream)(outputZipPath));
|
|
1249452
1249650
|
logger.debug(`Wrote output.zip to ${outputZipPath}`);
|
|
1249453
1249651
|
const absolutePathToPreviewFolder = getPathToPreviewFolder();
|
|
1249454
1249652
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1249455
|
-
await (0,
|
|
1249653
|
+
await (0, import_promises38.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1249456
1249654
|
}
|
|
1249457
|
-
await (0,
|
|
1249655
|
+
await (0, import_promises38.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
1249458
1249656
|
logger.debug(`rm -rf ${absolutePathToPreviewFolder}`);
|
|
1249459
1249657
|
const absolutePathToBundleFolder = getPathToBundleFolder();
|
|
1249460
|
-
await (0,
|
|
1249658
|
+
await (0, import_promises38.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
1249461
1249659
|
await (0, import_decompress.default)(outputZipPath, absolutePathToBundleFolder);
|
|
1249462
|
-
await (0,
|
|
1249660
|
+
await (0, import_promises38.writeFile)(eTagFilepath, eTag);
|
|
1249463
1249661
|
logger.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
1249464
1249662
|
return {
|
|
1249465
1249663
|
type: "success"
|
|
@@ -1249653,9 +1249851,9 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
|
|
|
1249653
1249851
|
}
|
|
1249654
1249852
|
return next2();
|
|
1249655
1249853
|
});
|
|
1249656
|
-
app.use("/_next", import_express.default.static(
|
|
1249854
|
+
app.use("/_next", import_express.default.static(import_path30.default.join(getPathToBundleFolder(), "/_next")));
|
|
1249657
1249855
|
app.use("*", async (_req, res) => {
|
|
1249658
|
-
return res.sendFile(
|
|
1249856
|
+
return res.sendFile(import_path30.default.join(getPathToBundleFolder(), "/[[...slug]].html"));
|
|
1249659
1249857
|
});
|
|
1249660
1249858
|
app.listen(port);
|
|
1249661
1249859
|
context.logger.info(`Running server on http://localhost:${port}`);
|
|
@@ -1250400,7 +1250598,7 @@ function convertRequestWrapperPropertyToString(property5) {
|
|
|
1250400
1250598
|
}
|
|
1250401
1250599
|
|
|
1250402
1250600
|
// ../yaml/validator/lib/rules/no-duplicate-declarations/no-duplicate-declarations.js
|
|
1250403
|
-
var
|
|
1250601
|
+
var import_path31 = __toESM(require("path"), 1);
|
|
1250404
1250602
|
var NoDuplicateDeclarationsRule = {
|
|
1250405
1250603
|
name: "no-duplicate-declarations",
|
|
1250406
1250604
|
create: async ({ workspace, logger }) => {
|
|
@@ -1250408,7 +1250606,7 @@ var NoDuplicateDeclarationsRule = {
|
|
|
1250408
1250606
|
const seenTypes = {};
|
|
1250409
1250607
|
const getRuleViolations = ({ declaredName, relativeFilepath }) => {
|
|
1250410
1250608
|
var _a6;
|
|
1250411
|
-
const relativeDirectoryPath =
|
|
1250609
|
+
const relativeDirectoryPath = import_path31.default.dirname(relativeFilepath);
|
|
1250412
1250610
|
const declarationsForName = (_a6 = declarations[relativeDirectoryPath]) == null ? void 0 : _a6[declaredName];
|
|
1250413
1250611
|
if (declarationsForName == null) {
|
|
1250414
1250612
|
logger.error(`Could not find declarations for name: ${declaredName}. This is an error in the Fern validator.`);
|
|
@@ -1250445,7 +1250643,7 @@ var NoDuplicateDeclarationsRule = {
|
|
|
1250445
1250643
|
async function getDeclarations(workspace) {
|
|
1250446
1250644
|
const declarations = {};
|
|
1250447
1250645
|
await visitAllDefinitionFiles(workspace, async (relativeFilepath, file) => {
|
|
1250448
|
-
const relativeDirectoryPath =
|
|
1250646
|
+
const relativeDirectoryPath = import_path31.default.dirname(relativeFilepath);
|
|
1250449
1250647
|
const declarationsForDirectory = declarations[relativeDirectoryPath] ?? (declarations[relativeDirectoryPath] = {});
|
|
1250450
1250648
|
const addDeclaration = (declaredName) => {
|
|
1250451
1250649
|
(declarationsForDirectory[declaredName] ?? (declarationsForDirectory[declaredName] = [])).push(relativeFilepath);
|
|
@@ -1252060,7 +1252258,7 @@ var ValidFieldNamesRule = {
|
|
|
1252060
1252258
|
};
|
|
1252061
1252259
|
|
|
1252062
1252260
|
// ../yaml/validator/lib/rules/valid-navigation/valid-navigation.js
|
|
1252063
|
-
var
|
|
1252261
|
+
var import_path32 = __toESM(require("path"), 1);
|
|
1252064
1252262
|
var ValidNavigationRule = {
|
|
1252065
1252263
|
name: "valid-navigation",
|
|
1252066
1252264
|
create: ({ workspace }) => {
|
|
@@ -1252069,7 +1252267,7 @@ var ValidNavigationRule = {
|
|
|
1252069
1252267
|
const directoryToChildren = allNamedDefinitionFilepaths.reduce((acc, definitionFilepath) => {
|
|
1252070
1252268
|
var _a6;
|
|
1252071
1252269
|
const children2 = acc[_a6 = dirname(definitionFilepath)] ?? (acc[_a6] = /* @__PURE__ */ new Set());
|
|
1252072
|
-
children2.add(
|
|
1252270
|
+
children2.add(import_path32.default.basename(definitionFilepath));
|
|
1252073
1252271
|
return acc;
|
|
1252074
1252272
|
}, {});
|
|
1252075
1252273
|
return {
|
|
@@ -1265862,7 +1266060,7 @@ function compile(vfileCompatible, compileOptions) {
|
|
|
1265862
1266060
|
}
|
|
1265863
1266061
|
|
|
1265864
1266062
|
// ../../../node_modules/.pnpm/vfile-matter@5.0.0/node_modules/vfile-matter/lib/index.js
|
|
1265865
|
-
var
|
|
1266063
|
+
var import_yaml2 = __toESM(require_dist5(), 1);
|
|
1265866
1266064
|
var regex3 = /^---(?:\r?\n|\r)(?:([\s\S]*?)(?:\r?\n|\r))?---(?:\r?\n|\r|$)/;
|
|
1265867
1266065
|
function matter2(file, options2) {
|
|
1265868
1266066
|
const options_ = options2 || {};
|
|
@@ -1265871,7 +1266069,7 @@ function matter2(file, options2) {
|
|
|
1265871
1266069
|
let doc = String(file);
|
|
1265872
1266070
|
const match = regex3.exec(doc);
|
|
1265873
1266071
|
if (match) {
|
|
1265874
|
-
file.data.matter =
|
|
1266072
|
+
file.data.matter = import_yaml2.default.parse(match[1], yamlOptions);
|
|
1265875
1266073
|
if (strip) {
|
|
1265876
1266074
|
doc = doc.slice(match[0].length);
|
|
1265877
1266075
|
file.value = file.value && typeof file.value === "object" ? new TextEncoder().encode(doc) : doc;
|
|
@@ -1267639,7 +1267837,7 @@ var domain = {
|
|
|
1267639
1267837
|
tokenize: tokenizeDomain,
|
|
1267640
1267838
|
partial: true
|
|
1267641
1267839
|
};
|
|
1267642
|
-
var
|
|
1267840
|
+
var path33 = {
|
|
1267643
1267841
|
tokenize: tokenizePath,
|
|
1267644
1267842
|
partial: true
|
|
1267645
1267843
|
};
|
|
@@ -1267747,7 +1267945,7 @@ function tokenizeWwwAutolink(effects, ok4, nok) {
|
|
|
1267747
1267945
|
}
|
|
1267748
1267946
|
effects.enter("literalAutolink");
|
|
1267749
1267947
|
effects.enter("literalAutolinkWww");
|
|
1267750
|
-
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(
|
|
1267948
|
+
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path33, wwwAfter), nok), nok)(code4);
|
|
1267751
1267949
|
}
|
|
1267752
1267950
|
function wwwAfter(code4) {
|
|
1267753
1267951
|
effects.exit("literalAutolinkWww");
|
|
@@ -1267797,7 +1267995,7 @@ function tokenizeProtocolAutolink(effects, ok4, nok) {
|
|
|
1267797
1267995
|
return nok(code4);
|
|
1267798
1267996
|
}
|
|
1267799
1267997
|
function afterProtocol(code4) {
|
|
1267800
|
-
return code4 === null || asciiControl(code4) || markdownLineEndingOrSpace(code4) || unicodeWhitespace(code4) || unicodePunctuation(code4) ? nok(code4) : effects.attempt(domain, effects.attempt(
|
|
1267998
|
+
return code4 === null || asciiControl(code4) || markdownLineEndingOrSpace(code4) || unicodeWhitespace(code4) || unicodePunctuation(code4) ? nok(code4) : effects.attempt(domain, effects.attempt(path33, protocolAfter), nok)(code4);
|
|
1267801
1267999
|
}
|
|
1267802
1268000
|
function protocolAfter(code4) {
|
|
1267803
1268001
|
effects.exit("literalAutolinkHttp");
|
|
@@ -1269832,7 +1270030,7 @@ var innerPath = function innerPath2(name2, height2) {
|
|
|
1269832
1270030
|
return "";
|
|
1269833
1270031
|
}
|
|
1269834
1270032
|
};
|
|
1269835
|
-
var
|
|
1270033
|
+
var path34 = {
|
|
1269836
1270034
|
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",
|
|
1269837
1270035
|
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",
|
|
1269838
1270036
|
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",
|
|
@@ -1272739,7 +1272937,7 @@ var PathNode = class {
|
|
|
1272739
1272937
|
if (this.alternate) {
|
|
1272740
1272938
|
node2.setAttribute("d", this.alternate);
|
|
1272741
1272939
|
} else {
|
|
1272742
|
-
node2.setAttribute("d",
|
|
1272940
|
+
node2.setAttribute("d", path34[this.pathName]);
|
|
1272743
1272941
|
}
|
|
1272744
1272942
|
return node2;
|
|
1272745
1272943
|
}
|
|
@@ -1272747,7 +1272945,7 @@ var PathNode = class {
|
|
|
1272747
1272945
|
if (this.alternate) {
|
|
1272748
1272946
|
return '<path d="' + utils.escape(this.alternate) + '"/>';
|
|
1272749
1272947
|
} else {
|
|
1272750
|
-
return '<path d="' + utils.escape(
|
|
1272948
|
+
return '<path d="' + utils.escape(path34[this.pathName]) + '"/>';
|
|
1272751
1272949
|
}
|
|
1272752
1272950
|
}
|
|
1272753
1272951
|
};
|
|
@@ -1292050,8 +1292248,8 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
|
|
|
1292050
1292248
|
}
|
|
1292051
1292249
|
|
|
1292052
1292250
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileAst.js
|
|
1292053
|
-
var
|
|
1292054
|
-
var
|
|
1292251
|
+
var import_promises40 = require("fs/promises");
|
|
1292252
|
+
var import_path33 = __toESM(require("path"), 1);
|
|
1292055
1292253
|
async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToConfiguration, absolutePathToFernFolder, context, loadAPIWorkspace2) {
|
|
1292056
1292254
|
var _a6, _b4, _c4, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1292057
1292255
|
await ((_a6 = visitor.file) == null ? void 0 : _a6.call(visitor, {
|
|
@@ -1292090,7 +1292288,7 @@ async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToC
|
|
|
1292090
1292288
|
for (const filepath of filepaths) {
|
|
1292091
1292289
|
await ((_b4 = visitor.filepath) == null ? void 0 : _b4.call(visitor, {
|
|
1292092
1292290
|
absoluteFilepath: filepath,
|
|
1292093
|
-
value:
|
|
1292291
|
+
value: import_path33.default.relative(absolutePathToFernFolder, filepath),
|
|
1292094
1292292
|
willBeUploaded: true
|
|
1292095
1292293
|
}, [relativePath]));
|
|
1292096
1292294
|
}
|
|
@@ -1292251,7 +1292449,7 @@ async function visitDocsConfigFileYamlAst(contents, visitor, absoluteFilepathToC
|
|
|
1292251
1292449
|
willBeUploaded: false
|
|
1292252
1292450
|
});
|
|
1292253
1292451
|
const absoluteFilepath = resolve(dirname(absoluteFilepathToConfiguration), version3.path);
|
|
1292254
|
-
const content3 = js_yaml_default.load((await (0,
|
|
1292452
|
+
const content3 = js_yaml_default.load((await (0, import_promises40.readFile)(absoluteFilepath)).toString());
|
|
1292255
1292453
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1292256
1292454
|
await ((_a7 = visitor.versionFile) == null ? void 0 : _a7.call(visitor, {
|
|
1292257
1292455
|
path: version3.path,
|
|
@@ -1292322,7 +1292520,7 @@ async function visitNavigationItem({ navigationItem, visitor, nodePath, absolute
|
|
|
1292322
1292520
|
});
|
|
1292323
1292521
|
const absoluteFilepath = resolve(dirname(absoluteFilepathToConfiguration), navigationItem.path);
|
|
1292324
1292522
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1292325
|
-
const content3 = (await (0,
|
|
1292523
|
+
const content3 = (await (0, import_promises40.readFile)(absoluteFilepath)).toString();
|
|
1292326
1292524
|
await ((_a6 = visitor.markdownPage) == null ? void 0 : _a6.call(visitor, {
|
|
1292327
1292525
|
title: navigationItem.page,
|
|
1292328
1292526
|
content: content3,
|
|
@@ -1294751,8 +1294949,8 @@ var supportedExtensions = new Set(extensions);
|
|
|
1294751
1294949
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
1294752
1294950
|
|
|
1294753
1294951
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
1294754
|
-
var
|
|
1294755
|
-
var
|
|
1294952
|
+
var import_promises41 = require("fs/promises");
|
|
1294953
|
+
var import_path34 = __toESM(require("path"), 1);
|
|
1294756
1294954
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
1294757
1294955
|
"image/jpeg",
|
|
1294758
1294956
|
"image/png",
|
|
@@ -1294828,7 +1295026,7 @@ var ValidFileTypes = {
|
|
|
1294828
1295026
|
}
|
|
1294829
1295027
|
};
|
|
1294830
1295028
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
1294831
|
-
const file = await (0,
|
|
1295029
|
+
const file = await (0, import_promises41.readFile)(absoluteFilepath);
|
|
1294832
1295030
|
const fileType = await fileTypeFromBuffer(file);
|
|
1294833
1295031
|
if (fileType != null) {
|
|
1294834
1295032
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -1294842,7 +1295040,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
|
|
|
1294842
1295040
|
];
|
|
1294843
1295041
|
}
|
|
1294844
1295042
|
}
|
|
1294845
|
-
let extension2 =
|
|
1295043
|
+
let extension2 = import_path34.default.extname(absoluteFilepath).toLowerCase();
|
|
1294846
1295044
|
if (extension2.startsWith(".")) {
|
|
1294847
1295045
|
extension2 = extension2.substring(1);
|
|
1294848
1295046
|
}
|
|
@@ -1295029,8 +1295227,8 @@ async function formatWorkspaces({
|
|
|
1295029
1295227
|
}
|
|
1295030
1295228
|
|
|
1295031
1295229
|
// src/commands/generate-fdr/generateFdrApiDefinitionForWorkspaces.ts
|
|
1295032
|
-
var
|
|
1295033
|
-
var
|
|
1295230
|
+
var import_promises42 = require("fs/promises");
|
|
1295231
|
+
var import_path35 = __toESM(require("path"), 1);
|
|
1295034
1295232
|
|
|
1295035
1295233
|
// src/commands/generate-ir/generateIrForFernWorkspace.ts
|
|
1295036
1295234
|
async function generateIrForFernWorkspace({
|
|
@@ -1295083,8 +1295281,8 @@ async function generateFdrApiDefinitionForWorkspaces({
|
|
|
1295083
1295281
|
ir,
|
|
1295084
1295282
|
snippetsConfig: {}
|
|
1295085
1295283
|
});
|
|
1295086
|
-
const resolvedOutputFilePath =
|
|
1295087
|
-
await (0,
|
|
1295284
|
+
const resolvedOutputFilePath = import_path35.default.resolve(outputFilepath);
|
|
1295285
|
+
await (0, import_promises42.writeFile)(resolvedOutputFilePath, await stringifyLargeObject(apiDefinition, { pretty: true }));
|
|
1295088
1295286
|
context.logger.info(`Wrote FDR API definition to ${resolvedOutputFilePath}`);
|
|
1295089
1295287
|
});
|
|
1295090
1295288
|
})
|
|
@@ -1305599,8 +1305797,8 @@ function migrateIntermediateRepresentationThroughVersion({ intermediateRepresent
|
|
|
1305599
1305797
|
}
|
|
1305600
1305798
|
|
|
1305601
1305799
|
// src/commands/generate-ir/generateIrForWorkspaces.ts
|
|
1305602
|
-
var
|
|
1305603
|
-
var
|
|
1305800
|
+
var import_promises43 = require("fs/promises");
|
|
1305801
|
+
var import_path36 = __toESM(require("path"), 1);
|
|
1305604
1305802
|
async function generateIrForWorkspaces({
|
|
1305605
1305803
|
project,
|
|
1305606
1305804
|
irFilepath,
|
|
@@ -1305628,8 +1305826,8 @@ async function generateIrForWorkspaces({
|
|
|
1305628
1305826
|
version: version3,
|
|
1305629
1305827
|
readme
|
|
1305630
1305828
|
});
|
|
1305631
|
-
const irOutputFilePath =
|
|
1305632
|
-
await (0,
|
|
1305829
|
+
const irOutputFilePath = import_path36.default.resolve(irFilepath);
|
|
1305830
|
+
await (0, import_promises43.writeFile)(
|
|
1305633
1305831
|
irOutputFilePath,
|
|
1305634
1305832
|
await stringifyLargeObject(intermediateRepresentation, { pretty: true })
|
|
1305635
1305833
|
);
|
|
@@ -1305672,8 +1305870,8 @@ async function getIntermediateRepresentation({
|
|
|
1305672
1305870
|
}
|
|
1305673
1305871
|
|
|
1305674
1305872
|
// src/commands/generate-openapi-ir/generateOpenAPIIrForWorkspaces.ts
|
|
1305675
|
-
var
|
|
1305676
|
-
var
|
|
1305873
|
+
var import_promises44 = require("fs/promises");
|
|
1305874
|
+
var import_path37 = __toESM(require("path"), 1);
|
|
1305677
1305875
|
async function generateOpenAPIIrForWorkspaces({
|
|
1305678
1305876
|
project,
|
|
1305679
1305877
|
irFilepath,
|
|
@@ -1305693,11 +1305891,11 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1305693
1305891
|
specs: openAPISpecs,
|
|
1305694
1305892
|
taskContext: context
|
|
1305695
1305893
|
});
|
|
1305696
|
-
const irOutputFilePath =
|
|
1305894
|
+
const irOutputFilePath = import_path37.default.resolve(irFilepath);
|
|
1305697
1305895
|
const openApiIrJson = await serialization_exports3.OpenApiIntermediateRepresentation.jsonOrThrow(openAPIIr, {
|
|
1305698
1305896
|
skipValidation: true
|
|
1305699
1305897
|
});
|
|
1305700
|
-
await (0,
|
|
1305898
|
+
await (0, import_promises44.writeFile)(irOutputFilePath, await stringifyLargeObject(openApiIrJson, { pretty: true }));
|
|
1305701
1305899
|
context.logger.info(`Wrote IR to ${irOutputFilePath}`);
|
|
1305702
1305900
|
});
|
|
1305703
1305901
|
})
|
|
@@ -1305705,7 +1305903,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1305705
1305903
|
}
|
|
1305706
1305904
|
|
|
1305707
1305905
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
1305708
|
-
var
|
|
1305906
|
+
var import_promises45 = require("fs/promises");
|
|
1305709
1305907
|
async function writeOverridesForWorkspaces({
|
|
1305710
1305908
|
project,
|
|
1305711
1305909
|
includeModels,
|
|
@@ -1305730,7 +1305928,7 @@ async function writeOverridesForWorkspaces({
|
|
|
1305730
1305928
|
async function readExistingOverrides(overridesFilepath, context) {
|
|
1305731
1305929
|
let parsedOverrides = null;
|
|
1305732
1305930
|
try {
|
|
1305733
|
-
const contents = (await (0,
|
|
1305931
|
+
const contents = (await (0, import_promises45.readFile)(overridesFilepath, "utf8")).toString();
|
|
1305734
1305932
|
try {
|
|
1305735
1305933
|
parsedOverrides = JSON.parse(contents);
|
|
1305736
1305934
|
} catch (err) {
|
|
@@ -1305788,7 +1305986,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
1305788
1305986
|
}
|
|
1305789
1305987
|
}
|
|
1305790
1305988
|
const components = { schemas };
|
|
1305791
|
-
await (0,
|
|
1305989
|
+
await (0, import_promises45.writeFile)(
|
|
1305792
1305990
|
join(dirname(spec.absoluteFilepath), RelativeFilePath.of("openapi-overrides.yml")),
|
|
1305793
1305991
|
js_yaml_default.dump({ paths, components })
|
|
1305794
1305992
|
);
|
|
@@ -1305806,15 +1306004,15 @@ var import_generator_exec_sdk = __toESM(require_generator_exec_sdk(), 1);
|
|
|
1305806
1306004
|
var import_api3 = __toESM(require_api35(), 1);
|
|
1305807
1306005
|
|
|
1305808
1306006
|
// ../generation/local-generation/local-workspace-runner/lib/constants.js
|
|
1305809
|
-
var
|
|
1306007
|
+
var import_path38 = __toESM(require("path"), 1);
|
|
1305810
1306008
|
var DOCKER_FERN_DIRECTORY = "/fern";
|
|
1305811
|
-
var DOCKER_CODEGEN_OUTPUT_DIRECTORY =
|
|
1305812
|
-
var DOCKER_GENERATOR_CONFIG_PATH =
|
|
1305813
|
-
var DOCKER_PATH_TO_IR =
|
|
1305814
|
-
var DOCKER_PATH_TO_SNIPPET =
|
|
1305815
|
-
var DOCKER_PATH_TO_SNIPPET_TEMPLATES =
|
|
1305816
|
-
var DOCKER_GENERATORS_DIRECTORY =
|
|
1305817
|
-
var DOCKER_SOURCES_DIRECTORY =
|
|
1306009
|
+
var DOCKER_CODEGEN_OUTPUT_DIRECTORY = import_path38.default.join(DOCKER_FERN_DIRECTORY, "output");
|
|
1306010
|
+
var DOCKER_GENERATOR_CONFIG_PATH = import_path38.default.join(DOCKER_FERN_DIRECTORY, "config.json");
|
|
1306011
|
+
var DOCKER_PATH_TO_IR = import_path38.default.join(DOCKER_FERN_DIRECTORY, "ir.json");
|
|
1306012
|
+
var DOCKER_PATH_TO_SNIPPET = import_path38.default.join(DOCKER_FERN_DIRECTORY, "snippet.json");
|
|
1306013
|
+
var DOCKER_PATH_TO_SNIPPET_TEMPLATES = import_path38.default.join(DOCKER_FERN_DIRECTORY, "snippet-templates.json");
|
|
1306014
|
+
var DOCKER_GENERATORS_DIRECTORY = import_path38.default.join(DOCKER_FERN_DIRECTORY, "generators");
|
|
1306015
|
+
var DOCKER_SOURCES_DIRECTORY = import_path38.default.join(DOCKER_FERN_DIRECTORY, "sources");
|
|
1305818
1306016
|
|
|
1305819
1306017
|
// ../generation/local-generation/local-workspace-runner/lib/getGeneratorConfig.js
|
|
1305820
1306018
|
var DEFAULT_OUTPUT_VERSION = "0.0.1";
|
|
@@ -1306061,7 +1306259,7 @@ async function getIntermediateRepresentation2({ workspace, audiences, generatorI
|
|
|
1306061
1306259
|
|
|
1306062
1306260
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
1306063
1306261
|
var import_dockerode2 = __toESM(require_docker(), 1);
|
|
1306064
|
-
var
|
|
1306262
|
+
var import_promises46 = require("fs/promises");
|
|
1306065
1306263
|
var import_stream3 = require("stream");
|
|
1306066
1306264
|
var import_tmp_promise6 = __toESM(require_tmp_promise(), 1);
|
|
1306067
1306265
|
async function runDocker({ imageName, args, binds, writeLogsToFile = true, removeAfterCompletion = false }) {
|
|
@@ -1306100,7 +1306298,7 @@ async function tryRunDocker({ docker, imageName, args, binds, removeAfterComplet
|
|
|
1306100
1306298
|
if (status.StatusCode !== 0) {
|
|
1306101
1306299
|
if (writeLogsToFile) {
|
|
1306102
1306300
|
const tmpFile = await import_tmp_promise6.default.file();
|
|
1306103
|
-
await (0,
|
|
1306301
|
+
await (0, import_promises46.writeFile)(tmpFile.path, logs);
|
|
1306104
1306302
|
throw new Error(`Docker exited with a non-zero exit code. Logs here: ${tmpFile.path}`);
|
|
1306105
1306303
|
} else {
|
|
1306106
1306304
|
throw new Error("Docker exited with a non-zero exit code.");
|
|
@@ -1306122,12 +1306320,12 @@ async function pullImage(docker, imageName) {
|
|
|
1306122
1306320
|
|
|
1306123
1306321
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
1306124
1306322
|
var FernGeneratorExecParsing = __toESM(require_serialization33(), 1);
|
|
1306125
|
-
var
|
|
1306323
|
+
var import_promises48 = require("fs/promises");
|
|
1306126
1306324
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
1306127
1306325
|
|
|
1306128
1306326
|
// ../generation/local-generation/local-workspace-runner/lib/LocalTaskHandler.js
|
|
1306129
1306327
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
1306130
|
-
var
|
|
1306328
|
+
var import_promises47 = require("fs/promises");
|
|
1306131
1306329
|
var import_tmp_promise7 = __toESM(require_tmp_promise(), 1);
|
|
1306132
1306330
|
var LocalTaskHandler = class {
|
|
1306133
1306331
|
context;
|
|
@@ -1306173,7 +1306371,7 @@ var LocalTaskHandler = class {
|
|
|
1306173
1306371
|
const tmpOutputResolutionDir = AbsoluteFilePath.of((await import_tmp_promise7.default.dir({})).path);
|
|
1306174
1306372
|
const absolutePathToFernignore = AbsoluteFilePath.of(join(this.absolutePathToLocalOutput, RelativeFilePath.of(FERNIGNORE_FILENAME)));
|
|
1306175
1306373
|
const fernIngnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
1306176
|
-
await (0,
|
|
1306374
|
+
await (0, import_promises47.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
1306177
1306375
|
await this.runGitCommand(["init"], tmpOutputResolutionDir);
|
|
1306178
1306376
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
1306179
1306377
|
const response = await this.runGitCommand(["config", "--list"], tmpOutputResolutionDir);
|
|
@@ -1306186,16 +1306384,16 @@ var LocalTaskHandler = class {
|
|
|
1306186
1306384
|
await this.copyGeneratedFilesToDirectory(tmpOutputResolutionDir);
|
|
1306187
1306385
|
await this.runGitCommand(["reset", "--", ...fernIngnorePaths], tmpOutputResolutionDir);
|
|
1306188
1306386
|
await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
1306189
|
-
await (0,
|
|
1306190
|
-
await (0,
|
|
1306387
|
+
await (0, import_promises47.rmdir)(this.absolutePathToLocalOutput, { recursive: true });
|
|
1306388
|
+
await (0, import_promises47.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
1306191
1306389
|
}
|
|
1306192
1306390
|
async copyGeneratedFilesNoFernIgnore() {
|
|
1306193
1306391
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
1306194
|
-
await (0,
|
|
1306392
|
+
await (0, import_promises47.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
1306195
1306393
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
1306196
1306394
|
}
|
|
1306197
1306395
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
1306198
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
1306396
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises47.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
1306199
1306397
|
if (firstLocalOutputItem == null) {
|
|
1306200
1306398
|
return;
|
|
1306201
1306399
|
}
|
|
@@ -1306203,15 +1306401,15 @@ var LocalTaskHandler = class {
|
|
|
1306203
1306401
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
1306204
1306402
|
await (0, import_decompress2.default)(join(this.absolutePathToTmpOutputDirectory, RelativeFilePath.of(firstLocalOutputItem)), outputPath);
|
|
1306205
1306403
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
1306206
|
-
await (0,
|
|
1306404
|
+
await (0, import_promises47.cp)(join(this.absolutePathToTmpOutputDirectory, RelativeFilePath.of(localOutputItem)), join(outputPath, RelativeFilePath.of(localOutputItem)), { recursive: true });
|
|
1306207
1306405
|
}
|
|
1306208
1306406
|
} else {
|
|
1306209
|
-
await (0,
|
|
1306407
|
+
await (0, import_promises47.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
1306210
1306408
|
}
|
|
1306211
1306409
|
}
|
|
1306212
1306410
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
1306213
1306411
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
1306214
|
-
await (0,
|
|
1306412
|
+
await (0, import_promises47.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
1306215
1306413
|
}
|
|
1306216
1306414
|
async runGitCommand(options2, cwd2) {
|
|
1306217
1306415
|
const response = await loggingExeca(this.context.logger, "git", options2, {
|
|
@@ -1306223,7 +1306421,7 @@ var LocalTaskHandler = class {
|
|
|
1306223
1306421
|
};
|
|
1306224
1306422
|
var NEW_LINE_REGEX = /\r?\n/;
|
|
1306225
1306423
|
async function getFernIgnorePaths({ absolutePathToFernignore }) {
|
|
1306226
|
-
const fernIgnoreFileContents = (await (0,
|
|
1306424
|
+
const fernIgnoreFileContents = (await (0, import_promises47.readFile)(absolutePathToFernignore)).toString();
|
|
1306227
1306425
|
return [
|
|
1306228
1306426
|
FERNIGNORE_FILENAME,
|
|
1306229
1306427
|
...fernIgnoreFileContents.trim().split(NEW_LINE_REGEX).filter((line) => !line.startsWith("#") && line.length > 0)
|
|
@@ -1306316,7 +1306514,7 @@ async function writeIrToFile({ workspace, audiences, generatorInvocation, worksp
|
|
|
1306316
1306514
|
tmpdir: workspaceTempDir.path
|
|
1306317
1306515
|
});
|
|
1306318
1306516
|
const absolutePathToIr = AbsoluteFilePath.of(irFile.path);
|
|
1306319
|
-
await (0,
|
|
1306517
|
+
await (0, import_promises48.writeFile)(absolutePathToIr, JSON.stringify(intermediateRepresentation, void 0, 4));
|
|
1306320
1306518
|
context.logger.debug(`Wrote IR to ${absolutePathToIr}`);
|
|
1306321
1306519
|
return absolutePathToIr;
|
|
1306322
1306520
|
}
|
|
@@ -1306348,7 +1306546,7 @@ async function runGenerator({ workspaceName, organization, outputVersion, absolu
|
|
|
1306348
1306546
|
if (!parsedConfig.ok) {
|
|
1306349
1306547
|
throw new Error(`Failed to parse config.json into ${absolutePathToWriteConfigJson}`);
|
|
1306350
1306548
|
}
|
|
1306351
|
-
await (0,
|
|
1306549
|
+
await (0, import_promises48.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(parsedConfig.value, void 0, 4));
|
|
1306352
1306550
|
const doesConfigJsonExist = await waitUntilPathExists(absolutePathToWriteConfigJson, 5e3);
|
|
1306353
1306551
|
if (!doesConfigJsonExist) {
|
|
1306354
1306552
|
throw new Error(`Failed to create ${absolutePathToWriteConfigJson}`);
|
|
@@ -1306379,7 +1306577,7 @@ function getDockerDestinationForSource(source) {
|
|
|
1306379
1306577
|
|
|
1306380
1306578
|
// ../generation/local-generation/local-workspace-runner/lib/runLocalGenerationForWorkspace.js
|
|
1306381
1306579
|
var import_os5 = __toESM(require("os"), 1);
|
|
1306382
|
-
var
|
|
1306580
|
+
var import_path39 = __toESM(require("path"), 1);
|
|
1306383
1306581
|
var import_tmp_promise9 = __toESM(require_tmp_promise(), 1);
|
|
1306384
1306582
|
async function runLocalGenerationForWorkspace({ projectConfig, workspace, generatorGroup, keepDocker, context }) {
|
|
1306385
1306583
|
const workspaceTempDir = await getWorkspaceTempDir();
|
|
@@ -1306422,7 +1306620,7 @@ async function runLocalGenerationForWorkspace({ projectConfig, workspace, genera
|
|
|
1306422
1306620
|
}
|
|
1306423
1306621
|
async function getWorkspaceTempDir() {
|
|
1306424
1306622
|
return import_tmp_promise9.default.dir({
|
|
1306425
|
-
tmpdir: import_os5.default.platform() === "darwin" ?
|
|
1306623
|
+
tmpdir: import_os5.default.platform() === "darwin" ? import_path39.default.join("/private", import_os5.default.tmpdir()) : void 0,
|
|
1306426
1306624
|
prefix: "fern"
|
|
1306427
1306625
|
});
|
|
1306428
1306626
|
}
|
|
@@ -1306433,8 +1306631,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
|
|
|
1306433
1306631
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
1306434
1306632
|
var import_axios5 = __toESM(require_axios4(), 1);
|
|
1306435
1306633
|
var import_fs8 = require("fs");
|
|
1306436
|
-
var
|
|
1306437
|
-
var
|
|
1306634
|
+
var import_promises49 = require("fs/promises");
|
|
1306635
|
+
var import_promises50 = require("stream/promises");
|
|
1306438
1306636
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context }) {
|
|
1306439
1306637
|
try {
|
|
1306440
1306638
|
await downloadFileForTask({
|
|
@@ -1306451,18 +1306649,18 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
1306451
1306649
|
responseType: "stream"
|
|
1306452
1306650
|
});
|
|
1306453
1306651
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1306454
|
-
await (0,
|
|
1306652
|
+
await (0, import_promises49.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1306455
1306653
|
}
|
|
1306456
|
-
await (0,
|
|
1306457
|
-
await (0,
|
|
1306654
|
+
await (0, import_promises49.mkdir)(dirname(absolutePathToLocalOutput), { recursive: true });
|
|
1306655
|
+
await (0, import_promises50.pipeline)(request.data, (0, import_fs8.createWriteStream)(absolutePathToLocalOutput));
|
|
1306458
1306656
|
}
|
|
1306459
1306657
|
|
|
1306460
1306658
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
1306461
1306659
|
var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
1306462
1306660
|
var import_axios6 = __toESM(require_axios4(), 1);
|
|
1306463
1306661
|
var import_form_data2 = __toESM(require_form_data(), 1);
|
|
1306464
|
-
var
|
|
1306465
|
-
var
|
|
1306662
|
+
var import_promises51 = require("fs/promises");
|
|
1306663
|
+
var import_path40 = require("path");
|
|
1306466
1306664
|
var import_tar2 = __toESM(require_tar(), 1);
|
|
1306467
1306665
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
1306468
1306666
|
async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version3, context, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview }) {
|
|
@@ -1306502,23 +1306700,23 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1306502
1306700
|
context.logger.debug(`Writing mock fern definition to ${absolutePathToTmpDir}`);
|
|
1306503
1306701
|
const absolutePathToTmpFernDirectory = join(absolutePathToTmpDir, RelativeFilePath.of(FERN_DIRECTORY));
|
|
1306504
1306702
|
const absolutePathToTmpDefinitionDirectory = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(DEFINITION_DIRECTORY));
|
|
1306505
|
-
await (0,
|
|
1306703
|
+
await (0, import_promises51.mkdir)(absolutePathToTmpDefinitionDirectory, { recursive: true });
|
|
1306506
1306704
|
const absolutePathToApiYml = join(absolutePathToTmpDefinitionDirectory, RelativeFilePath.of(ROOT_API_FILENAME));
|
|
1306507
|
-
await (0,
|
|
1306705
|
+
await (0, import_promises51.writeFile)(absolutePathToApiYml, js_yaml_default.dump(workspace.definition.rootApiFile.contents));
|
|
1306508
1306706
|
await writeFernDefinition({
|
|
1306509
1306707
|
absolutePathToDefinitionDirectory: absolutePathToTmpDefinitionDirectory,
|
|
1306510
1306708
|
definition: workspace.definition
|
|
1306511
1306709
|
});
|
|
1306512
1306710
|
const absolutePathToFernConfigJson = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(PROJECT_CONFIG_FILENAME));
|
|
1306513
|
-
await (0,
|
|
1306711
|
+
await (0, import_promises51.writeFile)(absolutePathToFernConfigJson, JSON.stringify(projectConfig.rawConfig, void 0, 2));
|
|
1306514
1306712
|
try {
|
|
1306515
1306713
|
const sources = workspace.getSources();
|
|
1306516
1306714
|
for (const source of sources) {
|
|
1306517
|
-
const sourceContents = await (0,
|
|
1306518
|
-
const relativeLocation = (0,
|
|
1306715
|
+
const sourceContents = await (0, import_promises51.readFile)(source.absoluteFilePath);
|
|
1306716
|
+
const relativeLocation = (0, import_path40.relative)(workspace.absoluteFilepath, source.absoluteFilePath);
|
|
1306519
1306717
|
const absolutePathToSourceFile = join(absolutePathToTmpFernDirectory, RelativeFilePath.of(relativeLocation));
|
|
1306520
|
-
await (0,
|
|
1306521
|
-
await (0,
|
|
1306718
|
+
await (0, import_promises51.mkdir)(dirname(absolutePathToSourceFile), { recursive: true });
|
|
1306719
|
+
await (0, import_promises51.writeFile)(absolutePathToSourceFile, sourceContents);
|
|
1306522
1306720
|
}
|
|
1306523
1306721
|
} catch (error) {
|
|
1306524
1306722
|
context.logger.debug(`Failed to write source files to disk, continuing: ${error}`);
|
|
@@ -1306541,7 +1306739,7 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1306541
1306739
|
}
|
|
1306542
1306740
|
} else {
|
|
1306543
1306741
|
context.logger.debug("Uploading definition...");
|
|
1306544
|
-
await import_axios6.default.put(definitionUploadUrlRequest.body.s3Url, await (0,
|
|
1306742
|
+
await import_axios6.default.put(definitionUploadUrlRequest.body.s3Url, await (0, import_promises51.readFile)(tarPath));
|
|
1306545
1306743
|
fernDefinitionMetadata = {
|
|
1306546
1306744
|
definitionS3DownloadUrl: definitionUploadUrlRequest.body.s3Url,
|
|
1306547
1306745
|
outputPath: ".mock",
|
|
@@ -1306603,14 +1306801,14 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
1306603
1306801
|
async function writeFernDefinition({ absolutePathToDefinitionDirectory, definition: definition3 }) {
|
|
1306604
1306802
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
1306605
1306803
|
const absolutePathToDefinitionFile = join(absolutePathToDefinitionDirectory, RelativeFilePath.of(relativePath));
|
|
1306606
|
-
await (0,
|
|
1306607
|
-
await (0,
|
|
1306804
|
+
await (0, import_promises51.mkdir)(dirname(absolutePathToDefinitionFile), { recursive: true });
|
|
1306805
|
+
await (0, import_promises51.writeFile)(absolutePathToDefinitionFile, js_yaml_default.dump(definitionFile.contents));
|
|
1306608
1306806
|
}
|
|
1306609
1306807
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
1306610
1306808
|
if (packageMarker.contents.export == null) {
|
|
1306611
1306809
|
const absolutePathToPackageMarker = join(absolutePathToDefinitionDirectory, RelativeFilePath.of(relativePath));
|
|
1306612
|
-
await (0,
|
|
1306613
|
-
await (0,
|
|
1306810
|
+
await (0, import_promises51.mkdir)(dirname(absolutePathToPackageMarker), { recursive: true });
|
|
1306811
|
+
await (0, import_promises51.writeFile)(absolutePathToPackageMarker, js_yaml_default.dump(packageMarker.contents));
|
|
1306614
1306812
|
}
|
|
1306615
1306813
|
}
|
|
1306616
1306814
|
for (const [relativePath, importedDefinition] of Object.entries(definition3.importedDefinitions)) {
|
|
@@ -1306726,9 +1306924,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context }) {
|
|
|
1306726
1306924
|
var import_axios7 = __toESM(require_axios4(), 1);
|
|
1306727
1306925
|
var import_decompress3 = __toESM(require_decompress(), 1);
|
|
1306728
1306926
|
var import_fs9 = require("fs");
|
|
1306729
|
-
var
|
|
1306730
|
-
var
|
|
1306731
|
-
var
|
|
1306927
|
+
var import_promises52 = require("fs/promises");
|
|
1306928
|
+
var import_path41 = __toESM(require("path"), 1);
|
|
1306929
|
+
var import_promises53 = require("stream/promises");
|
|
1306732
1306930
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
1306733
1306931
|
var _isFinished, _createdSnippets, _snippetsS3PreSignedReadUrl;
|
|
1306734
1306932
|
var RemoteTaskHandler = class {
|
|
@@ -1306812,7 +1307010,7 @@ var RemoteTaskHandler = class {
|
|
|
1306812
1307010
|
} : void 0;
|
|
1306813
1307011
|
}
|
|
1306814
1307012
|
getAbsolutePathToLocalOutput() {
|
|
1306815
|
-
return this.absolutePathToPreview != null ? join(this.absolutePathToPreview, RelativeFilePath.of(
|
|
1307013
|
+
return this.absolutePathToPreview != null ? join(this.absolutePathToPreview, RelativeFilePath.of(import_path41.default.basename(this.generatorInvocation.name))) : this.generatorInvocation.absolutePathToLocalOutput;
|
|
1306816
1307014
|
}
|
|
1306817
1307015
|
get isFinished() {
|
|
1306818
1307016
|
return __privateGet(this, _isFinished);
|
|
@@ -1306843,12 +1307041,12 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1306843
1307041
|
responseType: "stream"
|
|
1306844
1307042
|
});
|
|
1306845
1307043
|
const tmpDir = await import_tmp_promise11.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1306846
|
-
const outputZipPath =
|
|
1306847
|
-
await (0,
|
|
1307044
|
+
const outputZipPath = import_path41.default.join(tmpDir.path, "output.zip");
|
|
1307045
|
+
await (0, import_promises53.pipeline)(request.data, (0, import_fs9.createWriteStream)(outputZipPath));
|
|
1306848
1307046
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1306849
|
-
await (0,
|
|
1307047
|
+
await (0, import_promises52.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1306850
1307048
|
}
|
|
1306851
|
-
await (0,
|
|
1307049
|
+
await (0, import_promises52.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
1306852
1307050
|
await (0, import_decompress3.default)(outputZipPath, absolutePathToLocalOutput);
|
|
1306853
1307051
|
}
|
|
1306854
1307052
|
function convertLogLevel(logLevel) {
|
|
@@ -1306867,7 +1307065,7 @@ function convertLogLevel(logLevel) {
|
|
|
1306867
1307065
|
}
|
|
1306868
1307066
|
|
|
1306869
1307067
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
1306870
|
-
var
|
|
1307068
|
+
var import_promises54 = require("fs/promises");
|
|
1306871
1307069
|
var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
|
|
1306872
1307070
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
1306873
1307071
|
var SourceUploader = class {
|
|
@@ -1306888,7 +1307086,7 @@ var SourceUploader = class {
|
|
|
1306888
1307086
|
}
|
|
1306889
1307087
|
async uploadSource(source, uploadURL) {
|
|
1306890
1307088
|
const uploadCommand = await this.getUploadCommand(source);
|
|
1306891
|
-
const fileData = await (0,
|
|
1307089
|
+
const fileData = await (0, import_promises54.readFile)(uploadCommand.absoluteFilePath);
|
|
1306892
1307090
|
const response = await fetch(uploadURL, {
|
|
1306893
1307091
|
method: "PUT",
|
|
1306894
1307092
|
body: fileData,
|
|
@@ -1306908,7 +1307106,7 @@ var SourceUploader = class {
|
|
|
1306908
1307106
|
absoluteFilePath,
|
|
1306909
1307107
|
cleanup: async () => {
|
|
1306910
1307108
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
1306911
|
-
await (0,
|
|
1307109
|
+
await (0, import_promises54.unlink)(absoluteFilePath);
|
|
1306912
1307110
|
}
|
|
1306913
1307111
|
};
|
|
1306914
1307112
|
}
|
|
@@ -1307153,7 +1307351,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
1307153
1307351
|
|
|
1307154
1307352
|
// ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
|
|
1307155
1307353
|
var import_axios8 = __toESM(require_axios4(), 1);
|
|
1307156
|
-
var
|
|
1307354
|
+
var import_promises55 = require("fs/promises");
|
|
1307157
1307355
|
var mime = __toESM(require_mime_types(), 1);
|
|
1307158
1307356
|
|
|
1307159
1307357
|
// ../generation/remote-generation/remote-workspace-runner/lib/measureImageSizes.js
|
|
@@ -1307308,7 +1307506,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context, batchSize)
|
|
|
1307308
1307506
|
const absoluteFilePath = resolve(docsWorkspacePath, relativeFilePath);
|
|
1307309
1307507
|
try {
|
|
1307310
1307508
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
1307311
|
-
await import_axios8.default.put(uploadUrl, await (0,
|
|
1307509
|
+
await import_axios8.default.put(uploadUrl, await (0, import_promises55.readFile)(absoluteFilePath), {
|
|
1307312
1307510
|
headers: {
|
|
1307313
1307511
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType
|
|
1307314
1307512
|
}
|
|
@@ -1307928,8 +1308126,8 @@ async function mockServer({
|
|
|
1307928
1308126
|
// src/commands/register/registerWorkspacesV1.ts
|
|
1307929
1308127
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
1307930
1308128
|
var import_axios9 = __toESM(require_axios4(), 1);
|
|
1307931
|
-
var
|
|
1307932
|
-
var
|
|
1308129
|
+
var import_promises56 = require("fs/promises");
|
|
1308130
|
+
var import_path42 = __toESM(require("path"), 1);
|
|
1307933
1308131
|
var import_tar3 = __toESM(require_tar(), 1);
|
|
1307934
1308132
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
1307935
1308133
|
async function registerWorkspacesV1({
|
|
@@ -1307974,11 +1308172,11 @@ async function registerWorkspacesV1({
|
|
|
1307974
1308172
|
return;
|
|
1307975
1308173
|
}
|
|
1307976
1308174
|
const tmpDir = await import_tmp_promise13.default.dir();
|
|
1307977
|
-
const tarPath =
|
|
1308175
|
+
const tarPath = import_path42.default.join(tmpDir.path, "definition.tgz");
|
|
1307978
1308176
|
context.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
1307979
1308177
|
await import_tar3.default.create({ file: tarPath, cwd: resolvedWorkspace.absoluteFilepath }, ["."]);
|
|
1307980
1308178
|
context.logger.info("Uploading definition...");
|
|
1307981
|
-
await import_axios9.default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
1308179
|
+
await import_axios9.default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises56.readFile)(tarPath));
|
|
1307982
1308180
|
context.logger.info(
|
|
1307983
1308181
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
1307984
1308182
|
);
|
|
@@ -1308105,20 +1308303,20 @@ async function generateToken({
|
|
|
1308105
1308303
|
|
|
1308106
1308304
|
// src/commands/upgrade/updateApiSpec.ts
|
|
1308107
1308305
|
var fs7 = __toESM(require("fs"), 1);
|
|
1308108
|
-
var
|
|
1308306
|
+
var import_promises57 = require("fs/promises");
|
|
1308109
1308307
|
var import_stream4 = require("stream");
|
|
1308110
|
-
var
|
|
1308308
|
+
var import_promises58 = require("stream/promises");
|
|
1308111
1308309
|
async function fetchAndWriteFile(url, path45, logger) {
|
|
1308112
1308310
|
const resp = await fetch(url);
|
|
1308113
1308311
|
if (resp.ok && resp.body) {
|
|
1308114
1308312
|
logger.debug("Origin successfully fetched, writing to file");
|
|
1308115
1308313
|
const fileStream = fs7.createWriteStream(path45);
|
|
1308116
|
-
await (0,
|
|
1308117
|
-
const fileContents = await (0,
|
|
1308314
|
+
await (0, import_promises58.finished)(import_stream4.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
1308315
|
+
const fileContents = await (0, import_promises57.readFile)(path45, "utf8");
|
|
1308118
1308316
|
try {
|
|
1308119
|
-
await (0,
|
|
1308317
|
+
await (0, import_promises57.writeFile)(path45, JSON.stringify(JSON.parse(fileContents), void 0, 2), "utf8");
|
|
1308120
1308318
|
} catch (e) {
|
|
1308121
|
-
await (0,
|
|
1308319
|
+
await (0, import_promises57.writeFile)(path45, js_yaml_default.dump(js_yaml_default.load(fileContents)), "utf8");
|
|
1308122
1308320
|
}
|
|
1308123
1308321
|
logger.debug("File written successfully");
|
|
1308124
1308322
|
}
|
|
@@ -1308206,7 +1308404,7 @@ async function updateApiSpec({
|
|
|
1308206
1308404
|
}
|
|
1308207
1308405
|
|
|
1308208
1308406
|
// ../yaml/yaml-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
1308209
|
-
var
|
|
1308407
|
+
var import_promises59 = require("fs/promises");
|
|
1308210
1308408
|
|
|
1308211
1308409
|
// ../yaml/yaml-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
1308212
1308410
|
var import_glob_promise2 = __toESM(require_lib(), 1);
|
|
@@ -1308240,7 +1308438,7 @@ var migration = {
|
|
|
1308240
1308438
|
try {
|
|
1308241
1308439
|
const fileContents = await getFileContents(yamlFilepath);
|
|
1308242
1308440
|
const newContents = addDiscriminantToFile(fileContents);
|
|
1308243
|
-
await (0,
|
|
1308441
|
+
await (0, import_promises59.writeFile)(yamlFilepath, newContents);
|
|
1308244
1308442
|
} catch (error) {
|
|
1308245
1308443
|
context.failAndThrow("Failed to migrate " + yamlFilepath, error);
|
|
1308246
1308444
|
}
|
|
@@ -1308248,7 +1308446,7 @@ var migration = {
|
|
|
1308248
1308446
|
}
|
|
1308249
1308447
|
};
|
|
1308250
1308448
|
async function getFileContents(filepath) {
|
|
1308251
|
-
const buffer = await (0,
|
|
1308449
|
+
const buffer = await (0, import_promises59.readFile)(filepath);
|
|
1308252
1308450
|
return buffer.toString();
|
|
1308253
1308451
|
}
|
|
1308254
1308452
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -1308277,8 +1308475,8 @@ var versionMigrations = {
|
|
|
1308277
1308475
|
var __default = versionMigrations;
|
|
1308278
1308476
|
|
|
1308279
1308477
|
// ../yaml/yaml-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
1308280
|
-
var
|
|
1308281
|
-
var
|
|
1308478
|
+
var import_promises60 = require("fs/promises");
|
|
1308479
|
+
var import_yaml3 = __toESM(require_dist5(), 1);
|
|
1308282
1308480
|
|
|
1308283
1308481
|
// ../yaml/yaml-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
1308284
1308482
|
var import_glob_promise3 = __toESM(require_lib(), 1);
|
|
@@ -1308318,39 +1308516,39 @@ var migration2 = {
|
|
|
1308318
1308516
|
}
|
|
1308319
1308517
|
};
|
|
1308320
1308518
|
async function migrateFile(filepath, context) {
|
|
1308321
|
-
const contents = await (0,
|
|
1308322
|
-
const parsedDocument =
|
|
1308519
|
+
const contents = await (0, import_promises60.readFile)(filepath);
|
|
1308520
|
+
const parsedDocument = import_yaml3.default.parseDocument(contents.toString());
|
|
1308323
1308521
|
const types3 = parsedDocument.get("types");
|
|
1308324
1308522
|
if (types3 == null) {
|
|
1308325
1308523
|
return;
|
|
1308326
1308524
|
}
|
|
1308327
|
-
if (!
|
|
1308525
|
+
if (!import_yaml3.default.isMap(types3)) {
|
|
1308328
1308526
|
context.failWithoutThrowing(`"types" is not a map in ${filepath}`);
|
|
1308329
1308527
|
return;
|
|
1308330
1308528
|
}
|
|
1308331
1308529
|
for (const typeDeclaration of types3.items) {
|
|
1308332
|
-
if (
|
|
1308530
|
+
if (import_yaml3.default.isMap(typeDeclaration.value)) {
|
|
1308333
1308531
|
const union4 = typeDeclaration.value.get("union");
|
|
1308334
1308532
|
if (union4 == null) {
|
|
1308335
1308533
|
continue;
|
|
1308336
1308534
|
}
|
|
1308337
|
-
if (!
|
|
1308535
|
+
if (!import_yaml3.default.isMap(union4)) {
|
|
1308338
1308536
|
context.failWithoutThrowing(`"union" is not a map in ${filepath}`);
|
|
1308339
1308537
|
continue;
|
|
1308340
1308538
|
}
|
|
1308341
1308539
|
for (const singleUnionType of union4.items) {
|
|
1308342
|
-
if (
|
|
1308540
|
+
if (import_yaml3.default.isScalar(singleUnionType.value)) {
|
|
1308343
1308541
|
singleUnionType.value = {
|
|
1308344
1308542
|
type: singleUnionType.value,
|
|
1308345
1308543
|
key: singleUnionType.key
|
|
1308346
1308544
|
};
|
|
1308347
|
-
} else if (
|
|
1308348
|
-
singleUnionType.value.add(new
|
|
1308545
|
+
} else if (import_yaml3.default.isMap(singleUnionType.value)) {
|
|
1308546
|
+
singleUnionType.value.add(new import_yaml3.default.Pair("key", singleUnionType.key));
|
|
1308349
1308547
|
}
|
|
1308350
1308548
|
}
|
|
1308351
1308549
|
}
|
|
1308352
1308550
|
}
|
|
1308353
|
-
await (0,
|
|
1308551
|
+
await (0, import_promises60.writeFile)(filepath, parsedDocument.toString());
|
|
1308354
1308552
|
}
|
|
1308355
1308553
|
|
|
1308356
1308554
|
// ../yaml/yaml-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -1308361,8 +1308559,8 @@ var versionMigrations2 = {
|
|
|
1308361
1308559
|
var __default2 = versionMigrations2;
|
|
1308362
1308560
|
|
|
1308363
1308561
|
// ../yaml/yaml-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
1308364
|
-
var
|
|
1308365
|
-
var
|
|
1308562
|
+
var import_promises61 = require("fs/promises");
|
|
1308563
|
+
var import_yaml4 = __toESM(require_dist5(), 1);
|
|
1308366
1308564
|
|
|
1308367
1308565
|
// ../yaml/yaml-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
1308368
1308566
|
var import_glob_promise4 = __toESM(require_lib(), 1);
|
|
@@ -1308402,18 +1308600,18 @@ var migration3 = {
|
|
|
1308402
1308600
|
}
|
|
1308403
1308601
|
};
|
|
1308404
1308602
|
async function migrateGeneratorsYml(filepath, context) {
|
|
1308405
|
-
const contents = await (0,
|
|
1308406
|
-
const parsedDocument =
|
|
1308603
|
+
const contents = await (0, import_promises61.readFile)(filepath);
|
|
1308604
|
+
const parsedDocument = import_yaml4.default.parseDocument(contents.toString());
|
|
1308407
1308605
|
const draftGenerators = parsedDocument.get("draft");
|
|
1308408
1308606
|
if (draftGenerators == null) {
|
|
1308409
1308607
|
return;
|
|
1308410
1308608
|
}
|
|
1308411
|
-
if (!
|
|
1308609
|
+
if (!import_yaml4.default.isSeq(draftGenerators)) {
|
|
1308412
1308610
|
context.failWithoutThrowing(`draft generators are not a list in ${filepath}`);
|
|
1308413
1308611
|
return;
|
|
1308414
1308612
|
}
|
|
1308415
1308613
|
draftGenerators.items.forEach((draftGenerator) => {
|
|
1308416
|
-
if (!
|
|
1308614
|
+
if (!import_yaml4.default.isMap(draftGenerator)) {
|
|
1308417
1308615
|
context.failWithoutThrowing(`draft generator is not an object in ${filepath}`);
|
|
1308418
1308616
|
return;
|
|
1308419
1308617
|
}
|
|
@@ -1308429,7 +1308627,7 @@ async function migrateGeneratorsYml(filepath, context) {
|
|
|
1308429
1308627
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
1308430
1308628
|
}
|
|
1308431
1308629
|
});
|
|
1308432
|
-
await (0,
|
|
1308630
|
+
await (0, import_promises61.writeFile)(filepath, parsedDocument.toString());
|
|
1308433
1308631
|
}
|
|
1308434
1308632
|
|
|
1308435
1308633
|
// ../yaml/yaml-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -1308440,8 +1308638,8 @@ var versionMigrations3 = {
|
|
|
1308440
1308638
|
var __default3 = versionMigrations3;
|
|
1308441
1308639
|
|
|
1308442
1308640
|
// ../yaml/yaml-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
1308443
|
-
var
|
|
1308444
|
-
var
|
|
1308641
|
+
var import_promises62 = require("fs/promises");
|
|
1308642
|
+
var import_yaml5 = __toESM(require_dist5(), 1);
|
|
1308445
1308643
|
|
|
1308446
1308644
|
// ../yaml/yaml-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
1308447
1308645
|
var import_glob_promise5 = __toESM(require_lib(), 1);
|
|
@@ -1308481,15 +1308679,15 @@ var migration4 = {
|
|
|
1308481
1308679
|
}
|
|
1308482
1308680
|
};
|
|
1308483
1308681
|
async function migrateFile2(filepath, context) {
|
|
1308484
|
-
const contents = await (0,
|
|
1308485
|
-
const parsedDocument =
|
|
1308682
|
+
const contents = await (0, import_promises62.readFile)(filepath);
|
|
1308683
|
+
const parsedDocument = import_yaml5.default.parseDocument(contents.toString());
|
|
1308486
1308684
|
const addType = (typeName, typeDeclaration) => {
|
|
1308487
1308685
|
const types3 = parsedDocument.get("types");
|
|
1308488
1308686
|
if (types3 == null) {
|
|
1308489
1308687
|
parsedDocument.set("types", {
|
|
1308490
1308688
|
[typeName]: typeDeclaration
|
|
1308491
1308689
|
});
|
|
1308492
|
-
} else if (!
|
|
1308690
|
+
} else if (!import_yaml5.default.isMap(types3)) {
|
|
1308493
1308691
|
context.failWithoutThrowing(`"types" is not a map in ${filepath}`);
|
|
1308494
1308692
|
} else {
|
|
1308495
1308693
|
types3.set(typeName, typeDeclaration);
|
|
@@ -1308499,12 +1308697,12 @@ async function migrateFile2(filepath, context) {
|
|
|
1308499
1308697
|
if (errors2 == null) {
|
|
1308500
1308698
|
return;
|
|
1308501
1308699
|
}
|
|
1308502
|
-
if (!
|
|
1308700
|
+
if (!import_yaml5.default.isMap(errors2)) {
|
|
1308503
1308701
|
context.failWithoutThrowing(`"errors" is not a map in ${filepath}`);
|
|
1308504
1308702
|
return;
|
|
1308505
1308703
|
}
|
|
1308506
1308704
|
for (const errorDeclaration of errors2.items) {
|
|
1308507
|
-
if (!
|
|
1308705
|
+
if (!import_yaml5.default.isMap(errorDeclaration.value)) {
|
|
1308508
1308706
|
context.failWithoutThrowing(`Error "${errorDeclaration.key}" is not a map in ${filepath}`);
|
|
1308509
1308707
|
continue;
|
|
1308510
1308708
|
}
|
|
@@ -1308516,7 +1308714,7 @@ async function migrateFile2(filepath, context) {
|
|
|
1308516
1308714
|
}
|
|
1308517
1308715
|
const httpSection = errorDeclaration.value.get("http");
|
|
1308518
1308716
|
if (httpSection != null) {
|
|
1308519
|
-
if (!
|
|
1308717
|
+
if (!import_yaml5.default.isMap(httpSection)) {
|
|
1308520
1308718
|
context.failWithoutThrowing(`http in "${errorDeclaration.key}" is not a map in ${filepath}`);
|
|
1308521
1308719
|
} else {
|
|
1308522
1308720
|
const statusCode = httpSection.get("statusCode", true);
|
|
@@ -1308525,7 +1308723,7 @@ async function migrateFile2(filepath, context) {
|
|
|
1308525
1308723
|
}
|
|
1308526
1308724
|
}
|
|
1308527
1308725
|
}
|
|
1308528
|
-
await (0,
|
|
1308726
|
+
await (0, import_promises62.writeFile)(filepath, parsedDocument.toString());
|
|
1308529
1308727
|
}
|
|
1308530
1308728
|
|
|
1308531
1308729
|
// ../yaml/yaml-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -1308536,8 +1308734,8 @@ var versionMigrations4 = {
|
|
|
1308536
1308734
|
var __default4 = versionMigrations4;
|
|
1308537
1308735
|
|
|
1308538
1308736
|
// ../yaml/yaml-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
1308539
|
-
var
|
|
1308540
|
-
var
|
|
1308737
|
+
var import_promises63 = require("fs/promises");
|
|
1308738
|
+
var import_yaml6 = __toESM(require_dist5(), 1);
|
|
1308541
1308739
|
|
|
1308542
1308740
|
// ../yaml/yaml-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
1308543
1308741
|
var import_glob_promise6 = __toESM(require_lib(), 1);
|
|
@@ -1308577,37 +1308775,37 @@ var migration5 = {
|
|
|
1308577
1308775
|
}
|
|
1308578
1308776
|
};
|
|
1308579
1308777
|
async function migrateGeneratorsYml2(filepath, context) {
|
|
1308580
|
-
const contents = await (0,
|
|
1308581
|
-
const parsedDocument =
|
|
1308778
|
+
const contents = await (0, import_promises63.readFile)(filepath);
|
|
1308779
|
+
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
1308582
1308780
|
const releaseGenerators = parsedDocument.get("release");
|
|
1308583
1308781
|
if (releaseGenerators == null) {
|
|
1308584
1308782
|
return;
|
|
1308585
1308783
|
}
|
|
1308586
|
-
if (!
|
|
1308784
|
+
if (!import_yaml6.default.isSeq(releaseGenerators)) {
|
|
1308587
1308785
|
context.failWithoutThrowing(`release generators are not a list in ${filepath}`);
|
|
1308588
1308786
|
return;
|
|
1308589
1308787
|
}
|
|
1308590
1308788
|
releaseGenerators.items.forEach((releaseGenerator) => {
|
|
1308591
|
-
if (!
|
|
1308789
|
+
if (!import_yaml6.default.isMap(releaseGenerator)) {
|
|
1308592
1308790
|
context.failWithoutThrowing(`release generator is not an object in ${filepath}`);
|
|
1308593
1308791
|
return;
|
|
1308594
1308792
|
}
|
|
1308595
1308793
|
const outputs = releaseGenerator.get("outputs");
|
|
1308596
|
-
if (!
|
|
1308794
|
+
if (!import_yaml6.default.isMap(outputs)) {
|
|
1308597
1308795
|
context.failWithoutThrowing(`outputs is not an object in ${filepath}`);
|
|
1308598
1308796
|
return;
|
|
1308599
1308797
|
}
|
|
1308600
1308798
|
const githubOutput = outputs.get("github");
|
|
1308601
|
-
if (
|
|
1308799
|
+
if (import_yaml6.default.isMap(githubOutput) && githubOutput.has("repository")) {
|
|
1308602
1308800
|
releaseGenerator.set("github", githubOutput);
|
|
1308603
1308801
|
}
|
|
1308604
1308802
|
const publishing = {};
|
|
1308605
1308803
|
const npmOutput = outputs.get("npm");
|
|
1308606
|
-
if (
|
|
1308804
|
+
if (import_yaml6.default.isMap(npmOutput)) {
|
|
1308607
1308805
|
publishing.npm = npmOutput;
|
|
1308608
1308806
|
}
|
|
1308609
1308807
|
const mavenOutput = outputs.get("maven");
|
|
1308610
|
-
if (
|
|
1308808
|
+
if (import_yaml6.default.isMap(mavenOutput)) {
|
|
1308611
1308809
|
publishing.maven = mavenOutput;
|
|
1308612
1308810
|
}
|
|
1308613
1308811
|
if (Object.keys(publishing).length > 0) {
|
|
@@ -1308615,7 +1308813,7 @@ async function migrateGeneratorsYml2(filepath, context) {
|
|
|
1308615
1308813
|
}
|
|
1308616
1308814
|
releaseGenerator.delete("outputs");
|
|
1308617
1308815
|
});
|
|
1308618
|
-
await (0,
|
|
1308816
|
+
await (0, import_promises63.writeFile)(filepath, parsedDocument.toString());
|
|
1308619
1308817
|
}
|
|
1308620
1308818
|
|
|
1308621
1308819
|
// ../yaml/yaml-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -1308626,7 +1308824,7 @@ var versionMigrations5 = {
|
|
|
1308626
1308824
|
var __default5 = versionMigrations5;
|
|
1308627
1308825
|
|
|
1308628
1308826
|
// ../yaml/yaml-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
1308629
|
-
var
|
|
1308827
|
+
var import_promises64 = require("fs/promises");
|
|
1308630
1308828
|
|
|
1308631
1308829
|
// ../yaml/yaml-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
1308632
1308830
|
var import_glob_promise7 = __toESM(require_lib(), 1);
|
|
@@ -1308657,9 +1308855,9 @@ var migration6 = {
|
|
|
1308657
1308855
|
run: async ({ context }) => {
|
|
1308658
1308856
|
const yamlFiles = await getAllYamlFiles4(context);
|
|
1308659
1308857
|
for (const filepath of yamlFiles) {
|
|
1308660
|
-
const contents = await (0,
|
|
1308858
|
+
const contents = await (0, import_promises64.readFile)(filepath);
|
|
1308661
1308859
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
1308662
|
-
await (0,
|
|
1308860
|
+
await (0, import_promises64.writeFile)(filepath, newContents);
|
|
1308663
1308861
|
}
|
|
1308664
1308862
|
}
|
|
1308665
1308863
|
};
|
|
@@ -1308672,7 +1308870,7 @@ var versionMigrations6 = {
|
|
|
1308672
1308870
|
var __default6 = versionMigrations6;
|
|
1308673
1308871
|
|
|
1308674
1308872
|
// ../yaml/yaml-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
1308675
|
-
var
|
|
1308873
|
+
var import_promises65 = require("fs/promises");
|
|
1308676
1308874
|
|
|
1308677
1308875
|
// ../yaml/yaml-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
1308678
1308876
|
var import_glob_promise8 = __toESM(require_lib(), 1);
|
|
@@ -1308703,9 +1308901,9 @@ var migration7 = {
|
|
|
1308703
1308901
|
run: async ({ context }) => {
|
|
1308704
1308902
|
const yamlFiles = await getAllRootApiYamlFiles(context);
|
|
1308705
1308903
|
for (const filepath of yamlFiles) {
|
|
1308706
|
-
const contents = await (0,
|
|
1308904
|
+
const contents = await (0, import_promises65.readFile)(filepath);
|
|
1308707
1308905
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
1308708
|
-
await (0,
|
|
1308906
|
+
await (0, import_promises65.writeFile)(filepath, newContents);
|
|
1308709
1308907
|
}
|
|
1308710
1308908
|
}
|
|
1308711
1308909
|
};
|
|
@@ -1308718,7 +1308916,7 @@ var versionMigrations7 = {
|
|
|
1308718
1308916
|
var __default7 = versionMigrations7;
|
|
1308719
1308917
|
|
|
1308720
1308918
|
// ../yaml/yaml-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
1308721
|
-
var
|
|
1308919
|
+
var import_promises66 = require("fs/promises");
|
|
1308722
1308920
|
|
|
1308723
1308921
|
// ../yaml/yaml-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
1308724
1308922
|
var import_glob_promise9 = __toESM(require_lib(), 1);
|
|
@@ -1308825,7 +1309023,7 @@ var migration8 = {
|
|
|
1308825
1309023
|
}
|
|
1308826
1309024
|
};
|
|
1308827
1309025
|
async function migrateGeneratorsYml3(filepath) {
|
|
1308828
|
-
const contentsStr = await (0,
|
|
1309026
|
+
const contentsStr = await (0, import_promises66.readFile)(filepath);
|
|
1308829
1309027
|
const contents = js_yaml_default.load(contentsStr.toString());
|
|
1308830
1309028
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
1308831
1309029
|
let newGeneratorsConfiguration = {};
|
|
@@ -1308843,7 +1309041,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
1308843
1309041
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
1308844
1309042
|
};
|
|
1308845
1309043
|
}
|
|
1308846
|
-
await (0,
|
|
1309044
|
+
await (0, import_promises66.writeFile)(filepath, js_yaml_default.dump(newGeneratorsConfiguration));
|
|
1308847
1309045
|
}
|
|
1308848
1309046
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
1308849
1309047
|
const newSchema = {
|
|
@@ -1308918,8 +1309116,8 @@ var versionMigrations8 = {
|
|
|
1308918
1309116
|
var __default8 = versionMigrations8;
|
|
1308919
1309117
|
|
|
1308920
1309118
|
// ../yaml/yaml-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
1308921
|
-
var
|
|
1308922
|
-
var
|
|
1309119
|
+
var import_promises67 = require("fs/promises");
|
|
1309120
|
+
var import_yaml7 = __toESM(require_dist5(), 1);
|
|
1308923
1309121
|
|
|
1308924
1309122
|
// ../yaml/yaml-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
1308925
1309123
|
var import_glob_promise10 = __toESM(require_lib(), 1);
|
|
@@ -1308959,10 +1309157,10 @@ var migration9 = {
|
|
|
1308959
1309157
|
}
|
|
1308960
1309158
|
};
|
|
1308961
1309159
|
async function migrateRootApiFile(filepath) {
|
|
1308962
|
-
const contents = await (0,
|
|
1308963
|
-
const parsedDocument =
|
|
1309160
|
+
const contents = await (0, import_promises67.readFile)(filepath);
|
|
1309161
|
+
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
1308964
1309162
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
1308965
|
-
if (errorDiscriminant == null || !
|
|
1309163
|
+
if (errorDiscriminant == null || !import_yaml7.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
1308966
1309164
|
return;
|
|
1308967
1309165
|
}
|
|
1308968
1309166
|
parsedDocument.set("error-discrimination", {
|
|
@@ -1308970,7 +1309168,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
1308970
1309168
|
"property-name": errorDiscriminant.value
|
|
1308971
1309169
|
});
|
|
1308972
1309170
|
parsedDocument.delete("error-discriminant");
|
|
1308973
|
-
await (0,
|
|
1309171
|
+
await (0, import_promises67.writeFile)(filepath, parsedDocument.toString());
|
|
1308974
1309172
|
}
|
|
1308975
1309173
|
|
|
1308976
1309174
|
// ../yaml/yaml-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -1308981,8 +1309179,8 @@ var versionMigrations9 = {
|
|
|
1308981
1309179
|
var __default9 = versionMigrations9;
|
|
1308982
1309180
|
|
|
1308983
1309181
|
// ../yaml/yaml-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
1308984
|
-
var
|
|
1308985
|
-
var
|
|
1309182
|
+
var import_promises68 = require("fs/promises");
|
|
1309183
|
+
var import_yaml8 = __toESM(require_dist5(), 1);
|
|
1308986
1309184
|
|
|
1308987
1309185
|
// ../yaml/yaml-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
1308988
1309186
|
var import_glob_promise11 = __toESM(require_lib(), 1);
|
|
@@ -1309022,24 +1309220,24 @@ var migration10 = {
|
|
|
1309022
1309220
|
}
|
|
1309023
1309221
|
};
|
|
1309024
1309222
|
async function migrateYamlFile(filepath, context) {
|
|
1309025
|
-
const contents = await (0,
|
|
1309026
|
-
const parsedDocument =
|
|
1309223
|
+
const contents = await (0, import_promises68.readFile)(filepath);
|
|
1309224
|
+
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
1309027
1309225
|
const services = parsedDocument.get("services");
|
|
1309028
1309226
|
if (services == null) {
|
|
1309029
1309227
|
return;
|
|
1309030
1309228
|
}
|
|
1309031
|
-
if (!
|
|
1309229
|
+
if (!import_yaml8.default.isMap(services)) {
|
|
1309032
1309230
|
throw new Error("'services' is not a map");
|
|
1309033
1309231
|
}
|
|
1309034
1309232
|
const httpServices = services.get("http");
|
|
1309035
1309233
|
if (httpServices == null) {
|
|
1309036
1309234
|
return;
|
|
1309037
1309235
|
}
|
|
1309038
|
-
if (!
|
|
1309236
|
+
if (!import_yaml8.default.isMap(httpServices)) {
|
|
1309039
1309237
|
throw new Error("'http' is not a map");
|
|
1309040
1309238
|
}
|
|
1309041
1309239
|
for (const service of httpServices.items) {
|
|
1309042
|
-
if (!
|
|
1309240
|
+
if (!import_yaml8.default.isMap(service.value)) {
|
|
1309043
1309241
|
context.failWithoutThrowing(`Service '${service.key}' is not a map`);
|
|
1309044
1309242
|
continue;
|
|
1309045
1309243
|
}
|
|
@@ -1309047,12 +1309245,12 @@ async function migrateYamlFile(filepath, context) {
|
|
|
1309047
1309245
|
if (endpoints == null) {
|
|
1309048
1309246
|
continue;
|
|
1309049
1309247
|
}
|
|
1309050
|
-
if (!
|
|
1309248
|
+
if (!import_yaml8.default.isMap(endpoints)) {
|
|
1309051
1309249
|
context.failWithoutThrowing(`Endpoints are not a map in service '${service.key}'`);
|
|
1309052
1309250
|
continue;
|
|
1309053
1309251
|
}
|
|
1309054
1309252
|
for (const endpoint of endpoints.items) {
|
|
1309055
|
-
if (!
|
|
1309253
|
+
if (!import_yaml8.default.isMap(endpoint.value)) {
|
|
1309056
1309254
|
context.failWithoutThrowing(`Endpoint ${endpoint.key} is not a map in service '${service.key}'`);
|
|
1309057
1309255
|
continue;
|
|
1309058
1309256
|
}
|
|
@@ -1309062,14 +1309260,14 @@ async function migrateYamlFile(filepath, context) {
|
|
|
1309062
1309260
|
context.failWithoutThrowing("Failed to convert endpoint", e);
|
|
1309063
1309261
|
}
|
|
1309064
1309262
|
}
|
|
1309065
|
-
await (0,
|
|
1309263
|
+
await (0, import_promises68.writeFile)(filepath, parsedDocument.toString());
|
|
1309066
1309264
|
}
|
|
1309067
1309265
|
}
|
|
1309068
1309266
|
function convertEndpoint18({ document: document4, endpoint }) {
|
|
1309069
|
-
const newRequest = new
|
|
1309267
|
+
const newRequest = new import_yaml8.default.YAMLMap();
|
|
1309070
1309268
|
const parsedRequestBody = parseRequestBody(endpoint);
|
|
1309071
1309269
|
if (parsedRequestBody != null) {
|
|
1309072
|
-
let newBody = new
|
|
1309270
|
+
let newBody = new import_yaml8.default.YAMLMap();
|
|
1309073
1309271
|
const { requestBodyType, docs: originalRequestDocs } = parsedRequestBody;
|
|
1309074
1309272
|
if (originalRequestDocs != null) {
|
|
1309075
1309273
|
newBody.set("docs", originalRequestDocs);
|
|
@@ -1309077,11 +1309275,11 @@ function convertEndpoint18({ document: document4, endpoint }) {
|
|
|
1309077
1309275
|
newBody.set("type", requestBodyType);
|
|
1309078
1309276
|
const documentTypes = document4.get("types");
|
|
1309079
1309277
|
if (documentTypes != null) {
|
|
1309080
|
-
if (!
|
|
1309278
|
+
if (!import_yaml8.default.isMap(documentTypes)) {
|
|
1309081
1309279
|
throw new Error("types are not a map");
|
|
1309082
1309280
|
}
|
|
1309083
1309281
|
const maybeTypeDeclarationForRequest = documentTypes.get(requestBodyType);
|
|
1309084
|
-
if (maybeTypeDeclarationForRequest != null &&
|
|
1309282
|
+
if (maybeTypeDeclarationForRequest != null && import_yaml8.default.isMap(maybeTypeDeclarationForRequest)) {
|
|
1309085
1309283
|
const objectExtends = maybeTypeDeclarationForRequest.get("extends");
|
|
1309086
1309284
|
const objectProperties = maybeTypeDeclarationForRequest.get("properties");
|
|
1309087
1309285
|
if (objectExtends != null || objectProperties != null) {
|
|
@@ -1309116,7 +1309314,7 @@ function parseRequestBody(endpoint) {
|
|
|
1309116
1309314
|
if (typeof requestBody === "string") {
|
|
1309117
1309315
|
return { requestBodyType: requestBody, docs: void 0 };
|
|
1309118
1309316
|
}
|
|
1309119
|
-
if (
|
|
1309317
|
+
if (import_yaml8.default.isMap(requestBody)) {
|
|
1309120
1309318
|
const type2 = requestBody.get("type");
|
|
1309121
1309319
|
if (type2 == null) {
|
|
1309122
1309320
|
throw new Error("request type does not exist");
|
|
@@ -1309146,10 +1309344,10 @@ var import_legacy_docs_config = __toESM(require_legacy_docs_config(), 1);
|
|
|
1309146
1309344
|
var LegacyDocsSerializers = __toESM(require_serialization34(), 1);
|
|
1309147
1309345
|
|
|
1309148
1309346
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
1309149
|
-
var
|
|
1309347
|
+
var import_promises69 = require("fs/promises");
|
|
1309150
1309348
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
1309151
1309349
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1309152
|
-
const contentsStr = await (0,
|
|
1309350
|
+
const contentsStr = await (0, import_promises69.readFile)(filepath);
|
|
1309153
1309351
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
1309154
1309352
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
1309155
1309353
|
if (result.ok) {
|
|
@@ -1309167,7 +1309365,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
1309167
1309365
|
}
|
|
1309168
1309366
|
|
|
1309169
1309367
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
1309170
|
-
var
|
|
1309368
|
+
var import_promises71 = require("fs/promises");
|
|
1309171
1309369
|
|
|
1309172
1309370
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
1309173
1309371
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -1309348,10 +1309546,10 @@ __export(legacy_exports, {
|
|
|
1309348
1309546
|
});
|
|
1309349
1309547
|
|
|
1309350
1309548
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
1309351
|
-
var
|
|
1309549
|
+
var import_promises70 = require("fs/promises");
|
|
1309352
1309550
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
1309353
1309551
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1309354
|
-
const contentsStr = await (0,
|
|
1309552
|
+
const contentsStr = await (0, import_promises70.readFile)(filepath);
|
|
1309355
1309553
|
const contentsParsed = js_yaml_default.load(contentsStr.toString());
|
|
1309356
1309554
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
1309357
1309555
|
if (result.success) {
|
|
@@ -1309381,7 +1309579,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
1309381
1309579
|
var APIS_DIRECTORY2 = "apis";
|
|
1309382
1309580
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
1309383
1309581
|
const absolutePathToApisDirectory = join(absolutePathToFernDirectory, RelativeFilePath.of(APIS_DIRECTORY2));
|
|
1309384
|
-
await (0,
|
|
1309582
|
+
await (0, import_promises71.mkdir)(absolutePathToApisDirectory);
|
|
1309385
1309583
|
for (const workspace of workspaces) {
|
|
1309386
1309584
|
const absolutePathToWorkspace = join(absolutePathToFernDirectory, RelativeFilePath.of(workspace));
|
|
1309387
1309585
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -1309389,11 +1309587,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
1309389
1309587
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
1309390
1309588
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1309391
1309589
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1309392
|
-
await (0,
|
|
1309590
|
+
await (0, import_promises71.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1309393
1309591
|
}
|
|
1309394
1309592
|
const absolutePathToNestedWorkspace = join(absolutePathToApisDirectory, RelativeFilePath.of(workspace));
|
|
1309395
1309593
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1309396
|
-
await (0,
|
|
1309594
|
+
await (0, import_promises71.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1309397
1309595
|
}
|
|
1309398
1309596
|
}
|
|
1309399
1309597
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -1309406,7 +1309604,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
1309406
1309604
|
generatorsConfiguration,
|
|
1309407
1309605
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1309408
1309606
|
});
|
|
1309409
|
-
await (0,
|
|
1309607
|
+
await (0, import_promises71.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309410
1309608
|
return convertedResponse.docsURLs;
|
|
1309411
1309609
|
}
|
|
1309412
1309610
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -1309420,19 +1309618,19 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
1309420
1309618
|
apiName
|
|
1309421
1309619
|
});
|
|
1309422
1309620
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1309423
|
-
await (0,
|
|
1309621
|
+
await (0, import_promises71.writeFile)(absolutePathToDocsConfig, js_yaml_default.dump(convertedDocsConfig));
|
|
1309424
1309622
|
}
|
|
1309425
1309623
|
|
|
1309426
1309624
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
1309427
|
-
var
|
|
1309625
|
+
var import_promises72 = require("fs/promises");
|
|
1309428
1309626
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1309429
1309627
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
1309430
1309628
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
1309431
1309629
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1309432
1309630
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1309433
1309631
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1309434
|
-
await (0,
|
|
1309435
|
-
await (0,
|
|
1309632
|
+
await (0, import_promises72.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1309633
|
+
await (0, import_promises72.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1309436
1309634
|
}
|
|
1309437
1309635
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
1309438
1309636
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1309445,7 +1309643,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
1309445
1309643
|
apiName: void 0
|
|
1309446
1309644
|
});
|
|
1309447
1309645
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1309448
|
-
await (0,
|
|
1309646
|
+
await (0, import_promises72.writeFile)(absolutePathToDocsConfig, js_yaml_default.dump(convertedDocsConfig));
|
|
1309449
1309647
|
}
|
|
1309450
1309648
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
1309451
1309649
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1309457,22 +1309655,22 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
1309457
1309655
|
generatorsConfiguration,
|
|
1309458
1309656
|
pathModificationStrategy: "MoveUp"
|
|
1309459
1309657
|
});
|
|
1309460
|
-
await (0,
|
|
1309658
|
+
await (0, import_promises72.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309461
1309659
|
return convertedResponse.docsURLs;
|
|
1309462
1309660
|
}
|
|
1309463
1309661
|
|
|
1309464
1309662
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
1309465
|
-
var
|
|
1309663
|
+
var import_promises73 = require("fs/promises");
|
|
1309466
1309664
|
var APIS_DIRECTORY3 = "apis";
|
|
1309467
1309665
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
1309468
1309666
|
const absolutePathToApisDirectory = join(absolutePathToFernDirectory, RelativeFilePath.of(APIS_DIRECTORY3));
|
|
1309469
|
-
await (0,
|
|
1309667
|
+
await (0, import_promises73.mkdir)(absolutePathToApisDirectory);
|
|
1309470
1309668
|
for (const workspace of workspaces) {
|
|
1309471
1309669
|
const absolutePathToWorkspace = join(absolutePathToFernDirectory, RelativeFilePath.of(workspace));
|
|
1309472
1309670
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
1309473
1309671
|
const absolutePathToNestedWorkspace = join(absolutePathToApisDirectory, RelativeFilePath.of(workspace));
|
|
1309474
1309672
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1309475
|
-
await (0,
|
|
1309673
|
+
await (0, import_promises73.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1309476
1309674
|
}
|
|
1309477
1309675
|
}
|
|
1309478
1309676
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -1309485,15 +1309683,15 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
1309485
1309683
|
generatorsConfiguration,
|
|
1309486
1309684
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1309487
1309685
|
});
|
|
1309488
|
-
await (0,
|
|
1309686
|
+
await (0, import_promises73.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309489
1309687
|
}
|
|
1309490
1309688
|
|
|
1309491
1309689
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
1309492
|
-
var
|
|
1309690
|
+
var import_promises74 = require("fs/promises");
|
|
1309493
1309691
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1309494
1309692
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
1309495
1309693
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1309496
|
-
await (0,
|
|
1309694
|
+
await (0, import_promises74.rmdir)(absolutePathToWorkspace, { recursive: true });
|
|
1309497
1309695
|
}
|
|
1309498
1309696
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
1309499
1309697
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1309505,7 +1309703,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
1309505
1309703
|
generatorsConfiguration,
|
|
1309506
1309704
|
pathModificationStrategy: "MoveUp"
|
|
1309507
1309705
|
});
|
|
1309508
|
-
await (0,
|
|
1309706
|
+
await (0, import_promises74.writeFile)(absolutePathToGeneratorsConfiguration, js_yaml_default.dump(convertedResponse.value));
|
|
1309509
1309707
|
}
|
|
1309510
1309708
|
|
|
1309511
1309709
|
// ../yaml/yaml-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -1309582,8 +1309780,8 @@ var versionMigrations11 = {
|
|
|
1309582
1309780
|
var __default11 = versionMigrations11;
|
|
1309583
1309781
|
|
|
1309584
1309782
|
// ../yaml/yaml-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
1309585
|
-
var
|
|
1309586
|
-
var
|
|
1309783
|
+
var import_promises75 = require("fs/promises");
|
|
1309784
|
+
var import_yaml9 = __toESM(require_dist5(), 1);
|
|
1309587
1309785
|
|
|
1309588
1309786
|
// ../yaml/yaml-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
1309589
1309787
|
var import_glob_promise12 = __toESM(require_lib(), 1);
|
|
@@ -1309623,24 +1309821,24 @@ var migration12 = {
|
|
|
1309623
1309821
|
}
|
|
1309624
1309822
|
};
|
|
1309625
1309823
|
async function migrateYamlFile2(filepath, context) {
|
|
1309626
|
-
const contents = await (0,
|
|
1309627
|
-
const parsedDocument =
|
|
1309824
|
+
const contents = await (0, import_promises75.readFile)(filepath);
|
|
1309825
|
+
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
1309628
1309826
|
const types3 = parsedDocument.get("types");
|
|
1309629
1309827
|
if (types3 == null) {
|
|
1309630
1309828
|
return;
|
|
1309631
1309829
|
}
|
|
1309632
|
-
if (!
|
|
1309830
|
+
if (!import_yaml9.default.isMap(types3)) {
|
|
1309633
1309831
|
throw new Error("'types' is not a map");
|
|
1309634
1309832
|
}
|
|
1309635
1309833
|
for (const type2 of types3.items) {
|
|
1309636
|
-
if (!
|
|
1309834
|
+
if (!import_yaml9.default.isMap(type2.value)) {
|
|
1309637
1309835
|
continue;
|
|
1309638
1309836
|
}
|
|
1309639
1309837
|
const examples = type2.value.get("examples");
|
|
1309640
1309838
|
if (examples == null) {
|
|
1309641
1309839
|
continue;
|
|
1309642
1309840
|
}
|
|
1309643
|
-
if (!
|
|
1309841
|
+
if (!import_yaml9.default.isSeq(examples)) {
|
|
1309644
1309842
|
context.failWithoutThrowing("'examples' are not a list");
|
|
1309645
1309843
|
continue;
|
|
1309646
1309844
|
}
|
|
@@ -1309649,7 +1309847,7 @@ async function migrateYamlFile2(filepath, context) {
|
|
|
1309649
1309847
|
examples.set(i2, { value });
|
|
1309650
1309848
|
}
|
|
1309651
1309849
|
}
|
|
1309652
|
-
await (0,
|
|
1309850
|
+
await (0, import_promises75.writeFile)(filepath, parsedDocument.toString());
|
|
1309653
1309851
|
}
|
|
1309654
1309852
|
|
|
1309655
1309853
|
// ../yaml/yaml-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -1309660,8 +1309858,8 @@ var versionMigrations12 = {
|
|
|
1309660
1309858
|
var __default12 = versionMigrations12;
|
|
1309661
1309859
|
|
|
1309662
1309860
|
// ../yaml/yaml-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
1309663
|
-
var
|
|
1309664
|
-
var
|
|
1309861
|
+
var import_promises76 = require("fs/promises");
|
|
1309862
|
+
var import_yaml10 = __toESM(require_dist5(), 1);
|
|
1309665
1309863
|
|
|
1309666
1309864
|
// ../yaml/yaml-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
1309667
1309865
|
var import_glob_promise13 = __toESM(require_lib(), 1);
|
|
@@ -1309701,14 +1309899,14 @@ var migration13 = {
|
|
|
1309701
1309899
|
}
|
|
1309702
1309900
|
};
|
|
1309703
1309901
|
async function migrateYamlFile3(filepath, context) {
|
|
1309704
|
-
const contents = await (0,
|
|
1309705
|
-
const parsedDocument =
|
|
1309706
|
-
if (!
|
|
1309902
|
+
const contents = await (0, import_promises76.readFile)(filepath);
|
|
1309903
|
+
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
1309904
|
+
if (!import_yaml10.default.isMap(parsedDocument.contents)) {
|
|
1309707
1309905
|
return context.failAndThrow("File is not a map");
|
|
1309708
1309906
|
}
|
|
1309709
1309907
|
for (const pair of parsedDocument.contents.items) {
|
|
1309710
|
-
if (
|
|
1309711
|
-
if (!
|
|
1309908
|
+
if (import_yaml10.default.isScalar(pair.key) && pair.key.value === "services") {
|
|
1309909
|
+
if (!import_yaml10.default.isMap(pair.value)) {
|
|
1309712
1309910
|
return context.failAndThrow("Services are not a map");
|
|
1309713
1309911
|
}
|
|
1309714
1309912
|
const httpServices = pair.value.get("http");
|
|
@@ -1309716,7 +1309914,7 @@ async function migrateYamlFile3(filepath, context) {
|
|
|
1309716
1309914
|
parsedDocument.contents.delete("services");
|
|
1309717
1309915
|
return;
|
|
1309718
1309916
|
}
|
|
1309719
|
-
if (!
|
|
1309917
|
+
if (!import_yaml10.default.isMap(httpServices)) {
|
|
1309720
1309918
|
return context.failAndThrow("http is not a map");
|
|
1309721
1309919
|
}
|
|
1309722
1309920
|
const [firstService, ...remainingServices] = httpServices.items;
|
|
@@ -1309731,7 +1309929,7 @@ async function migrateYamlFile3(filepath, context) {
|
|
|
1309731
1309929
|
pair.value = firstService.value;
|
|
1309732
1309930
|
}
|
|
1309733
1309931
|
}
|
|
1309734
|
-
await (0,
|
|
1309932
|
+
await (0, import_promises76.writeFile)(filepath, parsedDocument.toString());
|
|
1309735
1309933
|
}
|
|
1309736
1309934
|
|
|
1309737
1309935
|
// ../yaml/yaml-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -1309742,8 +1309940,8 @@ var versionMigrations13 = {
|
|
|
1309742
1309940
|
var __default13 = versionMigrations13;
|
|
1309743
1309941
|
|
|
1309744
1309942
|
// ../yaml/yaml-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
1309745
|
-
var
|
|
1309746
|
-
var
|
|
1309943
|
+
var import_promises77 = require("fs/promises");
|
|
1309944
|
+
var import_yaml11 = __toESM(require_dist5(), 1);
|
|
1309747
1309945
|
|
|
1309748
1309946
|
// ../yaml/yaml-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
1309749
1309947
|
var import_glob_promise14 = __toESM(require_lib(), 1);
|
|
@@ -1309783,26 +1309981,26 @@ var migration14 = {
|
|
|
1309783
1309981
|
}
|
|
1309784
1309982
|
};
|
|
1309785
1309983
|
async function migrateYamlFile4(filepath, context) {
|
|
1309786
|
-
const contents = await (0,
|
|
1309787
|
-
const parsedDocument =
|
|
1309788
|
-
if (!
|
|
1309984
|
+
const contents = await (0, import_promises77.readFile)(filepath);
|
|
1309985
|
+
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1309986
|
+
if (!import_yaml11.default.isMap(parsedDocument.contents)) {
|
|
1309789
1309987
|
return context.failAndThrow("File is not a map");
|
|
1309790
1309988
|
}
|
|
1309791
1309989
|
const service = parsedDocument.contents.get("service");
|
|
1309792
1309990
|
if (service == null) {
|
|
1309793
1309991
|
return;
|
|
1309794
1309992
|
}
|
|
1309795
|
-
if (!
|
|
1309993
|
+
if (!import_yaml11.default.isMap(service)) {
|
|
1309796
1309994
|
return context.failAndThrow("service is not a map");
|
|
1309797
1309995
|
}
|
|
1309798
|
-
const indexOfServiceDocsPair = service.items.findIndex((item) =>
|
|
1309996
|
+
const indexOfServiceDocsPair = service.items.findIndex((item) => import_yaml11.default.isScalar(item.key) && item.key.value === "docs");
|
|
1309799
1309997
|
const docsPair = service.items[indexOfServiceDocsPair];
|
|
1309800
1309998
|
if (docsPair == null) {
|
|
1309801
1309999
|
return;
|
|
1309802
1310000
|
}
|
|
1309803
1310001
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
1309804
1310002
|
parsedDocument.contents.items.unshift(docsPair);
|
|
1309805
|
-
await (0,
|
|
1310003
|
+
await (0, import_promises77.writeFile)(filepath, parsedDocument.toString());
|
|
1309806
1310004
|
}
|
|
1309807
1310005
|
|
|
1309808
1310006
|
// ../yaml/yaml-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -1309813,7 +1310011,7 @@ var versionMigrations14 = {
|
|
|
1309813
1310011
|
var __default14 = versionMigrations14;
|
|
1309814
1310012
|
|
|
1309815
1310013
|
// ../yaml/yaml-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
1309816
|
-
var
|
|
1310014
|
+
var import_promises78 = require("fs/promises");
|
|
1309817
1310015
|
|
|
1309818
1310016
|
// ../yaml/yaml-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
1309819
1310017
|
var import_glob_promise15 = __toESM(require_lib(), 1);
|
|
@@ -1309853,14 +1310051,14 @@ var migration15 = {
|
|
|
1309853
1310051
|
}
|
|
1309854
1310052
|
};
|
|
1309855
1310053
|
async function migrateYamlFile5(filepath) {
|
|
1309856
|
-
const contents = await (0,
|
|
1310054
|
+
const contents = await (0, import_promises78.readFile)(filepath);
|
|
1309857
1310055
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
1309858
1310056
|
const regex4 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
1309859
1310057
|
const updatedSnapshot = contents.toString().replace(regex4, (_match, _prefix, domain2) => {
|
|
1309860
1310058
|
return `docs:
|
|
1309861
1310059
|
domain: "${domain2}.${domainSuffix}"`;
|
|
1309862
1310060
|
});
|
|
1309863
|
-
await (0,
|
|
1310061
|
+
await (0, import_promises78.writeFile)(filepath, updatedSnapshot.toString());
|
|
1309864
1310062
|
}
|
|
1309865
1310063
|
|
|
1309866
1310064
|
// ../yaml/yaml-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -1309961,7 +1310159,7 @@ ${source_default.dim(migration16.summary)}`
|
|
|
1309961
1310159
|
}
|
|
1309962
1310160
|
|
|
1309963
1310161
|
// src/commands/upgrade/upgrade.ts
|
|
1309964
|
-
var
|
|
1310162
|
+
var import_promises79 = require("fs/promises");
|
|
1309965
1310163
|
|
|
1309966
1310164
|
// ../../../node_modules/.pnpm/immer@9.0.15/node_modules/immer/dist/immer.esm.mjs
|
|
1309967
1310165
|
function n(n2) {
|
|
@@ -1310450,7 +1310648,7 @@ async function upgrade({
|
|
|
1310450
1310648
|
const newProjectConfig = immer_esm_default(projectConfig.rawConfig, (draft) => {
|
|
1310451
1310649
|
draft.version = fernCliUpgradeInfo.latestVersion;
|
|
1310452
1310650
|
});
|
|
1310453
|
-
await (0,
|
|
1310651
|
+
await (0, import_promises79.writeFile)(projectConfig._absolutePath, JSON.stringify(newProjectConfig, void 0, 2));
|
|
1310454
1310652
|
cliContext.logger.info(
|
|
1310455
1310653
|
`Upgrading from ${source_default.dim(cliContext.environment.packageVersion)} \u2192 ${source_default.green(
|
|
1310456
1310654
|
fernCliUpgradeInfo.latestVersion
|
|
@@ -1310471,125 +1310669,6 @@ async function upgrade({
|
|
|
1310471
1310669
|
}
|
|
1310472
1310670
|
}
|
|
1310473
1310671
|
|
|
1310474
|
-
// src/commands/upgrade/upgradeGenerator.ts
|
|
1310475
|
-
var import_promises79 = require("fs/promises");
|
|
1310476
|
-
var import_path42 = __toESM(require("path"), 1);
|
|
1310477
|
-
var semver3 = __toESM(require_semver2(), 1);
|
|
1310478
|
-
var import_yaml11 = __toESM(require_dist5(), 1);
|
|
1310479
|
-
async function loadAndUpdateGenerators({
|
|
1310480
|
-
absolutePathToWorkspace,
|
|
1310481
|
-
context,
|
|
1310482
|
-
generatorFilter,
|
|
1310483
|
-
groupFilter,
|
|
1310484
|
-
includeMajor
|
|
1310485
|
-
}) {
|
|
1310486
|
-
const filepath = generators_yml_exports.getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1310487
|
-
if (!await doesPathExist(filepath)) {
|
|
1310488
|
-
context.failAndThrow("Generators configuration file was not found, no generators to upgrade.");
|
|
1310489
|
-
return void 0;
|
|
1310490
|
-
}
|
|
1310491
|
-
const contents = await (0, import_promises79.readFile)(filepath);
|
|
1310492
|
-
context.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1310493
|
-
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1310494
|
-
const generatorGroups = parsedDocument.get("groups");
|
|
1310495
|
-
if (generatorGroups == null) {
|
|
1310496
|
-
context.failAndThrow("No groups were found within the generators configuration, no generators to upgrade.");
|
|
1310497
|
-
return void 0;
|
|
1310498
|
-
}
|
|
1310499
|
-
if (!import_yaml11.default.isMap(generatorGroups)) {
|
|
1310500
|
-
context.failAndThrow(`Expected 'groups' to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`);
|
|
1310501
|
-
return void 0;
|
|
1310502
|
-
}
|
|
1310503
|
-
context.logger.debug(`Groups found: ${generatorGroups.toString()}`);
|
|
1310504
|
-
for (const groupBlock of generatorGroups.items) {
|
|
1310505
|
-
const groupName = groupBlock.key;
|
|
1310506
|
-
const group = groupBlock.value;
|
|
1310507
|
-
if (!import_yaml11.default.isMap(group)) {
|
|
1310508
|
-
context.failAndThrow(
|
|
1310509
|
-
`Expected group ${groupName} to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310510
|
-
);
|
|
1310511
|
-
continue;
|
|
1310512
|
-
}
|
|
1310513
|
-
if (groupFilter != null && group.get("name") !== groupName) {
|
|
1310514
|
-
continue;
|
|
1310515
|
-
}
|
|
1310516
|
-
const generators = group.get("generators");
|
|
1310517
|
-
if (!import_yaml11.default.isSeq(generators)) {
|
|
1310518
|
-
context.failAndThrow(
|
|
1310519
|
-
`Expected group ${groupName} to have a 'generators' key in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310520
|
-
);
|
|
1310521
|
-
continue;
|
|
1310522
|
-
}
|
|
1310523
|
-
context.logger.debug(`Generators found: ${generators.toString()}`);
|
|
1310524
|
-
for (const generator of generators.items) {
|
|
1310525
|
-
if (!import_yaml11.default.isMap(generator)) {
|
|
1310526
|
-
context.failAndThrow(
|
|
1310527
|
-
`Expected generator in group ${groupName} to be a map in ${import_path42.default.relative(process.cwd(), filepath)}`
|
|
1310528
|
-
);
|
|
1310529
|
-
}
|
|
1310530
|
-
if (generatorFilter != null && generator.get("name") !== generatorFilter) {
|
|
1310531
|
-
continue;
|
|
1310532
|
-
}
|
|
1310533
|
-
const generatorName = generator.get("name");
|
|
1310534
|
-
const normalizedGeneratorName = generators_yml_exports.getGeneratorNameOrThrow(generatorName, context);
|
|
1310535
|
-
const currentVersion = generator.get("version");
|
|
1310536
|
-
const latestVersion2 = await generators_yml_exports.getLatestGeneratorVersion(normalizedGeneratorName, context);
|
|
1310537
|
-
context.logger.debug(`${generatorName}, ${currentVersion}, ${latestVersion2}`);
|
|
1310538
|
-
if (latestVersion2 == null) {
|
|
1310539
|
-
continue;
|
|
1310540
|
-
}
|
|
1310541
|
-
const currentMajor = semver3.major(currentVersion);
|
|
1310542
|
-
const latestMajor = semver3.major(latestVersion2);
|
|
1310543
|
-
if (currentMajor === latestMajor || includeMajor) {
|
|
1310544
|
-
generator.set("version", latestVersion2);
|
|
1310545
|
-
context.logger.info(source_default.green(`${generatorName} has been upgraded to latest in group: ${groupName}`));
|
|
1310546
|
-
}
|
|
1310547
|
-
}
|
|
1310548
|
-
}
|
|
1310549
|
-
return parsedDocument.toString();
|
|
1310550
|
-
}
|
|
1310551
|
-
async function upgradeGenerator2({
|
|
1310552
|
-
cliContext,
|
|
1310553
|
-
generator,
|
|
1310554
|
-
group,
|
|
1310555
|
-
project: { apiWorkspaces },
|
|
1310556
|
-
includeMajor
|
|
1310557
|
-
}) {
|
|
1310558
|
-
await Promise.all(
|
|
1310559
|
-
apiWorkspaces.map(async (workspace) => {
|
|
1310560
|
-
await cliContext.runTaskForWorkspace(workspace, async (context) => {
|
|
1310561
|
-
var _a6;
|
|
1310562
|
-
const generatorsConfiguration = await generators_yml_exports.loadRawGeneratorsConfiguration({
|
|
1310563
|
-
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1310564
|
-
context
|
|
1310565
|
-
}) ?? {};
|
|
1310566
|
-
if (generatorsConfiguration == null || generatorsConfiguration.groups == null) {
|
|
1310567
|
-
context.failAndThrow(
|
|
1310568
|
-
"No groups were found within the generators configuration, no generators to upgrade."
|
|
1310569
|
-
);
|
|
1310570
|
-
return;
|
|
1310571
|
-
}
|
|
1310572
|
-
context.logger.info(`Upgrading generators in workspace: ${workspace.workspaceName}`);
|
|
1310573
|
-
const updatedConfiguration = await loadAndUpdateGenerators({
|
|
1310574
|
-
absolutePathToWorkspace: workspace.absoluteFilepath,
|
|
1310575
|
-
context,
|
|
1310576
|
-
generatorFilter: generator,
|
|
1310577
|
-
groupFilter: group,
|
|
1310578
|
-
includeMajor
|
|
1310579
|
-
});
|
|
1310580
|
-
if (updatedConfiguration != null) {
|
|
1310581
|
-
await (0, import_promises79.writeFile)(
|
|
1310582
|
-
((_a6 = workspace.generatorsConfiguration) == null ? void 0 : _a6.absolutePathToConfiguration) ?? generators_yml_exports.getPathToGeneratorsConfiguration({
|
|
1310583
|
-
absolutePathToWorkspace: workspace.absoluteFilepath
|
|
1310584
|
-
}),
|
|
1310585
|
-
updatedConfiguration
|
|
1310586
|
-
);
|
|
1310587
|
-
}
|
|
1310588
|
-
});
|
|
1310589
|
-
})
|
|
1310590
|
-
);
|
|
1310591
|
-
}
|
|
1310592
|
-
|
|
1310593
1310672
|
// src/commands/validate/validateWorkspaces.ts
|
|
1310594
1310673
|
async function validateWorkspaces({
|
|
1310595
1310674
|
project,
|
|
@@ -1310795,7 +1310874,6 @@ async function tryRunCli(cliContext) {
|
|
|
1310795
1310874
|
addWriteOverridesCommand(cli, cliContext);
|
|
1310796
1310875
|
addTestCommand(cli, cliContext);
|
|
1310797
1310876
|
addUpdateApiSpecCommand(cli, cliContext);
|
|
1310798
|
-
addUpgradeGeneratorCommand(cli, cliContext);
|
|
1310799
1310877
|
addUpgradeCommand({
|
|
1310800
1310878
|
cli,
|
|
1310801
1310879
|
cliContext,
|
|
@@ -1310804,7 +1310882,7 @@ async function tryRunCli(cliContext) {
|
|
|
1310804
1310882
|
}
|
|
1310805
1310883
|
});
|
|
1310806
1310884
|
addGetOrganizationCommand(cli, cliContext);
|
|
1310807
|
-
|
|
1310885
|
+
addGeneratorCommands(cli, cliContext);
|
|
1310808
1310886
|
cli.middleware(async (argv) => {
|
|
1310809
1310887
|
cliContext.setLogLevel(argv["log-level"]);
|
|
1310810
1310888
|
cliContext.logDebugInfo();
|
|
@@ -1311238,48 +1311316,6 @@ function addUpgradeCommand({
|
|
|
1311238
1311316
|
}
|
|
1311239
1311317
|
);
|
|
1311240
1311318
|
}
|
|
1311241
|
-
function addUpgradeGeneratorCommand(cli, cliContext) {
|
|
1311242
|
-
cli.command(
|
|
1311243
|
-
"generator upgrade",
|
|
1311244
|
-
`Upgrades the specified generator in ${GENERATORS_CONFIGURATION_FILENAME} to the latest stable version.`,
|
|
1311245
|
-
(yargs) => yargs.option("generator", {
|
|
1311246
|
-
string: true,
|
|
1311247
|
-
description: "The type of generator to upgrade, ex: `fern-typescript-node-sdk`."
|
|
1311248
|
-
}).option("group", {
|
|
1311249
|
-
string: true,
|
|
1311250
|
-
description: "The group in which the generator is located, if group is not specified, the all generators of the specified type will be upgraded."
|
|
1311251
|
-
}).option("api", {
|
|
1311252
|
-
string: true,
|
|
1311253
|
-
description: "The API to upgrade the generator for. If not specified, the generator will be upgraded for all APIs."
|
|
1311254
|
-
}).option("include-major", {
|
|
1311255
|
-
boolean: true,
|
|
1311256
|
-
default: false,
|
|
1311257
|
-
description: "Whether or not to include major versions within the upgrade. Defaults to false, meaning major versions will be skipped."
|
|
1311258
|
-
}),
|
|
1311259
|
-
async (argv) => {
|
|
1311260
|
-
cliContext.instrumentPostHogEvent({
|
|
1311261
|
-
command: "fern generator upgrade",
|
|
1311262
|
-
properties: {
|
|
1311263
|
-
generator: argv.generator,
|
|
1311264
|
-
version: argv.version,
|
|
1311265
|
-
api: argv.api,
|
|
1311266
|
-
group: argv.group,
|
|
1311267
|
-
includeMajor: argv.includeMajor
|
|
1311268
|
-
}
|
|
1311269
|
-
});
|
|
1311270
|
-
await upgradeGenerator2({
|
|
1311271
|
-
cliContext,
|
|
1311272
|
-
generator: argv.generator,
|
|
1311273
|
-
group: argv.group,
|
|
1311274
|
-
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
1311275
|
-
commandLineApiWorkspace: argv.api,
|
|
1311276
|
-
defaultToAllApiWorkspaces: true
|
|
1311277
|
-
}),
|
|
1311278
|
-
includeMajor: argv.includeMajor
|
|
1311279
|
-
});
|
|
1311280
|
-
}
|
|
1311281
|
-
);
|
|
1311282
|
-
}
|
|
1311283
1311319
|
function addUpdateApiSpecCommand(cli, cliContext) {
|
|
1311284
1311320
|
cli.command(
|
|
1311285
1311321
|
"api update",
|